#include <ulxr_http_protocol.h>
Inheritance diagram for ulxr::HttpProtocol:
Public Types | |
typedef std::map< CppString, CppString > | header_property |
Public Member Functions | |
HttpProtocol (Connection *conn, const CppString &hostname, unsigned hostport) | |
Constructs a Protocol. | |
HttpProtocol (TcpIpConnection *conn) | |
Constructs a Protocol. | |
virtual | ~HttpProtocol () |
Destroys the Protocol. | |
virtual bool | responseStatus (CppString &phrase) const |
Tests if the response was successful regarding the transportation. | |
virtual void | sendRpcCall (const MethodCall &call, const CppString &resource, bool wbxml) |
Sends a MethodCall over the connection. | |
virtual void | sendRpcResponse (const MethodResponse &resp, bool wbxml) |
Sends a MethodResponse over the connection. | |
virtual void | resetConnection () |
Resets the state of the Protocol. | |
virtual State | connectionMachine (char *&buffer, long &len) |
Process a chunk of input data from the connection. | |
virtual void | setTransmitOnly () |
Sets the current transmission to expect/accept no return value. | |
virtual bool | isTransmitOnly () |
Tests if the current transmission expects a return value. | |
virtual CppString | getProtocolName () |
Returns the protocol name. | |
virtual bool | hasBytesToRead () const |
Tests if there are bytes left in the message body. | |
virtual bool | determineClosing (const CppString &http_ver) |
Determines what to do after completing the current transaction. | |
void | sendNegativeResponse (int status, const CppString &phrase, const CppString &info=ULXR_PCHAR("")) |
Sends a header and a html body containing error values from "outside". | |
void | sendRequestHeader (const CppString &method, const CppString &resource, const CppString &type, unsigned long len, bool wbxml_mode=false) |
Sends a http request header. | |
void | sendResponseHeader (int code, const CppString &phrase, const CppString &type, unsigned long len, bool wbxml_mode=false) |
Sends a http response header. | |
CppString | getUserAgent () const |
Gets the user agent. | |
void | setUserAgent (const CppString &ua) |
Sets the user agent. | |
virtual void | rejectAuthentication (const CppString &realm) |
Sends a negative response to the caller. | |
virtual void | setMessageAuthentication (const CppString &user, const CppString &pass) |
Sets username and password for the next transmission (client mode). | |
virtual void | setProxyAuthentication (const CppString &user, const CppString &pass) |
Sets proxy username and password for all the following transmission (client mode). | |
CppString | getHttpProperty (const CppString &name) const |
Gets a property field from the http header. | |
bool | hasHttpProperty (const CppString &name) const |
Tests if a property field from the http header is available. | |
CppString | getFirstHeaderLine () const |
Gets the first line from the http header. | |
virtual Protocol * | detach () |
Detaches the protocol by creating a duplicate of the protocol + connection and closing the original connection afterwards. | |
void | clearCookie () |
Clears the current cookie set. | |
bool | hasCookie () const |
Tests if any cookies have been set. | |
void | setCookie (const CppString &cont) |
Sets the current cookie set. | |
CppString | getCookie () const |
Gets the current cookie set. | |
void | setServerCookie (const CppString &cookie) |
Sets the current cookie set for a server connection. | |
CppString | getServerCookie () const |
Gets the current cookie set for a server connection. | |
bool | hasServerCookie () const |
Checks if a cookie for the server connection is set. | |
void | setClientCookie (const CppString &cookie) |
Sets the current cookie set for a client connection Adds a "Cookie:" line into the response header. | |
CppString | getClientCookie () const |
Gets the current cookie set for a client connection. | |
bool | hasClientCookie () const |
Checks if a cookie for the client connection is set. | |
void | setAcceptCookies (bool bAccept=true) |
Sets the acceptance of cookies. | |
bool | isAcceptCookies () const |
Queries the acceptance of cookies. | |
virtual void | shutdown (int mode) |
Shuts down the socket. | |
virtual void | close () |
Closes the connection. | |
void | enableConnect (bool enable=true) |
Enables the connection via a proxy with CONNECT method. | |
bool | isConnectEnabled () const |
Checks if the http CONNECT is to be used. | |
bool | isConnected () const |
Checks if the http CONNECT has succeeded. | |
void | doConnect () |
Sends a CONNECT message to the proxy and waits for the response. | |
void | splitHeaderLine (CppString &head_version, unsigned &head_status, CppString &head_phrase) |
Splits the first header line in a http response into its three parts. | |
void | writeBody (const char *data, unsigned long len) |
Writes the body to the data stream. | |
void | writeChunk (const char *data, unsigned long len) |
Writes a chunk to the data stream. | |
void | setChunkedTransfer (bool chunked) |
Sets the chunk size for chunked encoding. | |
bool | isChunkedTransfer () const |
Gets the chunk size for chunked encoding. | |
Static Public Member Functions | |
static CppString | getDateStr () |
Gets the current date as valid string for a http header. | |
Protected Types | |
enum | HttpState { ConnChunkHeader = Protocol::ConnLast, ConnChunkBody, ConnChunkBodySkip, ConnChunkTerminated } |
Http connection states while reading input stream. More... | |
Protected Member Functions | |
void | tryConnect () |
Tries to connect to the outside server via a proxy with http CONNECT. | |
void | awaitConnect () |
Waits for the proxy response about the result of the CONNECT. | |
bool | hasClosingProperty () |
Checks if the current http has contains some closing property. | |
void | clearHttpInfo () |
Reset all information contained in the http header. | |
virtual bool | getUserPass (CppString &user, CppString &pass) const |
Extracts username and password from current message. | |
void | addOneTimeHttpField (const CppString &name, const CppString &value) |
Adds a http header field for the next transmission. | |
virtual void | determineContentLength () |
Determines the length of the message body. | |
void | parseHeaderLine () |
Parses the first line of the header. | |
bool | checkContinue () |
Checks for a pending 100-Continue. | |
Private Member Functions | |
void | init () |
Initializes internal variables. | |
void | machine_switchToBody (char *&buffer, long &len, char *&chunk_start, char *&chunk_cursor) |
Statemachine switches to body. | |
HttpProtocol (const HttpProtocol &) | |
HttpProtocol & | operator= (const HttpProtocol &) |
Private Attributes | |
PImpl * | pimpl |
Classes | |
struct | PImpl |
Definition at line 50 of file ulxr_http_protocol.h.
typedef std::map<CppString, CppString> ulxr::HttpProtocol::header_property |
Definition at line 54 of file ulxr_http_protocol.h.
enum ulxr::HttpProtocol::HttpState [protected] |
Http connection states while reading input stream.
Definition at line 369 of file ulxr_http_protocol.h.
ulxr::HttpProtocol::HttpProtocol | ( | Connection * | conn, | |
const CppString & | hostname, | |||
unsigned | hostport | |||
) |
Constructs a Protocol.
conn | pointer to connection object | |
hostname | name of host | |
hostport | port of host |
Definition at line 106 of file ulxr_http_protocol.cpp.
References ulxr::HttpProtocol::PImpl::hostname, ulxr::HttpProtocol::PImpl::hostport, init(), pimpl, ULXR_PCHAR, and ULXR_TRACE.
ulxr::HttpProtocol::HttpProtocol | ( | TcpIpConnection * | conn | ) |
Constructs a Protocol.
conn | pointer to connection object |
Definition at line 118 of file ulxr_http_protocol.cpp.
References ulxr::TcpIpConnection::getPeerName(), ulxr::TcpIpConnection::getPort(), ulxr::HttpProtocol::PImpl::hostname, ulxr::HttpProtocol::PImpl::hostport, init(), pimpl, ULXR_PCHAR, and ULXR_TRACE.
ulxr::HttpProtocol::~HttpProtocol | ( | ) | [virtual] |
Destroys the Protocol.
Definition at line 129 of file ulxr_http_protocol.cpp.
References ulxr::HttpProtocol::PImpl::connector, pimpl, ULXR_PCHAR, and ULXR_TRACE.
ulxr::HttpProtocol::HttpProtocol | ( | const HttpProtocol & | ) | [private] |
bool ulxr::HttpProtocol::responseStatus | ( | CppString & | phrase | ) | const [virtual] |
Tests if the response was successful regarding the transportation.
phrase | return value describing the problem. |
Implements ulxr::Protocol.
Definition at line 1044 of file ulxr_http_protocol.cpp.
References ulxr::stripWS(), ULXR_CHAR, ulxr_i18n, ULXR_PCHAR, and ULXR_TRACE.
void ulxr::HttpProtocol::sendRpcCall | ( | const MethodCall & | call, | |
const CppString & | resource, | |||
bool | wbxml | |||
) | [virtual] |
Sends a MethodCall over the connection.
call | pointer to the calling data | |
resource | resource for rpc on remote host | |
wbxml | true: data is sent as wbxml |
Reimplemented from ulxr::Protocol.
Definition at line 1012 of file ulxr_http_protocol.cpp.
References ulxr::binaryDebugOutput(), ULXR_DOUT_XML, ULXR_PCHAR, ULXR_TRACE, and ulxr::unicodeToUtf8().
void ulxr::HttpProtocol::sendRpcResponse | ( | const MethodResponse & | resp, | |
bool | wbxml | |||
) | [virtual] |
Sends a MethodResponse over the connection.
resp | pointer to the response data | |
wbxml | true: data is sent as wbxml |
Reimplemented from ulxr::Protocol.
Definition at line 944 of file ulxr_http_protocol.cpp.
References ulxr::binaryDebugOutput(), ULXR_DOUT_XML, ULXR_PCHAR, ULXR_TRACE, and ulxr::unicodeToUtf8().
void ulxr::HttpProtocol::resetConnection | ( | ) | [virtual] |
Resets the state of the Protocol.
Before starting a transfer you should call this to ensure a defined state of the internal state machine processing the protocol.
Reimplemented from ulxr::Protocol.
Definition at line 184 of file ulxr_http_protocol.cpp.
References ulxr::Protocol::resetConnection(), ULXR_PCHAR, and ULXR_TRACE.
Protocol::State ulxr::HttpProtocol::connectionMachine | ( | char *& | buffer, | |
long & | len | |||
) | [virtual] |
Process a chunk of input data from the connection.
Usually you call read() to get some more data and pass it to this method. It processes the header. Normally you only have to take care of two states: ConnError which results in terminating the connection. ConnBody on the other side indicates user data which might be fed to a parser.
buffer | pointer to input data | |
len | valid length of buffer |
Reimplemented from ulxr::Protocol.
Definition at line 318 of file ulxr_http_protocol.cpp.
References ulxr::SystemError, ulxr_i18n, ULXR_PCHAR, and ULXR_TRACE.
void ulxr::HttpProtocol::setTransmitOnly | ( | ) | [virtual] |
Sets the current transmission to expect/accept no return value.
Reimplemented from ulxr::Protocol.
Definition at line 1180 of file ulxr_http_protocol.cpp.
References ULXR_PCHAR, and ULXR_TRACE.
bool ulxr::HttpProtocol::isTransmitOnly | ( | ) | [virtual] |
Tests if the current transmission expects a return value.
Reimplemented from ulxr::Protocol.
Definition at line 1187 of file ulxr_http_protocol.cpp.
References ULXR_PCHAR, and ULXR_TRACE.
CppString ulxr::HttpProtocol::getProtocolName | ( | ) | [virtual] |
Returns the protocol name.
Implements ulxr::Protocol.
Definition at line 1195 of file ulxr_http_protocol.cpp.
References ULXR_PCHAR.
bool ulxr::HttpProtocol::hasBytesToRead | ( | ) | const [virtual] |
Tests if there are bytes left in the message body.
Implements ulxr::Protocol.
Definition at line 569 of file ulxr_http_protocol.cpp.
References ULXR_PCHAR, and ULXR_TRACE.
bool ulxr::HttpProtocol::determineClosing | ( | const CppString & | http_ver | ) | [virtual] |
Determines what to do after completing the current transaction.
Depending on the protocol version and some properties the connection remains open or closes.
http_ver | numeral part of the version from the http header |
Definition at line 1081 of file ulxr_http_protocol.cpp.
References ulxr::makeLower(), ULXR_PCHAR, and ULXR_TRACE.
void ulxr::HttpProtocol::sendNegativeResponse | ( | int | status, | |
const CppString & | phrase, | |||
const CppString & | info = ULXR_PCHAR("") | |||
) |
Sends a header and a html body containing error values from "outside".
status | http error code | |
phrase | human readable description | |
info | additionaly info to appear in the html response part |
Definition at line 899 of file ulxr_http_protocol.cpp.
References ULXR_DOUT_RESP, ULXR_GET_STRING, ulxr_i18n, ULXR_PACKAGE, ULXR_PCHAR, ulxr_sprintf, ULXR_TRACE, ULXR_VERSION, and ulxr::unicodeToUtf8().
void ulxr::HttpProtocol::sendRequestHeader | ( | const CppString & | method, | |
const CppString & | resource, | |||
const CppString & | type, | |||
unsigned long | len, | |||
bool | wbxml_mode = false | |||
) |
Sends a http request header.
The actual data must follow directly afterwards.
method | the http method in use | |
resource | the requested resource | |
type | the content-type of the requesting data | |
len | the length of the data in the requesting body | |
wbxml_mode | true: suppress some header fields |
Definition at line 804 of file ulxr_http_protocol.cpp.
References ulxr::encodeBase64(), ULXR_CHAR, ULXR_DOUT_HTTP, ULXR_GET_STRING, ULXR_PCHAR, ulxr_sprintf, ULXR_TRACE, and ulxr::unicodeToUtf8().
void ulxr::HttpProtocol::sendResponseHeader | ( | int | code, | |
const CppString & | phrase, | |||
const CppString & | type, | |||
unsigned long | len, | |||
bool | wbxml_mode = false | |||
) |
Sends a http response header.
The actual data must follow directly afterwards.
code | http status code | |
phrase | human readable http status phrase | |
type | the content-type of the requesting data | |
len | the length of the data in the requesting body | |
wbxml_mode | true: suppress some header fields |
Definition at line 609 of file ulxr_http_protocol.cpp.
References ULXR_CHAR, ULXR_DOUT_HTTP, ULXR_GET_STRING, ULXR_PCHAR, ulxr_sprintf, ULXR_TRACE, and ulxr::unicodeToUtf8().
CppString ulxr::HttpProtocol::getUserAgent | ( | ) | const |
Gets the user agent.
The user agent describes the client application.
Definition at line 1320 of file ulxr_http_protocol.cpp.
void ulxr::HttpProtocol::setUserAgent | ( | const CppString & | ua | ) |
Sets the user agent.
The user agent describes the client application.
ua | the user agent. |
Definition at line 1314 of file ulxr_http_protocol.cpp.
void ulxr::HttpProtocol::rejectAuthentication | ( | const CppString & | realm | ) | [virtual] |
Sends a negative response to the caller.
realm | Description for the caller which username and password to use |
Reimplemented from ulxr::Protocol.
Definition at line 1145 of file ulxr_http_protocol.cpp.
References ULXR_PCHAR, and ULXR_TRACE.
void ulxr::HttpProtocol::setMessageAuthentication | ( | const CppString & | user, | |
const CppString & | pass | |||
) | [virtual] |
Sets username and password for the next transmission (client mode).
This makes the next transmission block use a simple authentication scheme with a username and password.
user | Username | |
pass | Password |
Reimplemented from ulxr::Protocol.
Definition at line 1161 of file ulxr_http_protocol.cpp.
References ulxr::encodeBase64(), ULXR_PCHAR, and ULXR_TRACE.
void ulxr::HttpProtocol::setProxyAuthentication | ( | const CppString & | user, | |
const CppString & | pass | |||
) | [virtual] |
Sets proxy username and password for all the following transmission (client mode).
This makes the transmissions use a simple authentication scheme with a username and password. Set both strings empty to disable proxy authentication.
user | Username | |
pass | Password |
Definition at line 1171 of file ulxr_http_protocol.cpp.
References ULXR_PCHAR, and ULXR_TRACE.
Gets a property field from the http header.
The names are case insensitive. If the property is not available RuntimeException is throw so you should before with hasHttpProperty.
name | the name of the field |
Definition at line 210 of file ulxr_http_protocol.cpp.
References ulxr::makeLower(), ulxr::NotConformingError, ulxr_i18n, ULXR_PCHAR, and ULXR_TRACE.
Referenced by hasClosingProperty(), and machine_switchToBody().
bool ulxr::HttpProtocol::hasHttpProperty | ( | const CppString & | name | ) | const |
Tests if a property field from the http header is available.
The names are case insensitive.
name | the name of the field |
Definition at line 225 of file ulxr_http_protocol.cpp.
References ulxr::makeLower(), ULXR_PCHAR, and ULXR_TRACE.
Referenced by hasClosingProperty(), and machine_switchToBody().
CppString ulxr::HttpProtocol::getDateStr | ( | ) | [static] |
Gets the current date as valid string for a http header.
Definition at line 870 of file ulxr_http_protocol.cpp.
References ulxr::ctimeMutex, ulxr_ctime, ULXR_GET_STRING, ULXR_PCHAR, and ULXR_TRACE.
CppString ulxr::HttpProtocol::getFirstHeaderLine | ( | ) | const |
Gets the first line from the http header.
the forst line contains special information depending on the direction from or to the server.
Definition at line 1326 of file ulxr_http_protocol.cpp.
Protocol * ulxr::HttpProtocol::detach | ( | ) | [virtual] |
Detaches the protocol by creating a duplicate of the protocol + connection and closing the original connection afterwards.
Implements ulxr::Protocol.
Definition at line 138 of file ulxr_http_protocol.cpp.
References ulxr::HttpProtocol::PImpl::connector, doConnect(), pimpl, ulxr::Protocol::setConnection(), ULXR_PCHAR, and ULXR_TRACE.
Referenced by ulxr::HttpServer::HttpServer().
void ulxr::HttpProtocol::clearCookie | ( | ) |
Clears the current cookie set.
bool ulxr::HttpProtocol::hasCookie | ( | ) | const |
Tests if any cookies have been set.
Definition at line 1201 of file ulxr_http_protocol.cpp.
References ulxr::HttpProtocol::PImpl::cookies, pimpl, ULXR_PCHAR, and ULXR_TRACE.
void ulxr::HttpProtocol::setCookie | ( | const CppString & | cont | ) |
Sets the current cookie set.
The set comes from both header line "Cookie:" and "Set-Cookie:".
cont | cookie line from http header |
Definition at line 1209 of file ulxr_http_protocol.cpp.
References ulxr::HttpProtocol::PImpl::cookies, pimpl, ulxr::stripWS(), ULXR_PCHAR, and ULXR_TRACE.
CppString ulxr::HttpProtocol::getCookie | ( | ) | const |
Gets the current cookie set.
Definition at line 1240 of file ulxr_http_protocol.cpp.
References ulxr::HttpProtocol::PImpl::cookies, pimpl, ULXR_PCHAR, and ULXR_TRACE.
void ulxr::HttpProtocol::setServerCookie | ( | const CppString & | cookie | ) |
Sets the current cookie set for a server connection.
Adds a "Set-Cookie:" line into the response header.
cookie | cookie line suitable for http header |
Definition at line 1270 of file ulxr_http_protocol.cpp.
References ULXR_PCHAR, and ULXR_TRACE.
CppString ulxr::HttpProtocol::getServerCookie | ( | ) | const |
Gets the current cookie set for a server connection.
Definition at line 1277 of file ulxr_http_protocol.cpp.
References ULXR_PCHAR, and ULXR_TRACE.
bool ulxr::HttpProtocol::hasServerCookie | ( | ) | const |
Checks if a cookie for the server connection is set.
Definition at line 1284 of file ulxr_http_protocol.cpp.
References ULXR_PCHAR, and ULXR_TRACE.
void ulxr::HttpProtocol::setClientCookie | ( | const CppString & | cookie | ) |
Sets the current cookie set for a client connection Adds a "Cookie:" line into the response header.
cookie | cookie line suitable for http header |
Definition at line 1292 of file ulxr_http_protocol.cpp.
References ULXR_PCHAR, and ULXR_TRACE.
CppString ulxr::HttpProtocol::getClientCookie | ( | ) | const |
Gets the current cookie set for a client connection.
Definition at line 1299 of file ulxr_http_protocol.cpp.
References ULXR_PCHAR, and ULXR_TRACE.
bool ulxr::HttpProtocol::hasClientCookie | ( | ) | const |
Checks if a cookie for the client connection is set.
Definition at line 1306 of file ulxr_http_protocol.cpp.
References ULXR_PCHAR, and ULXR_TRACE.
void ulxr::HttpProtocol::setAcceptCookies | ( | bool | bAccept = true |
) |
Sets the acceptance of cookies.
bAccept | true: accept cookies. |
Definition at line 1256 of file ulxr_http_protocol.cpp.
References ULXR_PCHAR, and ULXR_TRACE.
bool ulxr::HttpProtocol::isAcceptCookies | ( | ) | const |
Queries the acceptance of cookies.
Definition at line 1263 of file ulxr_http_protocol.cpp.
References ULXR_PCHAR, and ULXR_TRACE.
void ulxr::HttpProtocol::shutdown | ( | int | mode | ) | [virtual] |
Shuts down the socket.
mode | shutdown mode
|
Implements ulxr::Protocol.
Definition at line 202 of file ulxr_http_protocol.cpp.
References ULXR_PCHAR, and ULXR_TRACE.
void ulxr::HttpProtocol::close | ( | ) | [virtual] |
Closes the connection.
Reimplemented from ulxr::Protocol.
Definition at line 193 of file ulxr_http_protocol.cpp.
References ulxr::Protocol::close(), ULXR_PCHAR, and ULXR_TRACE.
void ulxr::HttpProtocol::enableConnect | ( | bool | enable = true |
) |
Enables the connection via a proxy with CONNECT method.
enable | true: enable CONNECT method |
Definition at line 689 of file ulxr_http_protocol.cpp.
References ULXR_PCHAR, and ULXR_TRACE.
bool ulxr::HttpProtocol::isConnectEnabled | ( | ) | const |
Checks if the http CONNECT is to be used.
Definition at line 696 of file ulxr_http_protocol.cpp.
References ULXR_PCHAR, and ULXR_TRACE.
bool ulxr::HttpProtocol::isConnected | ( | ) | const |
Checks if the http CONNECT has succeeded.
Definition at line 703 of file ulxr_http_protocol.cpp.
References ULXR_PCHAR, and ULXR_TRACE.
void ulxr::HttpProtocol::doConnect | ( | ) |
Sends a CONNECT message to the proxy and waits for the response.
Definition at line 791 of file ulxr_http_protocol.cpp.
void ulxr::HttpProtocol::splitHeaderLine | ( | CppString & | head_version, | |
unsigned & | head_status, | |||
CppString & | head_phrase | |||
) |
Splits the first header line in a http response into its three parts.
head_version | [OUT] http version | |
head_status | [OUT] http response status | |
head_phrase | [OUT] an explanation phrase |
Definition at line 1333 of file ulxr_http_protocol.cpp.
References ulxr::getLatin1(), ulxr::stripWS(), ulxr_atoi, and ULXR_PCHAR.
void ulxr::HttpProtocol::writeBody | ( | const char * | data, | |
unsigned long | len | |||
) |
Writes the body to the data stream.
The current encoding is honoured.
data | pointer to the data | |
len | length of the data |
Definition at line 1000 of file ulxr_http_protocol.cpp.
void ulxr::HttpProtocol::writeChunk | ( | const char * | data, | |
unsigned long | len | |||
) |
Writes a chunk to the data stream.
The chunk size must be != 0.
data | pointer to the data | |
len | length of the data |
Definition at line 974 of file ulxr_http_protocol.cpp.
References ulxr::NotConformingError, ULXR_GET_STRING, ulxr_i18n, ULXR_PCHAR, ulxr_sprintf, and ULXR_TRACE.
void ulxr::HttpProtocol::setChunkedTransfer | ( | bool | chunked | ) |
Sets the chunk size for chunked encoding.
chunked | false == no chunked transfer |
Definition at line 1375 of file ulxr_http_protocol.cpp.
References ULXR_PCHAR, and ULXR_TRACE.
Referenced by ulxr::HttpClient::HttpClient(), and ulxr::HttpServer::HttpServer().
bool ulxr::HttpProtocol::isChunkedTransfer | ( | ) | const |
Gets the chunk size for chunked encoding.
Definition at line 1382 of file ulxr_http_protocol.cpp.
References ULXR_PCHAR, and ULXR_TRACE.
void ulxr::HttpProtocol::tryConnect | ( | ) | [protected] |
Tries to connect to the outside server via a proxy with http CONNECT.
Definition at line 761 of file ulxr_http_protocol.cpp.
References ulxr::encodeBase64(), ULXR_DOUT_HTTP, ULXR_GET_STRING, ULXR_PCHAR, ulxr_sprintf, ULXR_TRACE, and ulxr::unicodeToUtf8().
void ulxr::HttpProtocol::awaitConnect | ( | ) | [protected] |
Waits for the proxy response about the result of the CONNECT.
Definition at line 710 of file ulxr_http_protocol.cpp.
References ulxr::TransportError, ulxr_i18n, ULXR_PCHAR, ULXR_RECV_BUFFER_SIZE, and ULXR_TRACE.
bool ulxr::HttpProtocol::hasClosingProperty | ( | ) | [protected] |
Checks if the current http has contains some closing property.
This recognises "Connection: Close" as well as "Proxy-Connection: Close".
Definition at line 277 of file ulxr_http_protocol.cpp.
References getHttpProperty(), hasHttpProperty(), ulxr::makeLower(), and ULXR_PCHAR.
Referenced by machine_switchToBody().
void ulxr::HttpProtocol::clearHttpInfo | ( | ) | [protected] |
Reset all information contained in the http header.
Definition at line 168 of file ulxr_http_protocol.cpp.
References ULXR_PCHAR, and ULXR_TRACE.
bool ulxr::HttpProtocol::getUserPass | ( | CppString & | user, | |
CppString & | pass | |||
) | const [protected, virtual] |
Extracts username and password from current message.
user | reference to return username | |
pass | reference to return password |
Reimplemented from ulxr::Protocol.
Definition at line 1108 of file ulxr_http_protocol.cpp.
References ulxr::decodeBase64(), ulxr::makeLower(), ulxr::stripWS(), ULXR_PCHAR, and ULXR_TRACE.
void ulxr::HttpProtocol::addOneTimeHttpField | ( | const CppString & | name, | |
const CppString & | value | |||
) | [protected] |
Adds a http header field for the next transmission.
The user fields are reset after transmission.
name | http header field name | |
value | value of header field |
Definition at line 1154 of file ulxr_http_protocol.cpp.
References ulxr::stripWS(), ULXR_PCHAR, and ULXR_TRACE.
void ulxr::HttpProtocol::determineContentLength | ( | ) | [protected, virtual] |
Determines the length of the message body.
Implements ulxr::Protocol.
Definition at line 582 of file ulxr_http_protocol.cpp.
References ulxr::getLatin1(), ulxr::NotConformingError, ulxr_atoi, ulxr_i18n, ULXR_PCHAR, and ULXR_TRACE.
Referenced by machine_switchToBody().
void ulxr::HttpProtocol::parseHeaderLine | ( | ) | [protected] |
Parses the first line of the header.
The first line contains special information like path to the data, http version in use or error information.
Definition at line 235 of file ulxr_http_protocol.cpp.
References ulxr::makeLower(), ulxr::stripWS(), ULXR_DOUT_HTTP, ULXR_PCHAR, and ULXR_TRACE.
bool ulxr::HttpProtocol::checkContinue | ( | ) | [protected] |
Checks for a pending 100-Continue.
Definition at line 299 of file ulxr_http_protocol.cpp.
References ULXR_PCHAR, and ULXR_TRACE.
Referenced by machine_switchToBody().
void ulxr::HttpProtocol::init | ( | ) | [private] |
Initializes internal variables.
Reimplemented from ulxr::Protocol.
Definition at line 148 of file ulxr_http_protocol.cpp.
References doConnect(), ULXR_GET_STRING, ULXR_PACKAGE, ULXR_PCHAR, ULXR_TRACE, and ULXR_VERSION.
Referenced by HttpProtocol().
void ulxr::HttpProtocol::machine_switchToBody | ( | char *& | buffer, | |
long & | len, | |||
char *& | chunk_start, | |||
char *& | chunk_cursor | |||
) | [private] |
Statemachine switches to body.
buffer | pointer to input data | |
len | valid length of buffer | |
chunk_start | pointer to start of chunk data | |
chunk_cursor | pointer to current chunk data |
Definition at line 512 of file ulxr_http_protocol.cpp.
References ulxr::HttpProtocol::PImpl::bChunkedEncoding, checkContinue(), ulxr::HttpProtocol::PImpl::chunk_data, ulxr::HttpProtocol::PImpl::chunk_in_header, ulxr::HttpProtocol::PImpl::chunk_size, ulxr::HttpProtocol::PImpl::chunk_terminated, ulxr::Protocol::ConnBody, ConnChunkHeader, ConnChunkTerminated, determineContentLength(), ulxr::Protocol::getContentLength(), getHttpProperty(), hasClosingProperty(), hasHttpProperty(), pimpl, ulxr::Protocol::setConnectionState(), ulxr::Protocol::setContentLength(), ulxr::Protocol::setPersistent(), ulxr::Protocol::setRemainingContentLength(), ULXR_PCHAR, and ULXR_TRACE.
HttpProtocol& ulxr::HttpProtocol::operator= | ( | const HttpProtocol & | ) | [private] |
PImpl* ulxr::HttpProtocol::pimpl [private] |
Reimplemented from ulxr::Protocol.
Definition at line 448 of file ulxr_http_protocol.h.
Referenced by detach(), getCookie(), hasCookie(), HttpProtocol(), machine_switchToBody(), setCookie(), and ~HttpProtocol().