fastcgi++
Public Types | Public Member Functions | Public Attributes | Private Attributes
Fastcgipp::Http::Environment< charT > Struct Template Reference

Data structure of HTTP environment data. More...

#include <http.hpp>

List of all members.

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.

Detailed Description

template<class charT>
struct Fastcgipp::Http::Environment< charT >

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.

Template Parameters:
charTCharacter type to use for strings

Definition at line 180 of file http.hpp.


Member Typedef Documentation

template<class charT >
typedef std::map<std::basic_string<charT>, std::basic_string<charT> > Fastcgipp::Http::Environment< charT >::Cookies

Definition at line 224 of file http.hpp.

template<class charT >
typedef std::map<std::basic_string<charT>, std::basic_string<charT> > Fastcgipp::Http::Environment< charT >::Gets

Definition at line 230 of file http.hpp.

template<class charT >
typedef std::vector<std::basic_string<charT> > Fastcgipp::Http::Environment< charT >::PathInfo

Path Information.

Definition at line 205 of file http.hpp.

template<class charT >
typedef std::map<std::basic_string<charT>, Post<charT> > Fastcgipp::Http::Environment< charT >::Posts

Definition at line 249 of file http.hpp.


Constructor & Destructor Documentation

template<class charT >
Fastcgipp::Http::Environment< charT >::Environment ( ) [inline]

Definition at line 306 of file http.hpp.


Member Function Documentation

template<class charT >
bool Fastcgipp::Http::Environment< charT >::checkForGet ( const charT *  key) const

Quick and easy way to check if a GET value exists.

Parameters:
[in]keyC-string representation of the name of the GET value you want
Returns:
True if the value was passed from the client, false otherwise.

Definition at line 681 of file http.cpp.

template<class charT >
bool Fastcgipp::Http::Environment< charT >::checkForPost ( const charT *  key) const

Quick and easy way to check if a POST value exists.

Parameters:
[in]keyC-string representation of the name of the POST value you want
Returns:
True if the value was passed from the client, false otherwise.

Definition at line 692 of file http.cpp.

template<class charT >
void Fastcgipp::Http::Environment< charT >::clearPostBuffer ( ) [inline]
template<class charT >
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.

Parameters:
[in]dataPointer to the first byte of parameter data
[in]sizeSize 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.

template<class charT >
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.

Parameters:
[in]dataPointer to the first byte of post data
[in]sizeSize 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.

template<class charT >
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.

Parameters:
[in]dataPointer to the first byte of post data
[in]sizeSize 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.

template<class charT >
const std::basic_string< charT > & Fastcgipp::Http::Environment< charT >::findCookie ( const charT *  key) const

Quick and easy way to find a cookie value.

Definition at line 645 of file http.cpp.

template<class charT >
const std::basic_string< charT > & Fastcgipp::Http::Environment< charT >::findGet ( const charT *  key) const

Quick and easy way to find a GET value.

Parameters:
[in]keyC-string representation of the name of the GET value you want
Returns:
Constant reference to the string representation of the GET value. If the GET value does not exist this will return an empty string;

Definition at line 657 of file http.cpp.

template<class charT >
const Fastcgipp::Http::Post< charT > & Fastcgipp::Http::Environment< charT >::findPost ( const charT *  key) const

Quick and easy way to find a POST value.

Parameters:
[in]keyC-string representation of the name of the POST value you want
Returns:
Constant reference to the Post object created for the POST value. If the POST value does not exist this will return a default constructed Post object.

Definition at line 669 of file http.cpp.


Member Data Documentation

template<class charT >
std::basic_string<charT> Fastcgipp::Http::Environment< charT >::acceptCharsets

Character sets the clients accepts.

Definition at line 191 of file http.hpp.

template<class charT >
std::basic_string<charT> Fastcgipp::Http::Environment< charT >::acceptContentTypes

Content types the client accepts.

Definition at line 187 of file http.hpp.

