|
fastcgi++
A C++ FastCGI/Web API
|
Defines classes and functions relating to the HTTP protocol. More...
Classes | |
| class | Address |
| Efficiently stores IPv6 addresses. More... | |
| struct | Environment |
| Data structure of HTTP environment data. More... | |
| struct | File |
| Holds a file uploaded from the client. More... | |
| class | SessionId |
| Defines ID values for HTTP sessions. More... | |
| class | Sessions |
| Container for HTTP sessions. More... | |
Enumerations | |
| enum | RequestMethod { RequestMethod::ERROR =0, RequestMethod::HEAD =1, RequestMethod::GET =2, RequestMethod::POST =3, RequestMethod::PUT =4, RequestMethod::DELETE =5, RequestMethod::TRACE =6, RequestMethod::OPTIONS =7, RequestMethod::CONNECT =8 } |
| 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. More... | |
| template<class charT , class Traits > | |
| std::basic_istream< charT, Traits > & | operator>> (std::basic_istream< charT, Traits > &is, Address &address) |
| Address stream extractor operation. More... | |
| void | vecToString (const char *start, const char *end, std::wstring &string) |
| Convert a char array to a std::wstring. More... | |
| void | vecToString (const char *start, const char *end, std::string &string) |
| Convert a char string to a std::string. More... | |
| template<class charT > | |
| int | atoi (const charT *start, const charT *end) |
| Convert a char string to an integer. More... | |
| template<class charT > | |
| float | atof (const charT *start, const charT *end) |
| Convert a char string to a float. More... | |
| template<class charT > | |
| void | decodeUrlEncoded (const char *data, const char *dataEnd, std::multimap< std::basic_string< charT >, std::basic_string< charT >> &output, const char *const fieldSeparator="&") |
| Decodes a url-encoded string into a multimap container. More... | |
| char * | percentEscapedToRealBytes (const char *start, const char *end, char *destination) |
| Convert a string with percent escaped byte values to their values. More... | |
| template<class In , class Out > | |
| Out | base64Encode (In start, In end, Out destination) |
| Convert a binary container of data to a Base64 encoded container. More... | |
| template<class In , class Out > | |
| Out | base64Decode (In start, In end, Out destination) |
| Convert a Base64 encoded container to a binary container. More... | |
| 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. More... | |
Variables | |
| const std::array< const char *const, 9 > | requestMethodLabels |
| Some textual labels for RequestMethod. More... | |
| const std::array< const char, 64 > | base64Characters |
| List of characters in order for Base64 encoding. More... | |
Defines classes and functions relating to the HTTP protocol.
|
strong |
| float Fastcgipp::Http::atof | ( | const charT * | start, |
| const charT * | end | ||
| ) |
Convert a char string to a float.
This function is very similar to std::atof() 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 |
| charT | Character type |
Definition at line 81 of file http.cpp.
Referenced by vecToString().
| int Fastcgipp::Http::atoi | ( | const charT * | start, |
| const charT * | 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 |
| charT | Character type |
Definition at line 61 of file http.cpp.
Referenced by Fastcgipp::Http::Address::assign(), Fastcgipp::Http::Environment< charT >::fill(), and vecToString().
| 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 725 of file http.hpp.
Referenced by Fastcgipp::Http::SessionId::SessionId(), and vecToString().
| Out 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 769 of file http.hpp.
References base64Characters.
Referenced by operator<<(), and vecToString().
| void Fastcgipp::Http::decodeUrlEncoded | ( | const char * | data, |
| const char * | dataEnd, | ||
| std::multimap< std::basic_string< charT >, std::basic_string< charT >> & | output, | ||
| const char *const | fieldSeparator = "&" |
||
| ) |
Decodes a url-encoded string into a multimap container.
| [in] | data | Data to decode |
| [in] | dataEnd | +1 last byte to decode |
| [out] | output | Container to output data into |
| [in] | fieldSeparator | String that signifies field separation |
Definition at line 670 of file http.cpp.
References Fastcgipp::NONE, percentEscapedToRealBytes(), and vecToString().
Referenced by Fastcgipp::Http::Environment< charT >::fill(), Fastcgipp::Http::Environment< charT >::parsePostsUrlEncoded(), and vecToString().
| 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 924 of file http.cpp.
References Fastcgipp::Http::Address::m_data, and Fastcgipp::Http::Address::size.
|
inline |
Definition at line 108 of file http.hpp.
Referenced by Fastcgipp::Http::SessionId::SessionId(), and Fastcgipp::Http::Address::zero().
| 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 613 of file http.hpp.
References base64Encode(), and Fastcgipp::Http::SessionId::m_data.
| std::basic_istream< charT, Traits > & Fastcgipp::Http::operator>> | ( | std::basic_istream< charT, Traits > & | is, |
| Address & | address | ||
| ) |
Address stream extractor operation.
In order for this to work the string must represent either an IPv4 address in standard textual decimal form (127.0.0.1) or an IPv6 in standard form.
Definition at line 1106 of file http.cpp.
References Fastcgipp::Http::Address::size.
Referenced by Fastcgipp::Http::Address::zero().
| char * Fastcgipp::Http::percentEscapedToRealBytes | ( | const char * | start, |
| const char * | end, | ||
| char * | destination | ||
| ) |
Convert a string with percent escaped byte values to their 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] | start | Iterator to the first character in the percent escaped string |
| [in] | end | Iterator to +1 the last character in the percent escaped string |
| [out] | destination | Pointer to the section of memory to write the converted string to |
Definition at line 116 of file http.cpp.
Referenced by decodeUrlEncoded(), Fastcgipp::Http::Environment< charT >::fill(), and vecToString().
| void Fastcgipp::Http::vecToString | ( | const char * | start, |
| const char * | end, | ||
| std::wstring & | string | ||
| ) |
Convert a char array to a std::wstring.
| [in] | start | First byte in char array |
| [in] | end | 1+ last byte of the array (no null terminator) |
| [out] | string | Reference to the wstring that should be modified |
Definition at line 40 of file http.cpp.
References WARNING_LOG.
Referenced by decodeUrlEncoded(), Fastcgipp::Http::Environment< charT >::fill(), and Fastcgipp::Http::Environment< charT >::parsePostsMultipart().
|
inline |
Convert a char string to a std::string.
| [in] | start | First byte in char string |
| [in] | end | 1+ last byte of the string (no null terminator) |
| [out] | string | Reference to the string that should be modified |
Definition at line 425 of file http.hpp.
References atof(), atoi(), base64Characters, base64Decode(), base64Encode(), Fastcgipp::Http::File< charT >::data, decodeUrlEncoded(), and percentEscapedToRealBytes().
| const std::array< const char, 64 > Fastcgipp::Http::base64Characters |
List of characters in order for Base64 encoding.
Definition at line 751 of file http.cpp.
Referenced by base64Encode(), and vecToString().
| const std::array< const char *const, 9 > Fastcgipp::Http::requestMethodLabels |
Some textual labels for RequestMethod.
Definition at line 759 of file http.cpp.
Referenced by Fastcgipp::Http::Environment< charT >::fill().
1.8.11