#include <cascade/net/CascadeHTTPClient.h>
Inheritance diagram for CascadeHTTPClient:
Public Member Functions | |
CascadeHTTPClient (const char *pURL) | |
CascadeHTTPClient () | |
virtual | ~CascadeHTTPClient () |
virtual void | SetURL (const char *pURL) |
virtual bool | GetURL (CascadeString &url) const |
virtual void | SetHostname (const char *pHostname) |
virtual bool | GetHostname (CascadeString &hostname) const |
virtual void | SetPort (u16 nPort) |
virtual u16 | GetPort () const |
virtual void | SetPath (const char *pPath) |
virtual bool | GetPath (CascadeString &path) const |
virtual bool | GetPathQuery (CascadeString &pathnquery) const |
virtual void | SetFragment (const char *pFragment) |
virtual bool | GetFragment (CascadeString &fragment) const |
virtual void | SetQueryValue (const char *pQuery, const char *pQueryValue) |
specify or override any document request keyword | |
virtual bool | GetQueryValue (const char *pQuery, CascadeString &value) const |
discover current value of any document request keyword | |
virtual void | SetUsername (const char *pUsername) |
virtual bool | GetUsername (CascadeString &username) const |
virtual void | SetPassword (const char *pPassword) |
virtual bool | GetPassword (CascadeString &password) const |
virtual void | SetKeepAlive (bool bKeepAlive) |
default TRUE; FALSE to turn off keepalive | |
virtual bool | GetKeepAlive () const |
discover current keepalive setting | |
void | UserAgent (const char *user_agent) |
set or override user agent string; default "CascadeHTTPClient/1.0" | |
const char * | UserAgent () const |
discover current http version setting | |
virtual void | SetHTTPVersion (const char *pHTTPVersion) |
set or override http version; default "HTTP/1.1" | |
virtual bool | GetHTTPVersion (CascadeString &version) const |
discover current http version setting | |
virtual void | SetPeerHTTPVersion (const char *pPeerHTTPVersion) |
set or override required peer http version; default "HTTP/1.0" | |
virtual bool | GetPeerHTTPVersion (CascadeString &version) const |
discover current required peer http version | |
virtual void | SetMaxLineLength (u32 nMaxLineLength) |
set max_line_length; default 1024, 0 => no limit | |
virtual u32 | GetMaxLineLength () const |
discover current max_line_length | |
virtual void | SetMaxHeaderLines (u32 nMaxHeaderLines) |
set max_header_lines; default 4096, 0 => no limit | |
virtual u32 | GetMaxHeaderLines () const |
discover current max_header_lines | |
virtual void | SetRequestHeader (const char *pHeaderKey, const char *pHeaderValue) |
specify or override any HTTP header value | |
virtual bool | GetRequestHeader (const char *pHeaderKey, CascadeString &header) const |
discover current value of any request header | |
virtual void | SetByteRange (u64 nRangeStart, u64 nRangeStop) |
virtual void | GetByteRange (u64 &nRangeStartToSet, u64 &nRangeStopToSet) const |
u32 | GET () |
download a document | |
u32 | GET (const char *path) |
download a document | |
u32 | HEAD () |
identical to GET() but without downloading entity content | |
u32 | HEAD (const char *path) |
identical to GET(const char *path) but without downloading entity content | |
u32 | POST (const char *buf, u32 len) |
post LEN chars of BUF to the current connection/path | |
u32 | POST (const char *path, const char *buf, u32 len) |
post LEN chars of BUF to the relative path PATH | |
u32 | PUT (const char *buf, u32 len) |
upload LEN chars of BUF to the current connection/path | |
u32 | PUT (const char *path, const char *buf, u32 len) |
upload LEN chars of BUF to the relative path PATH | |
u32 | DELETE () |
delete the document at the current connection/path | |
u32 | DELETE (const char *path) |
delete the document at a relative connection/path | |
u32 | TRACE () |
HTTP's version of "echo" service. | |
u32 | TRACE (const char *path) |
HTTP's version of "echo" service. | |
virtual bool | GetResponseCode (CascadeString &code) const |
three-digit HTTP 1.1 response code (RFC 2616 Chapter 10) | |
virtual bool | GetResponseText (CascadeString &text) const |
RFC 2616 Chapter 10 translation of three-digit response code. | |
virtual u32 | GetResponseCodeInt () const |
integerified three-digit HTTP 1.1 response code (RFC 2616 Chapter 10) | |
virtual bool | GetResponseHeader (CascadeString &header) const |
return content of entire response header | |
virtual bool | GetResponseHeaderAt (u32 nIndex, CascadeString &header) const |
return the text of the entire Ith respons header or empty string | |
virtual bool | GetResponseHeaderKey (u32 nIndex, CascadeString &key) const |
return the Ith response header name or empty string | |
virtual bool | GetResponseHeaderValue (const char *pResponseHeaderKey, CascadeString &value) const |
return the response header value associated with THIS_FIELD | |
virtual u32 | ReadBytes (char *pBuff, u32 nBytes) |
read nBytes bytes into *pBuff | |
virtual bool | SetConnectTimeout (u32 nTimeoutMicroseconds) |
set the connect timeout to this many microseconds (the default is 0 seconds, which means BLOCKING MODE) | |
virtual bool | SetSendTimeout (u32 nTimeoutMicroseconds) |
set the send timeout to this many microseconds (the default is 0 seconds, which means BLOCKING MODE) | |
virtual bool | SetReceiveTimeout (u32 nTimeoutMicroseconds) |
set the receive timeout to this many microseconds (the default is 0 seconds, which means BLOCKING MODE) | |
virtual u32 | GetConnectTimeout () const |
get the current connect timeout in microseconds | |
virtual u32 | GetSendTimeout () const |
get the current send timeout in microseconds | |
virtual u32 | GetReceiveTimeout () const |
get the current receive timeout in microseconds | |
virtual bool | SetAutoRedirectLimit (int this_many_times) |
set the number of times that CascadeHTTPClient will automatically fetch a redirect location | |
Static Public Member Functions | |
static void | URLEncodeString (const CascadeString input, CascadeString &output) |
encode the string in input, putting the result in output. | |
static bool | ErrorString (const u32 get_retval, CascadeString &error_string) |
return a string describing the error value returned by a call to GET() |
Design Goals: Use this class to talk HTTP to any server on the routable network. Allow user to specify destinations and paths using string URLs (RFC 2396, URL subset), Allow user to send and receive messages to and from servers for those URLs. This is the ONLY class you will need to include in order to use all client features of the HTTP 1.1 protocol.
Examples: see test-htcli.cpp
|
Become an HTTP client of the server at this URL Prerequisites:
|
|
Become an HTTP client of a yet unspecified server Become an HTTP client. No server specified, so it must be specified later. Prerequisites: none
|
|
destructor Prerequisites: this CascadeHTTPClient object can be in ANY state Postconditions:
|
|
delete the document at a relative connection/path
|
|
delete the document at the current connection/path
|
|
return a string describing the error value returned by a call to GET()
|
|
download a document
|
|
download a document
|
|
|
|
get the current connect timeout in microseconds
|
|
discover current document path fragment
|
|
discover current server hostname
|
|
discover current http version setting
|
|
discover current keepalive setting
|
|
discover current max_header_lines
|
|
discover current max_line_length
|
|
get password currently used for AUTH
|
|
discover current document path
|
|
discover current document path and complete query, quoted
|
|
discover current required peer http version
|
|
discover current server port number
|
|
discover current value of any document request keyword
|
|
get the current receive timeout in microseconds
|
|
discover current value of any request header
|
|
three-digit HTTP 1.1 response code (RFC 2616 Chapter 10)
|
|
integerified three-digit HTTP 1.1 response code (RFC 2616 Chapter 10)
|
|
return content of entire response header
|
|
return the text of the entire Ith respons header or empty string
|
|
return the Ith response header name or empty string
|
|
return the response header value associated with THIS_FIELD
|
|
RFC 2616 Chapter 10 translation of three-digit response code.
|
|
get the current send timeout in microseconds
|
|
discover the URL currently used by this HTTPClient.
|
|
get username currently used by AUTH
|
|
identical to GET(const char *path) but without downloading entity content
|
|
identical to GET() but without downloading entity content
|
|
post LEN chars of BUF to the relative path PATH
|
|
post LEN chars of BUF to the current connection/path
|
|
upload LEN chars of BUF to the relative path PATH
|
|
upload LEN chars of BUF to the current connection/path
|
|
read nBytes bytes into *pBuff
|
|
set the number of times that CascadeHTTPClient will automatically fetch a redirect location
|
|
|
|
set the connect timeout to this many microseconds (the default is 0 seconds, which means BLOCKING MODE)
|
|
specify or override document path fragment
|
|
specify or override server hostname
|
|
set or override http version; default "HTTP/1.1"
|
|
default TRUE; FALSE to turn off keepalive
|
|
set max_header_lines; default 4096, 0 => no limit
|
|
set max_line_length; default 1024, 0 => no limit
|
|
set (optionally pre-encrypted) password for AUTH
|
|
specify or override document path
|
|
set or override required peer http version; default "HTTP/1.0"
|
|
specify or override server port number
|
|
specify or override any document request keyword
|
|
set the receive timeout to this many microseconds (the default is 0 seconds, which means BLOCKING MODE)
|
|
specify or override any HTTP header value
|
|
set the send timeout to this many microseconds (the default is 0 seconds, which means BLOCKING MODE)
|
|
set or override the URL used by this HTTPClient.
|
|
set username for AUTH
|
|
HTTP's version of "echo" service.
|
|
HTTP's version of "echo" service.
|
|
encode the string in input, putting the result in output.
|
|
discover current http version setting
|
|
set or override user agent string; default "CascadeHTTPClient/1.0"
|