fastcgi++
|
Defines classes and function relating to the http protocol. More...
Classes | |
struct | Post |
Holds a piece of HTTP post data. More... | |
class | Address |
Efficiently stores IPv6 addresses. More... | |
struct | Environment |
Data structure of HTTP environment data. More... | |
class | SessionId |
Defines ID values for HTTP sessions. More... | |
class | Sessions |
Container for HTTP sessions. More... |
Enumerations | |
enum | RequestMethod { HTTP_METHOD_ERROR, HTTP_METHOD_HEAD, HTTP_METHOD_GET, HTTP_METHOD_POST, HTTP_METHOD_PUT, HTTP_METHOD_DELETE, HTTP_METHOD_TRACE, HTTP_METHOD_OPTIONS, HTTP_METHOD_CONNECT } |
The HTTP request method as an enumeration. More... |
Functions | |
template<class charT , class Traits > | |
std::basic_ostream< charT, Traits > & | operator<< (std::basic_ostream< charT, Traits > &os, const RequestMethod requestMethod) |
template<class charT , class Traits > | |
std::basic_ostream< charT, Traits > & | operator<< (std::basic_ostream< charT, Traits > &os, const Address &address) |
Address stream insertion operation. | |
template<class charT , class Traits > | |
std::basic_istream< charT, Traits > & | operator>> (std::basic_istream< charT, Traits > &is, Address &address) |
Address stream extractor operation. | |
void | charToString (const char *data, size_t size, std::wstring &string) |
Convert a char string to a std::wstring. | |
void | charToString (const char *data, size_t size, std::string &string) |
Convert a char string to a std::string. | |
int | atoi (const char *start, const char *end) |
Convert a char string to an integer. | |
template<class charT > | |
void | decodeUrlEncoded (const char *data, size_t size, std::map< std::basic_string< charT >, std::basic_string< charT > > &output, const char fieldSeperator='&') |
Decodes a url-encoded string into a container. | |
size_t | percentEscapedToRealBytes (const char *source, char *destination, size_t size) |
Convert a string with percent escaped byte values to their actual values. | |
template<class In , class Out > | |
void | base64Encode (In start, In end, Out destination) |
Convert a binary container of data to a Base64 encoded container. | |
template<class In , class Out > | |
Out | base64Decode (In start, In end, Out destination) |
Convert a Base64 encoded container to a binary container. | |
template<class charT , class Traits > | |
std::basic_ostream< charT, Traits > & | operator<< (std::basic_ostream< charT, Traits > &os, const SessionId &x) |
Output the ID data in base64 encoding. |
Variables | |
const char * | requestMethodLabels [] |
const char | base64Characters [] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" |
List of characters in order for Base64 encoding. |
Defines classes and function relating to the http protocol.
int Fastcgipp::Http::atoi | ( | const char * | start, |
const char * | end | ||
) |
Convert a char string to an integer.
This function is very similar to std::atoi() except that it takes start/end values of a non null terminated char string instead of a null terminated string. The first character must be either a number or a minus sign (-). As soon as the end is reached or a non numerical character is reached, the result is tallied and returned.
[in] | start | Pointer to the first byte in the string |
[in] | end | Pointer to the last byte in the string + 1 |
Definition at line 52 of file http.cpp.
Referenced by Fastcgipp::Http::Address::assign(), Fastcgipp::Http::Environment< charT >::fill(), and ASql::MySQL::Statement::init().
Out Fastcgipp::Http::base64Decode | ( | In | start, |
In | end, | ||
Out | destination | ||
) |
Convert a Base64 encoded container to a binary container.
If destination is a fixed size container, it should have a size of at least (end-start)*3/4 not including null terminators if used.
[in] | start | Iterator to start of Base64 data. |
[in] | end | Iterator to end of Base64 data. |
[out] | destination | Iterator to start of binary destination. |
In | Input iterator type. Should be dereferenced to type char. |
Out | Output iterator type. Should be dereferenced to type char. |
Definition at line 574 of file http.hpp.
Referenced by Fastcgipp::Http::SessionId::operator=().
void Fastcgipp::Http::base64Encode | ( | In | start, |
In | end, | ||
Out | destination | ||
) |
Convert a binary container of data to a Base64 encoded container.
If destination is a fixed size container, it should have a size of at least ((end-start-1)/3 + 1)*4 not including null terminators if used and assuming integer arithmetic.
[in] | start | Iterator to start of binary data. |
[in] | end | Iterator to end of binary data. |
[out] | destination | Iterator to start of Base64 destination. |
In | Input iterator type. Should be dereferenced to type char. |
Out | Output iterator type. Should be dereferenced to type char. |
Definition at line 617 of file http.hpp.
References base64Characters.
Referenced by operator<<().
void Fastcgipp::Http::charToString | ( | const char * | data, |
size_t | size, | ||
std::wstring & | string | ||
) |
Convert a char string to a std::wstring.
[in] | data | First byte in char string |
[in] | size | Size in bytes of the string (no null terminator) |
[out] | string | Reference to the wstring that should be modified |
Definition at line 29 of file http.cpp.
Referenced by decodeUrlEncoded(), Fastcgipp::Http::Environment< charT >::fill(), Fastcgipp::Http::Environment< charT >::parsePostsMultipart(), and Fastcgipp::Http::Environment< charT >::parsePostsUrlEncoded().
|
inline |
void Fastcgipp::Http::decodeUrlEncoded | ( | const char * | data, |
size_t | size, | ||
std::map< std::basic_string< charT >, std::basic_string< charT > > & | output, | ||
const char | fieldSeperator = '&' |
||
) |
Decodes a url-encoded string into a container.
[in] | data | Data to decode |
[in] | size | Size of data to decode |
[out] | output | Container to output data into |
Definition at line 484 of file http.cpp.
References charToString(), and percentEscapedToRealBytes().
Referenced by Fastcgipp::Http::Environment< charT >::fill().
|
inline |
Definition at line 108 of file http.hpp.
References requestMethodLabels.
std::basic_ostream< charT, Traits > & Fastcgipp::Http::operator<< | ( | std::basic_ostream< charT, Traits > & | os, |
const Address & | address | ||
) |
Address stream insertion operation.
This stream inserter obeys all stream manipulators regarding alignment, field width and numerical base.
Definition at line 717 of file http.cpp.
References Fastcgipp::Protocol::readBigEndian().
std::basic_ostream<charT, Traits>& Fastcgipp::Http::operator<< | ( | std::basic_ostream< charT, Traits > & | os, |
const SessionId & | x | ||
) |
Output the ID data in base64 encoding.
Definition at line 497 of file http.hpp.
References base64Encode(), and Fastcgipp::Http::SessionId::size.
std::basic_istream< charT, Traits > & Fastcgipp::Http::operator>> | ( | std::basic_istream< charT, Traits > & | is, |
Address & | address | ||
) |
size_t Fastcgipp::Http::percentEscapedToRealBytes | ( | const char * | source, |
char * | destination, | ||
size_t | size | ||
) |
Convert a string with percent escaped byte values to their actual values.
Since converting a percent escaped string to actual values can only make it shorter, it is safe to assume that the return value will always be smaller than size. It is thereby a safe move to make the destination block of memory the same size as the source.
[in] | source | Pointer to the first character in the percent escaped string |
[in] | size | Size in bytes of the data pointed to by source (no null termination) |
[out] | destination | Pointer to the section of memory to write the converted string to |
Definition at line 67 of file http.cpp.
Referenced by decodeUrlEncoded(), Fastcgipp::Http::Environment< charT >::fill(), and Fastcgipp::Http::Environment< charT >::parsePostsUrlEncoded().
const char Fastcgipp::Http::base64Characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" |
List of characters in order for Base64 encoding.
Definition at line 523 of file http.cpp.
Referenced by base64Encode().
const char * Fastcgipp::Http::requestMethodLabels |
Definition at line 524 of file http.cpp.
Referenced by Fastcgipp::Http::Environment< charT >::fill(), and operator<<().