MessageHeader Class Reference

#include <Pt/Http/Message.h>

HTTP message header.

Inherits NonCopyable.


class  ConstIterator
 HTTP header field iterator. More...
class  Field
 Field of a HTTP header. More...

Public Member Functions

 MessageHeader ()
 Default constructor.
 ~MessageHeader ()
void add (const char *key, const char *value)
 Adds a header field.
ConstIterator begin () const
 Returns the begin of the header fields.
void clear ()
 Clears all content.
std::size_t contentLength () const
 Returns the content length.
ConstIterator end () const
 Returns the end of the header fields.
const char * get (const char *key) const
 Returns a field value.
bool has (const char *key) const
 Returns true if the field is present.
bool isChunked () const
 Returns true if chunked encoding is set.
bool isKeepAlive () const
 Returns true if HTTP keep-alive is set.
bool isSet (const char *key, const char *value) const
 Returns true if the field is set to the value.
void remove (const char *key)
 Removes a header field.
void set (const char *key, const char *value)
 Sets a header field.
void setKeepAlive ()
 Sets the HTTP keep-alive header.
void setVersion (unsigned major, unsigned minor)
 Sets the HTTP version number.
unsigned versionMajor () const
 Returns the major HTTP version number.
unsigned versionMinor () const
 Returns the minor HTTP version number.