QHttpRequestHeader Class Reference

[ QtNetwork module]

The QHttpRequestHeader class contains request header information for HTTP. 更多...

继承 QHttpHeader .

方法


详细描述

The QHttpRequestHeader class contains request header information for HTTP.

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 方法 (), path (), majorVersion () 和 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.

重要继承函数: setValue () 和 value ().


方法文档编制

QHttpRequestHeader.__init__ ( self )

Constructs an empty HTTP request header.

QHttpRequestHeader.__init__ ( self , QString  方法 , QString  path , int  major  = 1, int  minor  = 1)

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

QHttpRequestHeader.__init__ ( self , QHttpRequestHeader   header )

构造副本为 header .

QHttpRequestHeader.__init__ ( self , QString  str )

Constructs a HTTP request header from the string str 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.

int QHttpRequestHeader.majorVersion ( self )

重实现自 QHttpHeader.majorVersion ().

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

另请参阅 minorVersion (), 方法 (), path (),和 setRequest ().

QString QHttpRequestHeader.method ( self )

Returns the method of the HTTP request header.

另请参阅 path (), majorVersion (), minorVersion (),和 setRequest ().

int QHttpRequestHeader.minorVersion ( self )

重实现自 QHttpHeader.minorVersion ().

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

另请参阅 majorVersion (), 方法 (), path (),和 setRequest ().

bool QHttpRequestHeader.parseLine ( self , QString  line , int  number )

QString QHttpRequestHeader.path ( self )

QHttpRequestHeader.setRequest ( self , QString  方法 , QString  path , int  major  = 1, int  minor  = 1)

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

另请参阅 方法 (), path (), majorVersion (),和 minorVersion ().

QString QHttpRequestHeader.toString ( self )

重实现自 QHttpHeader.toString ().