Baseclass for HTTP-messages. More...

#include <tnt/httpmessage.h>

Inheritance diagram for tnt::HttpMessage:
tnt::HttpError tnt::HttpReply tnt::HttpRequest tnt::MovedTemporarily tnt::NotAuthorized tnt::NotFoundException

Public Types

typedef Messageheader header_type

Public Member Functions

 HttpMessage ()
virtual ~HttpMessage ()
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
 returns the content of the specified header or the passed default when not set.
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
 Returns a constant Iterator, which points to the first header.
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)
 Checks for double-dot-url.

Protected Attributes

header_type header
Cookies httpcookies

Detailed Description

Baseclass for HTTP-messages.

Member Typedef Documentation

Constructor & Destructor Documentation

tnt::HttpMessage::HttpMessage ( )
inline
virtual tnt::HttpMessage::~HttpMessage ( )
inlinevirtual

Member Function Documentation

static bool tnt::HttpMessage::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.

virtual void tnt::HttpMessage::clear ( )
virtual

Removes all request-specific content.

Reimplemented in tnt::HttpRequest.

std::string tnt::HttpMessage::dumpHeader ( ) const

Returns all headers as a string.

void tnt::HttpMessage::dumpHeader ( std::ostream &  out) const

Prints all headers to the specified output-stream.

const char* tnt::HttpMessage::getHeader ( const char *  key,
const char *  def = "" 
) const

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

unsigned short tnt::HttpMessage::getMajorVersion ( ) const
inline

returns the http-major-version-number.

unsigned short tnt::HttpMessage::getMinorVersion ( ) const
inline

returns the http-minor-version-number.

bool tnt::HttpMessage::hasHeader ( const char *  key) const
inline

returns true, if the message has the specified header.

bool tnt::HttpMessage::hasHeader ( const std::string &  key) const
inline
header_type::const_iterator tnt::HttpMessage::header_begin ( ) const
inline

Returns a constant Iterator, which points to the first header.

The value of the iterator is a std::pair<std::string, std::string>.

header_type::const_iterator tnt::HttpMessage::header_end ( ) const
inline

Returns a constant Iterator, which points past the last header.

static std::string tnt::HttpMessage::htdate ( time_t  t)
static

Returns a properly formatted date-string, as needed in http.

static std::string tnt::HttpMessage::htdate ( struct::tm *  tm)
static

Returns a properly formatted date-string, as needed in http.

static std::string tnt::HttpMessage::htdateCurrent ( )
static

Returns a properly formatted current time-string, as needed in http.

void tnt::HttpMessage::removeHeader ( const std::string &  key)
inline

Removes the header with the specified name from the message.

void tnt::HttpMessage::setHeader ( const std::string &  key,
const std::string &  value,
bool  replace = true 
)
inline

Adds the specified header to the message.

void tnt::HttpMessage::setVersion ( unsigned short  major,
unsigned short  minor 
)
inline

sets the http-version-number

Member Data Documentation

header_type tnt::HttpMessage::header
protected
Cookies tnt::HttpMessage::httpcookies
protected

The documentation for this class was generated from the following file: