Curl.onReceive

The event handler that receives incoming data.

struct Curl
@property
void
onReceive
(
size_t delegate
(
InData
)
callback
)

Parameters

callback size_t delegate

the callback that receives the ubyte[] data. Be sure to copy the incoming data and not store a slice.

Return Value

Type: void

The callback returns the incoming bytes read. If not the entire array is the request will abort. The special value HTTP.pauseRequest can be returned in order to pause the current request.

Examples

import std.net.curl, std.stdio;
Curl curl;
curl.initialize();
curl.set(CurlOption.url, "http://dlang.org");
curl.onReceive = (ubyte[] data) { writeln("Got data", to!(const(char)[])(data)); return data.length;};
curl.perform();

Meta

Suggestion Box / Bug Report