Webmaster  |  Imprint 
C++ Server Pages
Main  |  License  |  Documentation  |  Download 

HttpMessage Class Reference

Baseclass for HTTP-messages.

#include <tnt/httpmessage.h>

Inheritance diagram for HttpMessage:

HttpError HttpReply HttpRequest NotFoundException List of all members.

Public Types

typedef Messageheader header_type

Public Member Functions

virtual void clear ()
 Removes all request-specific content.
bool hasHeader (const char *key) const
 returns true, if the message has the specified header.
bool hasHeader (const std::string &key) const
const char * getHeader (const char *key, const char *def="") const
unsigned short getMajorVersion () const
 returns the http-major-version-number.
unsigned short getMinorVersion () const
 returns the http-minor-version-number.
void setVersion (unsigned short major, unsigned short minor)
 sets the http-version-number
header_type::const_iterator header_begin () const
header_type::const_iterator header_end () const
 Returns a constant Iterator, which points past the last header.
void setHeader (const std::string &key, const std::string &value, bool replace=true)
 Adds the specified header to the message.
void removeHeader (const std::string &key)
 Removes the header with the specified name from the message.
std::string dumpHeader () const
 Returns all headers as a string.
void dumpHeader (std::ostream &out) const
 Prints all headers to the specified output-stream.

Static Public Member Functions

static std::string htdate (time_t t)
 Returns a properly formatted date-string, as needed in http.
static std::string htdate (struct::tm *tm)
 Returns a properly formatted date-string, as needed in http.
static std::string htdateCurrent ()
 Returns a properly formatted current time-string, as needed in http.
static bool checkUrl (const std::string &url)

Protected Attributes

header_type header
Cookies httpcookies

Member Function Documentation

const char* getHeader ( const char *  key,
const char *  def = "" 
) const

returns the content of the specified header or the passed default when not set.

header_type::const_iterator header_begin (  )  const

Returns a constant Iterator, which points to the first header. The value of the iterator is a std::pair<std::string, std::string>.

static bool checkUrl ( const std::string &  url  )  [static]

Checks for double-dot-url. Returns false, if the url used as a filename would escape from the basedir.

Copyright © 2008 The Tntnet Development Team
Tntnet 1.6