ulxr::HttpProtocol Class Reference
[A transportation protocol for an XML-RPC call]

Runs http as protocol for rpc transmition. More...

#include <ulxr_http_protocol.h>

Inheritance diagram for ulxr::HttpProtocol:

Inheritance graph
[legend]
Collaboration diagram for ulxr::HttpProtocol:

Collaboration graph
[legend]
List of all members.

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 Protocoldetach ()
 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 &)
HttpProtocoloperator= (const HttpProtocol &)

Private Attributes

PImplpimpl

Classes

struct  PImpl

Detailed Description

Runs http as protocol for rpc transmition.

Definition at line 50 of file ulxr_http_protocol.h.


Member Typedef Documentation

typedef std::map<CppString, CppString> ulxr::HttpProtocol::header_property

Definition at line 54 of file ulxr_http_protocol.h.


Member Enumeration Documentation

enum ulxr::HttpProtocol::HttpState [protected]

Http connection states while reading input stream.

Enumerator:
ConnChunkHeader 
ConnChunkBody 
ConnChunkBodySkip 
ConnChunkTerminated 

Definition at line 369 of file ulxr_http_protocol.h.


Constructor & Destructor Documentation

ulxr::HttpProtocol::HttpProtocol ( Connection conn,
const CppString hostname,
unsigned  hostport 
)

Constructs a Protocol.

Parameters:
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.

Parameters:
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]

Definition at line 97 of file ulxr_http_protocol.cpp.

References pimpl.


Member Function Documentation

bool ulxr::HttpProtocol::responseStatus ( CppString phrase  )  const [virtual]

Tests if the response was successful regarding the transportation.

Parameters:
phrase return value describing the problem.
Returns:
true response is OK.

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.

Parameters:
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.

Parameters:
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.

See also:
Dispatcher.
Parameters:
buffer pointer to input data
len valid length of buffer
Returns:
current state of the processing. This return state may differ from the state returned by getConnectionState() due to internal processing. You should ignore everything except ConnBody and ConnError.

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.

Returns:
true: return value for request

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.

Returns:
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.

Returns:
true: there is at least one byte available

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.

Parameters:
http_ver numeral part of the version from the http header
Returns:
true: close connection afterwards

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".

Parameters:
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.

Parameters:
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.

Parameters:
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.

Returns:
the user agent.

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.

Parameters:
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.

Parameters:
realm Description for the caller which username and password to use
Returns:
true: access shall be granted.

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.

Parameters:
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.

Parameters:
user Username
pass Password

Definition at line 1171 of file ulxr_http_protocol.cpp.

References ULXR_PCHAR, and ULXR_TRACE.

CppString ulxr::HttpProtocol::getHttpProperty ( const CppString name  )  const

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.

Parameters:
name the name of the field
Returns:
the content 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.

Parameters:
name the name of the field
Returns:
true if the property field is available

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.

Returns:
date as string

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.

Returns:
date as string

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.

Returns:
the current protocol

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.

Returns:
true: 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:".

Parameters:
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.

Returns:
single cookie line suitable for a http header

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.

Parameters:
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.

Returns:
cookie line suitable for http header

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.

Returns:
cookie 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.

Parameters:
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.

Returns:
cookie line suitable for http header

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.

Returns:
cookie 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.

Parameters:
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.

Returns:
true: accept 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.

Parameters:
mode shutdown mode
  • Unix: SHUT_RD, SHUT_WR or SHUT_RDWR
  • Win32: SD_RECEIVE, SD_SEND or SD_BOTH

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.

Parameters:
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.

Returns:
true: use CONNECT via proxy

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.

Returns:
true: CONNECT has suceeded

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.

Referenced by detach(), and init().

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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Returns:
maximum false == no chunked transfer

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".

Returns:
true: Closing property is included

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.

Parameters:
user reference to return username
pass reference to return password
Returns:
true: username and password could be extracted

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.

Parameters:
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.

Parameters:
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]


Member Data Documentation

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().


The documentation for this class was generated from the following files:
Generated on Sun Aug 19 20:09:05 2007 for ulxmlrpcpp by  doxygen 1.5.1