KVIrc  4.9.2
DeveloperAPIs
Public Member Functions | Protected Member Functions | List of all members
QHttpRequestHeader Class Reference

The QHttpRequestHeader class contains request header information for HTTP. More...

#include <qhttp.h>

+ Inheritance diagram for QHttpRequestHeader:

Public Member Functions

int majorVersion () const
 
QString method () const
 
int minorVersion () const
 
QHttpRequestHeaderoperator= (const QHttpRequestHeader &header)
 
QString path () const
 
 QHttpRequestHeader ()
 
 QHttpRequestHeader (const QString &method, const QString &path, int majorVer=1, int minorVer=1)
 
 QHttpRequestHeader (const QHttpRequestHeader &header)
 
 QHttpRequestHeader (const QString &str)
 
void setRequest (const QString &method, const QString &path, int majorVer=1, int minorVer=1)
 
QString toString () const
 
- Public Member Functions inherited from QHttpHeader
void addValue (const QString &key, const QString &value)
 
QStringList allValues (const QString &key) const
 
uint contentLength () const
 
QString contentType () const
 
bool hasContentLength () const
 
bool hasContentType () const
 
bool hasKey (const QString &key) const
 
bool isValid () const
 
QStringList keys () const
 
QHttpHeaderoperator= (const QHttpHeader &h)
 
 QHttpHeader ()
 
 QHttpHeader (const QHttpHeader &header)
 
 QHttpHeader (const QString &str)
 
void removeAllValues (const QString &key)
 
void removeValue (const QString &key)
 
void setContentLength (int len)
 
void setContentType (const QString &type)
 
void setValue (const QString &key, const QString &value)
 
void setValues (const QList< QPair< QString, QString >> &values)
 
QString value (const QString &key) const
 
QList< QPair< QString, QString > > values () const
 
virtual ~QHttpHeader ()
 

Protected Member Functions

bool parseLine (const QString &line, int number)
 
- Protected Member Functions inherited from QHttpHeader
bool parse (const QString &str)
 
 QHttpHeader (QHttpHeaderPrivate &dd, const QString &str=QString())
 
 QHttpHeader (QHttpHeaderPrivate &dd, const QHttpHeader &header)
 
void setValid (bool)
 

Additional Inherited Members

- Protected Attributes inherited from QHttpHeader
QScopedPointer
< QHttpHeaderPrivate
d_ptr
 

Detailed Description

The QHttpRequestHeader class contains request header information for HTTP.

QtNetwork

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().

Note that the request-URI must be in the format expected by the HTTP server. That is, all reserved characters must be encoded in HH (where HH are two hexadecimal digits). See QUrl::toPercentEncoding() for more information.

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

See also
QHttpResponseHeader QHttp

Constructor & Destructor Documentation

QHttpRequestHeader::QHttpRequestHeader ( )

Constructs an empty HTTP request header.

References QHttpHeader::setValid().

QHttpRequestHeader::QHttpRequestHeader ( const QString &  method,
const QString &  path,
int  majorVer = 1,
int  minorVer = 1 
)

Constructs a HTTP request header for the method method, the request-URI path and the protocol-version majorVer and minorVer. The path argument must be properly encoded for an HTTP request.

References d, method(), and path().

QHttpRequestHeader::QHttpRequestHeader ( const QHttpRequestHeader header)

Constructs a copy of header.

References d.

QHttpRequestHeader::QHttpRequestHeader ( 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.

References QHttpHeader::parse().

Member Function Documentation

int QHttpRequestHeader::majorVersion ( ) const
virtual

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

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

Implements QHttpHeader.

References d.

Referenced by QHttpPrivate::_q_slotSendRequest(), and QHttpPrivate::addRequest().

QString QHttpRequestHeader::method ( ) const

Returns the method of the HTTP request header.

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

References d.

Referenced by QHttpPrivate::_q_slotSendRequest(), QHttpPrivate::addRequest(), QHttpRequestHeader(), and setRequest().

int QHttpRequestHeader::minorVersion ( ) const
virtual

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

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

Implements QHttpHeader.

References d.

Referenced by QHttpPrivate::_q_slotSendRequest(), and QHttpPrivate::addRequest().

QHttpRequestHeader & QHttpRequestHeader::operator= ( const QHttpRequestHeader header)

Copies the content of header into this QHttpRequestHeader

References d, and QHttpHeader::operator=().

bool QHttpRequestHeader::parseLine ( const QString &  line,
int  number 
)
protectedvirtual

Reimplemented from QHttpHeader.

References d, QHttpHeader::parseLine(), and v.

QString QHttpRequestHeader::path ( ) const

Returns the request-URI of the HTTP request header.

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

References d.

Referenced by QHttpPrivate::_q_slotSendRequest(), QHttpPrivate::addRequest(), QHttpRequestHeader(), and setRequest().

void QHttpRequestHeader::setRequest ( const QString &  method,
const QString &  path,
int  majorVer = 1,
int  minorVer = 1 
)

This function sets the request method to method, the request-URI to path and the protocol-version to majorVer and minorVer. The path argument must be properly encoded for an HTTP request.

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

References d, method(), path(), and QHttpHeader::setValid().

Referenced by QHttpPrivate::_q_slotSendRequest(), and QHttpPrivate::addRequest().

QString QHttpRequestHeader::toString ( ) const
virtual

Reimplemented from QHttpHeader.

References d, first(), and QHttpHeader::toString().

Referenced by QHttpPrivate::_q_slotConnected().


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