Request

This is simplest interface to both http and ftp protocols. Request has methods get, post and exec which routed to proper concrete handler (http or ftp, etc). To enable some protocol-specific featutes you have to use protocol interface directly (see docs for HTTPRequest or FTPRequest)

Members

Functions

addHeaders
void addHeaders(string[string] headers)

Add headers to request

clearHeaders
void clearHeaders()
Undocumented in source. Be warned that the author may not have intended to support it.
exec
Response exec(string uri, A args)
Undocumented in source. Be warned that the author may not have intended to support it.
format
string format(string fmt)
Undocumented in source. Be warned that the author may not have intended to support it.
get
Response get(string uri, A args)

Execute GET for http and retrieve file for FTP. You have to provide at least uri. All other arguments should conform to HTTPRequest.get or FTPRequest.get depending on the URI scheme. When arguments do not conform scheme (for example you try to call get("ftp://somehost.net/pub/README", {"a":"b"}) which doesn't make sense) you will receive Exception("Operation not supported for ftp")

post
Response post(string uri, A args)

Execute POST for http and STOR file for FTP. You have to provide uri and data. Data should conform to HTTPRequest.post or FTPRequest.post depending on the URI scheme. When arguments do not conform scheme you will receive Exception("Operation not supported for ftp")

toString
string toString()
Undocumented in source. Be warned that the author may not have intended to support it.

Properties

authenticator
Auth authenticator [@property setter]

Set authenticator for http requests. v - Auth instance.

bind
string bind [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
bufferSize
size_t bufferSize [@property setter]

Set IO buffer size for http and ftp requests v - buffer size in bytes.

contentLength
long contentLength [@property getter]

get contentLength of the responce

contentReceived
long contentReceived [@property getter]

get length og actually received content. this value increase over time, while we receive data

cookie
Cookie[] cookie [@property setter]

Set Cookie for http requests. v - array of cookie.

cookie
Cookie[] cookie [@property getter]

Get Cookie for http requests. v - array of cookie.

keepAlive
bool keepAlive [@property setter]

Set http keepAlive value v - use keepalive requests - true, or not - false

maxContentLength
size_t maxContentLength [@property setter]

Set maximum content lenth both for http and ftp requests v - maximum content length in bytes. When limit reached - throw RequestException

maxHeadersLength
size_t maxHeadersLength [@property setter]

Set maximum length for HTTP headers v - maximum length of the HTTP response. When limit reached - throw RequestException

maxRedirects
uint maxRedirects [@property setter]

Set limit on HTTP redirects v - limit on redirect depth

proxy
string proxy [@property setter]

set proxy property. v - full url to proxy.

sslOptions
auto sslOptions [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
sslSetCaCert
string sslSetCaCert [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
sslSetCertFile
void sslSetCertFile(string path, SSLOptions.filetype type)
Undocumented in source. Be warned that the author may not have intended to support it.
sslSetKeyFile
void sslSetKeyFile(string path, SSLOptions.filetype type)
Undocumented in source. Be warned that the author may not have intended to support it.
sslSetVerifyPeer
bool sslSetVerifyPeer [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
timeout
Duration timeout [@property setter]

Set timeout on IO operation. v - timeout value

useStreaming
bool useStreaming [@property setter]

set "streaming" property

verbosity
uint verbosity [@property setter]

Set verbosity for HTTP or FTP requests. v - verbosity level (0 - no output, 1 - headers to stdout, 2 - headers and body progress to stdout). default = 0.

Meta