fastcgi++
Public Types | Public Member Functions | Public Attributes | Private Member Functions | 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.
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.

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 202 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 246 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 252 of file http.hpp.

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

Path Information.

Definition at line 227 of file http.hpp.

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

Definition at line 271 of file http.hpp.


Constructor & Destructor Documentation

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

Definition at line 321 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 574 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 585 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 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.

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

Parameters:
[in]dataPointer to the first byte of post data
[in]sizeSize of data in bytes
Returns:
Returns true unless the buffer overflowed

Definition at line 250 of file http.cpp.

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 538 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 550 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 562 of file http.cpp.

template<class charT >
size_t Fastcgipp::Http::Environment< charT >::minPostBufferSize ( const size_t  size)
inlineprivate
template<class charT >
void Fastcgipp::Http::Environment< charT >::parsePostsMultipart ( )
template<class charT >
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.


Member Data Documentation

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

Character sets the clients accepts.

Definition at line 213 of file http.hpp.

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

Content types the client accepts.

Definition at line 209 of file http.hpp.

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

Languages the client accepts.

Definition at line 211 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 324 of file http.hpp.

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

Size of boundary.

Definition at line 326 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 234 of file http.hpp.

Referenced by Fastcgipp::Http::Environment< charT >::minPostBufferSize().

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

Content type of data sent from client.

Definition at line 217 of file http.hpp.

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

Container with all url-encoded cookie data.

Definition at line 248 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 230 of file http.hpp.

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

Container with all url-encoded GET data.

Definition at line 254 of file http.hpp.

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

Hostname of the server.

Definition at line 205 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 244 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 232 of file http.hpp.

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

Definition at line 228 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 329 of file http.hpp.

Referenced by Fastcgipp::Http::Environment< charT >::clearPostBuffer(), and Fastcgipp::Http::Environment< charT >::minPostBufferSize().

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

STL container associating Post objects with their name.

Definition at line 273 of file http.hpp.

template<class charT >
char* Fastcgipp::Http::Environment< charT >::pPostBuffer
private
template<class charT >
std::basic_string<charT> Fastcgipp::Http::Environment< charT >::referer

Referral URL.

Definition at line 215 of file http.hpp.

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

IP address of the client.

Definition at line 238 of file http.hpp.

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

TCP port used by the client.

Definition at line 242 of file http.hpp.

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

REQUEST_METHOD.

Definition at line 223 of file http.hpp.

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

REQUEST_URI.

Definition at line 225 of file http.hpp.

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

HTTP root directory.

Definition at line 219 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 221 of file http.hpp.

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

IP address of the server.

Definition at line 236 of file http.hpp.

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

TCP port used by the server.

Definition at line 240 of file http.hpp.

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

User agent string.

Definition at line 207 of file http.hpp.


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