template<class charT >
std::basic_string<charT> Fastcgipp::Http::Environment< charT >::acceptLanguages

Languages the client accepts.

Definition at line 189 of file http.hpp.

template<class charT >
boost::scoped_array<char> Fastcgipp::Http::Environment< charT >::boundary [private]

Raw string of characters representing the post boundary.

Definition at line 309 of file http.hpp.

template<class charT >
size_t Fastcgipp::Http::Environment< charT >::boundarySize [private]

Size of boundary.

Definition at line 311 of file http.hpp.

template<class charT >
unsigned int Fastcgipp::Http::Environment< charT >::contentLength

Length of content to be received from the client (post data)

Definition at line 212 of file http.hpp.

template<class charT >
std::basic_string<charT> Fastcgipp::Http::Environment< charT >::contentType

Content type of data sent from client.

Definition at line 195 of file http.hpp.

template<class charT >
Cookies Fastcgipp::Http::Environment< charT >::cookies

Container with all url-encoded cookie data.

Definition at line 226 of file http.hpp.

template<class charT >
int Fastcgipp::Http::Environment< charT >::etag

The etag the client assumes this document should have.

Definition at line 208 of file http.hpp.

template<class charT >
Gets Fastcgipp::Http::Environment< charT >::gets

Container with all url-encoded GET data.

Definition at line 232 of file http.hpp.

template<class charT >
std::basic_string<charT> Fastcgipp::Http::Environment< charT >::host

Hostname of the server.

Definition at line 183 of file http.hpp.

template<class charT >
boost::posix_time::ptime Fastcgipp::Http::Environment< charT >::ifModifiedSince

Timestamp the client has for this document.

Definition at line 222 of file http.hpp.

template<class charT >
int Fastcgipp::Http::Environment< charT >::keepAlive

How many seconds the connection should be kept alive.

Definition at line 210 of file http.hpp.

template<class charT >
PathInfo Fastcgipp::Http::Environment< charT >::pathInfo

Definition at line 206 of file http.hpp.

template<class charT >
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().

template<class charT >
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().

template<class charT >
Posts Fastcgipp::Http::Environment< charT >::posts

STL container associating Post objects with their name.

Definition at line 251 of file http.hpp.

template<class charT >
std::basic_string<charT> Fastcgipp::Http::Environment< charT >::referer

Referral URL.

Definition at line 193 of file http.hpp.

template<class charT >
Address Fastcgipp::Http::Environment< charT >::remoteAddress

IP address of the client.

Definition at line 216 of file http.hpp.

template<class charT >
uint16_t Fastcgipp::Http::Environment< charT >::remotePort

TCP port used by the client.

Definition at line 220 of file http.hpp.

template<class charT >
RequestMethod Fastcgipp::Http::Environment< charT >::requestMethod

REQUEST_METHOD.

Definition at line 201 of file http.hpp.

template<class charT >
std::basic_string<charT> Fastcgipp::Http::Environment< charT >::requestUri

REQUEST_URI.

Definition at line 203 of file http.hpp.

template<class charT >
std::basic_string<charT> Fastcgipp::Http::Environment< charT >::root

HTTP root directory.

Definition at line 197 of file http.hpp.

template<class charT >
std::basic_string<charT> Fastcgipp::Http::Environment< charT >::scriptName

Filename of script relative to the HTTP root directory.

Definition at line 199 of file http.hpp.

template<class charT >
Address Fastcgipp::Http::Environment< charT >::serverAddress

IP address of the server.

Definition at line 214 of file http.hpp.

template<class charT >
uint16_t Fastcgipp::Http::Environment< charT >::serverPort

TCP port used by the server.

Definition at line 218 of file http.hpp.

template<class charT >
std::basic_string<charT> Fastcgipp::Http::Environment< charT >::userAgent

User agent string.

Definition at line 185 of file http.hpp.


The documentation for this struct was generated from the following files: