pion::net::HTTPTypes Struct Reference

#include <HTTPTypes.hpp>

Inherited by pion::net::HTTPMessage.

List of all members.


Detailed Description

HTTPTypes: common data types used by HTTP

Definition at line 25 of file HTTPTypes.hpp.

Public Types

typedef PION_HASH_MULTIMAP<
std::string, std::string,
CaseInsensitiveHash, CaseInsensitiveEqual
Headers
 use case-insensitive comparisons for HTTP header names and cookie parameters
typedef PION_HASH_MULTIMAP<
std::string, std::string,
CaseInsensitiveHash, CaseInsensitiveEqual
CookieParams
typedef PION_HASH_MULTIMAP<
std::string, std::string,
PION_HASH_STRING > 
StringDictionary
 data type for a dictionary of strings (used for HTTP headers)
typedef StringDictionary QueryParams
 data type for HTTP query parameters

Public Member Functions

virtual ~HTTPTypes ()
 virtual destructor

Static Public Member Functions

static bool base64_decode (std::string const &input, std::string &output)
static bool base64_encode (std::string const &input, std::string &output)
static std::string url_decode (const std::string &str)
 escapes URL-encoded strings (a20value+with20spaces)
static std::string url_encode (const std::string &str)
 encodes strings so that they are safe for URLs (with20spaces)
static std::string get_date_string (const time_t t)
 converts time_t format into an HTTP-date string
static std::string make_query_string (const QueryParams &query_params)
 builds an HTTP query string from a collection of query parameters
static std::string make_set_cookie_header (const std::string &name, const std::string &value, const std::string &path, const bool has_max_age=false, const unsigned long max_age=0)

Static Public Attributes

static const std::string STRING_EMPTY
static const std::string STRING_CRLF
static const std::string STRING_HTTP_VERSION
static const std::string HEADER_NAME_VALUE_DELIMITER
static const std::string HEADER_HOST
static const std::string HEADER_COOKIE
static const std::string HEADER_SET_COOKIE
static const std::string HEADER_CONNECTION
static const std::string HEADER_CONTENT_TYPE
static const std::string HEADER_CONTENT_LENGTH
static const std::string HEADER_CONTENT_LOCATION
static const std::string HEADER_CONTENT_ENCODING
static const std::string HEADER_LAST_MODIFIED
static const std::string HEADER_IF_MODIFIED_SINCE
static const std::string HEADER_TRANSFER_ENCODING
static const std::string HEADER_LOCATION
static const std::string HEADER_AUTHORIZATION
static const std::string HEADER_REFERER
static const std::string HEADER_USER_AGENT
static const std::string HEADER_X_FORWARDED_FOR
static const std::string CONTENT_TYPE_HTML
static const std::string CONTENT_TYPE_TEXT
static const std::string CONTENT_TYPE_XML
static const std::string CONTENT_TYPE_URLENCODED
static const std::string REQUEST_METHOD_HEAD
static const std::string REQUEST_METHOD_GET
static const std::string REQUEST_METHOD_PUT
static const std::string REQUEST_METHOD_POST
static const std::string REQUEST_METHOD_DELETE
static const std::string RESPONSE_MESSAGE_OK
static const std::string RESPONSE_MESSAGE_CREATED
static const std::string RESPONSE_MESSAGE_NO_CONTENT
static const std::string RESPONSE_MESSAGE_FOUND
static const std::string RESPONSE_MESSAGE_UNAUTHORIZED
static const std::string RESPONSE_MESSAGE_FORBIDDEN
static const std::string RESPONSE_MESSAGE_NOT_FOUND
static const std::string RESPONSE_MESSAGE_METHOD_NOT_ALLOWED
static const std::string RESPONSE_MESSAGE_NOT_MODIFIED
static const std::string RESPONSE_MESSAGE_BAD_REQUEST
static const std::string RESPONSE_MESSAGE_SERVER_ERROR
static const std::string RESPONSE_MESSAGE_NOT_IMPLEMENTED
static const std::string RESPONSE_MESSAGE_CONTINUE
static const unsigned int RESPONSE_CODE_OK = 200
static const unsigned int RESPONSE_CODE_CREATED = 201
static const unsigned int RESPONSE_CODE_NO_CONTENT = 204
static const unsigned int RESPONSE_CODE_FOUND = 302
static const unsigned int RESPONSE_CODE_UNAUTHORIZED = 401
static const unsigned int RESPONSE_CODE_FORBIDDEN = 403
static const unsigned int RESPONSE_CODE_NOT_FOUND = 404
static const unsigned int RESPONSE_CODE_METHOD_NOT_ALLOWED = 405
static const unsigned int RESPONSE_CODE_NOT_MODIFIED = 304
static const unsigned int RESPONSE_CODE_BAD_REQUEST = 400
static const unsigned int RESPONSE_CODE_SERVER_ERROR = 500
static const unsigned int RESPONSE_CODE_NOT_IMPLEMENTED = 501
static const unsigned int RESPONSE_CODE_CONTINUE = 100

Classes

struct  CaseInsensitiveEqual
 returns true if two strings are equal (ignoring case) More...
struct  CaseInsensitiveHash
 case insensitive hash function for std::string More...
struct  CaseInsensitiveLess
 returns true if str1 < str2 (ignoring case) More...


Member Function Documentation

bool pion::net::HTTPTypes::base64_decode ( std::string const &  input,
std::string &  output 
) [static]

base64 decoding , used internally by HTTPBasicAuth

Parameters:
input - base64 encoded string
output - decoded string ( may include non-text chars)
Returns:
true if successful, false if input string contains non-base64 symbols

Definition at line 91 of file HTTPTypes.cpp.

Referenced by pion::net::HTTPBasicAuth::parseCredentials().

bool pion::net::HTTPTypes::base64_encode ( std::string const &  input,
std::string &  output 
) [static]

base64 encoding , used internally by HTTPBasicAuth

Parameters:
input - arbitrary string ( may include non-text chars)
output - base64 encoded string
Returns:
true if successful,

Definition at line 171 of file HTTPTypes.cpp.

Referenced by pion::net::HTTPCookieAuth::processLogin().

std::string pion::net::HTTPTypes::make_set_cookie_header ( const std::string &  name,
const std::string &  value,
const std::string &  path,
const bool  has_max_age = false,
const unsigned long  max_age = 0 
) [static]

creates a "Set-Cookie" header

Parameters:
name the name of the cookie
value the value of the cookie
path the path of the cookie
has_max_age true if the max_age value should be set
max_age the life of the cookie, in seconds (0 = discard)
Returns:
the new "Set-Cookie" header

Definition at line 316 of file HTTPTypes.cpp.

Referenced by pion::net::HTTPResponse::deleteCookie(), and pion::net::HTTPResponse::setCookie().


The documentation for this struct was generated from the following files:
Generated on Fri Dec 4 08:54:30 2009 for pion-net by  doxygen 1.4.7