fastcgi++
|
Data structure of HTTP environment data. More...
#include <http.hpp>
Public Types | |
typedef std::vector < std::basic_string< charT > > | PathInfo |
Path Information. | |
typedef std::map < std::basic_string< charT > , std::basic_string< charT > > | Cookies |
typedef std::map < std::basic_string< charT > , std::basic_string< charT > > | Gets |
typedef std::map < std::basic_string< charT > , Post< charT > > | Posts |
Public Member Functions | |
const std::basic_string< charT > & | findCookie (const charT *key) const |
Quick and easy way to find a cookie value. | |
const std::basic_string< charT > & | findGet (const charT *key) const |
Quick and easy way to find a GET value. | |
bool | checkForGet (const charT *key) const |
Quick and easy way to check if a GET value exists. | |
const Post< charT > & | findPost (const charT *key) const |
Quick and easy way to find a POST value. | |
bool | checkForPost (const charT *key) const |
Quick and easy way to check if a POST value exists. | |
void | fill (const char *data, size_t size) |
Parses FastCGI parameter data into the data structure. | |
void | fillPostsMultipart (const char *data, size_t size) |
Parses "multipart/form-data" http post data into the posts object. | |
void | fillPostsUrlEncoded (const char *data, size_t size) |
Parses "application/x-www-form-urlencoded" post data into the posts object. | |
void | clearPostBuffer () |
Clear the post buffer. | |
Environment () | |
Public Attributes | |
std::basic_string< charT > | host |
Hostname of the server. | |
std::basic_string< charT > | userAgent |
User agent string. | |
std::basic_string< charT > | acceptContentTypes |
Content types the client accepts. | |
std::basic_string< charT > | acceptLanguages |
Languages the client accepts. | |
std::basic_string< charT > | acceptCharsets |
Character sets the clients accepts. | |
std::basic_string< charT > | referer |
Referral URL. | |
std::basic_string< charT > | contentType |
Content type of data sent from client. | |
std::basic_string< charT > | root |
HTTP root directory. | |
std::basic_string< charT > | scriptName |
Filename of script relative to the HTTP root directory. | |
RequestMethod | requestMethod |
REQUEST_METHOD. | |
std::basic_string< charT > | requestUri |
REQUEST_URI. | |
PathInfo | pathInfo |
int | etag |
The etag the client assumes this document should have. | |
int | keepAlive |
How many seconds the connection should be kept alive. | |
unsigned int | contentLength |
Length of content to be received from the client (post data) | |
Address | serverAddress |
IP address of the server. | |
Address | remoteAddress |
IP address of the client. | |
uint16_t | serverPort |
TCP port used by the server. | |
uint16_t | remotePort |
TCP port used by the client. | |
boost::posix_time::ptime | ifModifiedSince |
Timestamp the client has for this document. | |
Cookies | cookies |
Container with all url-encoded cookie data. | |
Gets | gets |
Container with all url-encoded GET data. | |
Posts | posts |
STL container associating Post objects with their name. | |
Private Attributes | |
boost::scoped_array< char > | boundary |
Raw string of characters representing the post boundary. | |
size_t | boundarySize |
Size of boundary. | |
boost::scoped_array< char > | postBuffer |
Buffer for processing post data. | |
size_t | postBufferSize |
Size of data in postBuffer. |
Data structure of HTTP environment data.
This structure contains all HTTP environment data for each individual request. The data is processed from FastCGI parameter records.
charT | Character type to use for strings |
typedef std::map<std::basic_string<charT>, std::basic_string<charT> > Fastcgipp::Http::Environment< charT >::Cookies |
typedef std::map<std::basic_string<charT>, std::basic_string<charT> > Fastcgipp::Http::Environment< charT >::Gets |
typedef std::vector<std::basic_string<charT> > Fastcgipp::Http::Environment< charT >::PathInfo |
typedef std::map<std::basic_string<charT>, Post<charT> > Fastcgipp::Http::Environment< charT >::Posts |
Fastcgipp::Http::Environment< charT >::Environment | ( | ) | [inline] |
bool Fastcgipp::Http::Environment< charT >::checkForGet | ( | const charT * | key | ) | const |
bool Fastcgipp::Http::Environment< charT >::checkForPost | ( | const charT * | key | ) | const |
void Fastcgipp::Http::Environment< charT >::clearPostBuffer | ( | ) | [inline] |
Clear the post buffer.
Definition at line 304 of file http.hpp.
References Fastcgipp::Http::Environment< charT >::postBuffer, and Fastcgipp::Http::Environment< charT >::postBufferSize.
void Fastcgipp::Http::Environment< charT >::fill | ( | const char * | data, |
size_t | size | ||
) |
Parses FastCGI parameter data into the data structure.
This function will take the body of a FastCGI parameter record and parse the data into the data structure. data should equal the first character of the records body with size being it's content length.
[in] | data | Pointer to the first byte of parameter data |
[in] | size | Size of data in bytes |
Definition at line 224 of file http.cpp.
References Fastcgipp::Http::atoi(), Fastcgipp::Http::charToString(), Fastcgipp::Http::decodeUrlEncoded(), Fastcgipp::Http::HTTP_METHOD_CONNECT, Fastcgipp::Http::HTTP_METHOD_DELETE, Fastcgipp::Http::HTTP_METHOD_ERROR, Fastcgipp::Http::HTTP_METHOD_GET, Fastcgipp::Http::HTTP_METHOD_HEAD, Fastcgipp::Http::HTTP_METHOD_OPTIONS, Fastcgipp::Http::HTTP_METHOD_POST, Fastcgipp::Http::HTTP_METHOD_PUT, Fastcgipp::Http::HTTP_METHOD_TRACE, Fastcgipp::Http::percentEscapedToRealBytes(), Fastcgipp::Protocol::processParamHeader(), and Fastcgipp::Http::requestMethodLabels.
void Fastcgipp::Http::Environment< charT >::fillPostsMultipart | ( | const char * | data, |
size_t | size | ||
) |
Parses "multipart/form-data" http post data into the posts object.
This function will take arbitrarily divided chunks of raw http post data and parse them into the posts container of Post objects. data should equal the first bytes of the FastCGI IN records body with size being it's content length.
[in] | data | Pointer to the first byte of post data |
[in] | size | Size of data in bytes |
Definition at line 369 of file http.cpp.
References Fastcgipp::Http::charToString(), Fastcgipp::Http::Post< charT >::contentType, Fastcgipp::Http::Post< charT >::filename, Fastcgipp::Http::Post< charT >::m_data, Fastcgipp::Http::Post< charT >::m_size, Fastcgipp::Http::Post< charT >::size(), Fastcgipp::Http::Post< charT >::type, and Fastcgipp::Http::Post< charT >::value.
void Fastcgipp::Http::Environment< charT >::fillPostsUrlEncoded | ( | const char * | data, |
size_t | size | ||
) |
Parses "application/x-www-form-urlencoded" post data into the posts object.
This function parses x-www-form-urlencoded post data into the Environment::posts member. This function will take arbitrarily divided chunks of raw http post data and parse them into the posts container of Post objects. data should equal the first bytes of the FastCGI IN records body with size being it's content length.
[in] | data | Pointer to the first byte of post data |
[in] | size | Size of data in bytes |
Definition at line 523 of file http.cpp.
References Fastcgipp::Http::charToString(), Fastcgipp::Http::percentEscapedToRealBytes(), Fastcgipp::Http::Post< charT >::type, and Fastcgipp::Http::Post< charT >::value.
const std::basic_string< charT > & Fastcgipp::Http::Environment< charT >::findCookie | ( | const charT * | key | ) | const |
const std::basic_string< charT > & Fastcgipp::Http::Environment< charT >::findGet | ( | const charT * | key | ) | const |
Quick and easy way to find a GET value.
[in] | key | C-string representation of the name of the GET value you want |
const Fastcgipp::Http::Post< charT > & Fastcgipp::Http::Environment< charT >::findPost | ( | const charT * | key | ) | const |
std::basic_string<charT> Fastcgipp::Http::Environment< charT >::acceptCharsets |
std::basic_string<charT> Fastcgipp::Http::Environment< charT >::acceptContentTypes |
std::basic_string<charT> Fastcgipp::Http::Environment< charT >::acceptLanguages |
boost::scoped_array<char> Fastcgipp::Http::Environment< charT >::boundary [private] |
size_t Fastcgipp::Http::Environment< charT >::boundarySize [private] |
unsigned int Fastcgipp::Http::Environment< charT >::contentLength |
std::basic_string<charT> Fastcgipp::Http::Environment< charT >::contentType |
Cookies Fastcgipp::Http::Environment< charT >::cookies |
int Fastcgipp::Http::Environment< charT >::etag |
Gets Fastcgipp::Http::Environment< charT >::gets |
std::basic_string<charT> Fastcgipp::Http::Environment< charT >::host |
boost::posix_time::ptime Fastcgipp::Http::Environment< charT >::ifModifiedSince |
int Fastcgipp::Http::Environment< charT >::keepAlive |
PathInfo Fastcgipp::Http::Environment< charT >::pathInfo |
boost::scoped_array<char> Fastcgipp::Http::Environment< charT >::postBuffer [private] |
Buffer for processing post data.
Definition at line 314 of file http.hpp.
Referenced by Fastcgipp::Http::Environment< charT >::clearPostBuffer().
size_t Fastcgipp::Http::Environment< charT >::postBufferSize [private] |
Size of data in postBuffer.
Definition at line 316 of file http.hpp.
Referenced by Fastcgipp::Http::Environment< charT >::clearPostBuffer().
Posts Fastcgipp::Http::Environment< charT >::posts |
std::basic_string<charT> Fastcgipp::Http::Environment< charT >::referer |
Address Fastcgipp::Http::Environment< charT >::remoteAddress |
uint16_t Fastcgipp::Http::Environment< charT >::remotePort |
RequestMethod Fastcgipp::Http::Environment< charT >::requestMethod |
std::basic_string<charT> Fastcgipp::Http::Environment< charT >::requestUri |
std::basic_string<charT> Fastcgipp::Http::Environment< charT >::root |
std::basic_string<charT> Fastcgipp::Http::Environment< charT >::scriptName |
Address Fastcgipp::Http::Environment< charT >::serverAddress |
uint16_t Fastcgipp::Http::Environment< charT >::serverPort |
std::basic_string<charT> Fastcgipp::Http::Environment< charT >::userAgent |