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. | |
bool | fillPostBuffer (const char *data, size_t size) |
Consolidates POST data into a single buffer. | |
void | parsePostsMultipart () |
Parses "multipart/form-data" http post data into the posts object. | |
void | parsePostsUrlEncoded () |
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 Member Functions | |
size_t | minPostBufferSize (const size_t size) |
Returns minimum buffer size remaining. |
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. | |
char * | pPostBuffer |
Pointer in buffer. |
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 |
|
inline |
bool Fastcgipp::Http::Environment< charT >::checkForGet | ( | const charT * | key | ) | const |
bool Fastcgipp::Http::Environment< charT >::checkForPost | ( | const charT * | key | ) | const |
|
inline |
Clear the post buffer.
Definition at line 319 of file http.hpp.
References Fastcgipp::Http::Environment< charT >::postBuffer, and Fastcgipp::Http::Environment< charT >::pPostBuffer.
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 105 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.
bool Fastcgipp::Http::Environment< charT >::fillPostBuffer | ( | const char * | data, |
size_t | size | ||
) |
Consolidates POST data into a single buffer.
This function will take arbitrarily divided chunks of raw http post data and consolidate them into postBuffer.
[in] | data | Pointer to the first byte of post data |
[in] | size | Size of data in bytes |
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 |
|
inlineprivate |
Returns minimum buffer size remaining.
Definition at line 333 of file http.hpp.
References Fastcgipp::Http::Environment< charT >::contentLength, Fastcgipp::Http::Environment< charT >::postBuffer, and Fastcgipp::Http::Environment< charT >::pPostBuffer.
void Fastcgipp::Http::Environment< charT >::parsePostsMultipart | ( | ) |
Parses "multipart/form-data" http post data into the posts object.
Definition at line 271 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 >::type, and Fastcgipp::Http::Post< charT >::value.
void Fastcgipp::Http::Environment< charT >::parsePostsUrlEncoded | ( | ) |
Parses "application/x-www-form-urlencoded" post data into the posts object.
Definition at line 428 of file http.cpp.
References Fastcgipp::Http::charToString(), Fastcgipp::Http::percentEscapedToRealBytes(), Fastcgipp::Http::Post< charT >::type, and Fastcgipp::Http::Post< charT >::value.
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 |
|
private |
|
private |
unsigned int Fastcgipp::Http::Environment< charT >::contentLength |
Length of content to be received from the client (post data)
Definition at line 234 of file http.hpp.
Referenced by Fastcgipp::Http::Environment< charT >::minPostBufferSize().
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 |
|
private |
Buffer for processing post data.
Definition at line 329 of file http.hpp.
Referenced by Fastcgipp::Http::Environment< charT >::clearPostBuffer(), and Fastcgipp::Http::Environment< charT >::minPostBufferSize().
Posts Fastcgipp::Http::Environment< charT >::posts |
|
private |
Pointer in buffer.
Definition at line 331 of file http.hpp.
Referenced by Fastcgipp::Http::Environment< charT >::clearPostBuffer(), and Fastcgipp::Http::Environment< charT >::minPostBufferSize().
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 |