Http::RequestHeader Class Reference

#include <RequestHeader.h> [code]

Inherits Http::Header.

Inheritance diagram for Http::RequestHeader:

Inheritance graph
[legend]
Collaboration diagram for Http::RequestHeader:

Collaboration graph
[legend]
List of all members.

Detailed Description

Encapsulates the HTTP request message header.

Todo:
Revise the this documentation is necessary:
This class is used in the QHttp class to report the header information if the client requests something from the server.

HTTP requests have a method which describes the request's action. The most common requests are "GET" and "POST". In addition to the request method the header also includes a request-URI to specify the location for the method to use.

The method, request-URI and protocol-version can be set using a constructor or later using setRequest(). The values can be obtained using method(), path(), majorVersion() and minorVersion().

Important inherited functions: setValue() and value().

Todo:
Properly implement implicit sharing of private data (passing the pointer to the private data to the ctor of the base class).
See also:
ResponseHeader, HeaderReader, HeaderWriter

Definition at line 58 of file RequestHeader.h.

Public Member Functions

 RequestHeader ()
 RequestHeader (const QString &method, const QString &path, int majorVersion=1, int minorVersion=1)
 RequestHeader (const RequestHeader &header)
 RequestHeader (const QString &str)
 ~RequestHeader ()
 Destructor.
RequestHeaderoperator= (const RequestHeader &header)
void setRequestLine (const QString &method, const QString &path, int majorVersion=1, int minorVersion=1)
QString method () const
QString path () const
int majorVersion () const
int minorVersion () const
QString toString () const

Protected Member Functions

bool parseLine (const QString &line, int number)

Private Attributes

auto_ptr< RequestHeaderPrivated


Constructor & Destructor Documentation

RequestHeader::RequestHeader  ) 
 

Constructs an empty HTTP request header.

Definition at line 46 of file RequestHeader.cpp.

RequestHeader::RequestHeader const QString &  method,
const QString &  path,
int  majorVersion = 1,
int  minorVersion = 1
 

Constructs a HTTP request header for the method method, the request-URI path and the protocol-version majorVer and minorVer.

Definition at line 56 of file RequestHeader.cpp.

RequestHeader::RequestHeader const RequestHeader header  ) 
 

Constructs a copy of header.

Definition at line 68 of file RequestHeader.cpp.

RequestHeader::RequestHeader const QString &  str  ) 
 

Constructs a HTTP request header from the string str. The str should consist of one or more "\r\n" delimited lines; the first line should be the request-line (format: method, space, request-URI, space HTTP-version); each of the remaining lines should have the format key, colon, space, value.

Definition at line 103 of file RequestHeader.cpp.

RequestHeader::~RequestHeader  ) 
 

Destructor.

Definition at line 78 of file RequestHeader.cpp.


Member Function Documentation

int RequestHeader::majorVersion  )  const
 

Returns the major protocol-version of the HTTP request header.

See also:
minorVersion() method() path() setRequest()

Definition at line 157 of file RequestHeader.cpp.

QString RequestHeader::method  )  const
 

Returns the method of the HTTP request header.

See also:
path() majorVersion() minorVersion() setRequest()

Definition at line 135 of file RequestHeader.cpp.

int RequestHeader::minorVersion  )  const
 

Returns the minor protocol-version of the HTTP request header.

See also:
majorVersion() method() path() setRequest()

Definition at line 168 of file RequestHeader.cpp.

RequestHeader & RequestHeader::operator= const RequestHeader header  ) 
 

Copies the content of header into this RequestHeader

Definition at line 86 of file RequestHeader.cpp.

bool RequestHeader::parseLine const QString &  line,
int  number
[protected, virtual]
 

Reimplemented from Http::Header.

Definition at line 176 of file RequestHeader.cpp.

QString RequestHeader::path  )  const
 

Returns the request-URI of the HTTP request header.

See also:
method() majorVersion() minorVersion() setRequest()

Definition at line 146 of file RequestHeader.cpp.

void RequestHeader::setRequestLine const QString &  method,
const QString &  path,
int  majorVersion = 1,
int  minorVersion = 1
 

This function sets the request method to method, the request-URI to path and the protocol-version to majorVer and minorVer.

See also:
method() path() majorVersion() minorVersion()

Definition at line 117 of file RequestHeader.cpp.

QString RequestHeader::toString  )  const [virtual]
 

Reimplemented from Http::Header.

Definition at line 205 of file RequestHeader.cpp.


Member Data Documentation

auto_ptr<RequestHeaderPrivate> Http::RequestHeader::d [private]
 

Reimplemented from Http::Header.

Definition at line 88 of file RequestHeader.h.


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