View source code
Display the source code in std/net/curl.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

Struct std.net.curl.Curl

Wrapper to provide a better interface to libcurl than using the plain C API. It is recommended to use the HTTP/FTP etc. structs instead unless raw access to libcurl is needed.

struct Curl ;

Properties

NameTypeDescription
onProgress[set] int delegate(ulong, ulong, ulong, ulong)The event handler that gets called to inform of upload/download progress.
onReceive[set] ulong delegate(ubyte[])The event handler that receives incoming data.
onSeek[set] CurlSeek delegate(long, CurlSeekPos)The event handler that gets called when the curl backend needs to seek the data to be sent.
onSend[set] ulong delegate(void[])The event handler that gets called when data is needed for sending.
onSocketOption[set] int delegate(std.socket.socket_t, CurlSockType)The event handler that gets called when the net socket has been created but a connect() call has not yet been done. This makes it possible to set misc. socket options.
stopped[get] bool

Methods

NameDescription
clear (option) Clear a pointer option.
clearIfSupported (option) Clear a pointer option. Does not raise an exception if the underlying libcurl does not support the option. Use sparingly.
dup () Duplicate this handle.
getTiming (timing, val) Get the various timings like name lookup time, total time, connect time etc. The timed category is passed through the timing parameter while the timing value is stored at val. The value is usable only if res is equal to CurlError.ok.
initialize () Initialize the instance by creating a working curl handle.
onReceiveHeader () The event handler that receives incoming headers for protocols that uses headers.
pause (sendingPaused, receivingPaused) Pausing and continuing transfers.
perform (throwOnError) perform the curl request by doing the HTTP,FTP etc. as it has been setup beforehand.
set (option, value) Set a string curl option.
set (option, value) Set a long curl option.
set (option, value) Set a void* curl option.
shutdown () Stop and invalidate this curl instance.

Warning

This struct uses interior pointers for callbacks. Only allocate it on the stack if you never move or copy it. This also means passing by reference when passing Curl to other functions. Otherwise always allocate on the heap.

Authors

Jonas Drewsen. Some of the SMTP code contributed by Jimmy Cao.

License

Boost License 1.0.