Curl

Wrapper to provide a better interface to libcurl than using the plain C API.

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.

Constructors

this
this(CURL* h)
Undocumented in source.
this
this()
Undocumented in source.

Destructor

~this
~this()
Undocumented in source.

Postblit

this(this)
this(this)
Undocumented in source.

Members

Aliases

InData
alias InData = ubyte[]
Undocumented in source.
OutData
alias OutData = void[]
Undocumented in source.

Functions

clear
void clear(CurlOption option)

Clear a pointer option.

close
void close()

Stop and invalidate this curl instance. Warning: Do not call this from inside a callback handler e.g. onReceive.

dup
Curl dup()

Duplicate this handle.

get
long get(CurlInfo info)
Undocumented in source. Be warned that the author may not have intended to support it.
pause
void pause(bool sendingPaused, bool receivingPaused)

Pausing and continuing transfers.

perform
CURLcode perform(bool throwOnError)

perform the curl request by doing the HTTP,FTP etc. as it has been setup beforehand.

set
void set(CurlOption option, const(char)[] value)

Set a string curl option.

set
void set(CurlOption option, long value)

Set a long curl option.

set
void set(CurlOption option, void* value)

Set a void* curl option.

tryClear
CURLcode tryClear(CurlOption option)

Clear a pointer option. Does not raise an exception if the underlying libcurl does not support the option. Use sparingly.

tryGet
CURLcode tryGet(CurlInfo info, long val)
Undocumented in source. Be warned that the author may not have intended to support it.

Properties

handle
handle [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
onProgress
typeof(_onProgress) onProgress [@property setter]

The event handler that gets called to inform of upload/download progress.

onReceive
typeof(_onReceive) onReceive [@property setter]

The event handler that receives incoming data.

onReceiveHeader
void delegate(in char[]) onReceiveHeader [@property setter]

The event handler that receives incoming headers for protocols that uses headers.

onSeek
typeof(_onSeek) onSeek [@property setter]

The event handler that gets called when the curl backend needs to seek the data to be sent.

onSend
typeof(_onSend) onSend [@property setter]

The event handler that gets called when data is needed for sending.

onSocketOption
typeof(_onSocketOption) onSocketOption [@property setter]

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
bool stopped [@property getter]

Meta