You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tqt3/doc/man/man3/tqhttpheader.3qt

211 lines
7.7 KiB

'\" t
.TH QHttpHeader 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
QHttpHeader \- Header information for HTTP
.SH SYNOPSIS
\fC#include <ntqhttp.h>\fR
.PP
Inherited by QHttpResponseHeader and QHttpRequestHeader.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBQHttpHeader\fR ()"
.br
.ti -1c
.BI "\fBQHttpHeader\fR ( const QHttpHeader & header )"
.br
.ti -1c
.BI "\fBQHttpHeader\fR ( const TQString & str )"
.br
.ti -1c
.BI "virtual \fB~QHttpHeader\fR ()"
.br
.ti -1c
.BI "QHttpHeader & \fBoperator=\fR ( const QHttpHeader & h )"
.br
.ti -1c
.BI "TQString \fBvalue\fR ( const TQString & key ) const"
.br
.ti -1c
.BI "void \fBsetValue\fR ( const TQString & key, const TQString & value )"
.br
.ti -1c
.BI "void \fBremoveValue\fR ( const TQString & key )"
.br
.ti -1c
.BI "TQStringList \fBkeys\fR () const"
.br
.ti -1c
.BI "bool \fBhasKey\fR ( const TQString & key ) const"
.br
.ti -1c
.BI "bool \fBhasContentLength\fR () const"
.br
.ti -1c
.BI "uint \fBcontentLength\fR () const"
.br
.ti -1c
.BI "void \fBsetContentLength\fR ( int len )"
.br
.ti -1c
.BI "bool \fBhasContentType\fR () const"
.br
.ti -1c
.BI "TQString \fBcontentType\fR () const"
.br
.ti -1c
.BI "void \fBsetContentType\fR ( const TQString & type )"
.br
.ti -1c
.BI "virtual TQString \fBtoString\fR () const"
.br
.ti -1c
.BI "bool \fBisValid\fR () const"
.br
.ti -1c
.BI "virtual int \fBmajorVersion\fR () const = 0"
.br
.ti -1c
.BI "virtual int \fBminorVersion\fR () const = 0"
.br
.in -1c
.SH DESCRIPTION
The QHttpHeader class contains header information for HTTP.
.PP
In most cases you should use the more specialized derivatives of this class, QHttpResponseHeader and QHttpRequestHeader, rather than directly using QHttpHeader.
.PP
QHttpHeader provides the HTTP header fields. A HTTP header field consists of a name followed by a colon, a single space, and the field value. (See RFC 1945.) Field names are case-insensitive. A typical header field looks like this:
.PP
.nf
.br
content-type: text/html
.br
.fi
.PP
In the API the header field name is called the "key" and the content is called the "value". You can get and set a header field's value by using its key with value() and setValue(), e.g.
.PP
.nf
.br
header.setValue( "content-type", "text/html" );
.br
TQString contentType = header.value( "content-type" );
.br
.fi
.PP
Some fields are so common that getters and setters are provided for them as a convenient alternative to using value() and setValue(), e.g. contentLength() and contentType(), setContentLength() and setContentType().
.PP
Each header key has a \fIsingle\fR value associated with it. If you set the value for a key which already exists the previous value will be discarded.
.PP
See also QHttpRequestHeader, QHttpResponseHeader, and Input/Output and Networking.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QHttpHeader::QHttpHeader ()"
Constructs an empty HTTP header.
.SH "QHttpHeader::QHttpHeader ( const QHttpHeader & header )"
Constructs a copy of \fIheader\fR.
.SH "QHttpHeader::QHttpHeader ( const TQString & str )"
Constructs a HTTP header for \fIstr\fR.
.PP
This constructor parses the string \fIstr\fR for header fields and adds this information. The \fIstr\fR should consist of one or more" \\r\\n" delimited lines; each of these lines should have the format key, colon, space, value.
.SH "QHttpHeader::~QHttpHeader ()\fC [virtual]\fR"
Destructor.
.SH "uint QHttpHeader::contentLength () const"
Returns the value of the special HTTP header field \fCcontent-length\fR.
.PP
See also setContentLength() and hasContentLength().
.SH "TQString QHttpHeader::contentType () const"
Returns the value of the special HTTP header field \fCcontent-type\fR.
.PP
See also setContentType() and hasContentType().
.SH "bool QHttpHeader::hasContentLength () const"
Returns TRUE if the header has an entry for the special HTTP header field \fCcontent-length\fR; otherwise returns FALSE.
.PP
See also contentLength() and setContentLength().
.SH "bool QHttpHeader::hasContentType () const"
Returns TRUE if the header has an entry for the the special HTTP header field \fCcontent-type\fR; otherwise returns FALSE.
.PP
See also contentType() and setContentType().
.SH "bool QHttpHeader::hasKey ( const TQString & key ) const"
Returns TRUE if the HTTP header has an entry with the given \fIkey\fR; otherwise returns FALSE.
.PP
See also value(), setValue(), and keys().
.SH "bool QHttpHeader::isValid () const"
Returns TRUE if the HTTP header is valid; otherwise returns FALSE.
.PP
A QHttpHeader is invalid if it was created by parsing a malformed string.
.SH "TQStringList QHttpHeader::keys () const"
Returns a list of the keys in the HTTP header.
.PP
See also hasKey().
.SH "int QHttpHeader::majorVersion () const\fC [pure virtual]\fR"
Returns the major protocol-version of the HTTP header.
.PP
Reimplemented in QHttpResponseHeader and QHttpRequestHeader.
.SH "int QHttpHeader::minorVersion () const\fC [pure virtual]\fR"
Returns the minor protocol-version of the HTTP header.
.PP
Reimplemented in QHttpResponseHeader and QHttpRequestHeader.
.SH "QHttpHeader & QHttpHeader::operator= ( const QHttpHeader & h )"
Assigns \fIh\fR and returns a reference to this http header.
.SH "void QHttpHeader::removeValue ( const TQString & key )"
Removes the entry with the key \fIkey\fR from the HTTP header.
.PP
See also value() and setValue().
.SH "void QHttpHeader::setContentLength ( int len )"
Sets the value of the special HTTP header field \fCcontent-length\fR to \fIlen\fR.
.PP
See also contentLength() and hasContentLength().
.SH "void QHttpHeader::setContentType ( const TQString & type )"
Sets the value of the special HTTP header field \fCcontent-type\fR to \fItype\fR.
.PP
See also contentType() and hasContentType().
.PP
Example: network/archivesearch/archivedialog.ui.h.
.SH "void QHttpHeader::setValue ( const TQString & key, const TQString & value )"
Sets the value of the entry with the \fIkey\fR to \fIvalue\fR.
.PP
If no entry with \fIkey\fR exists, a new entry with the given \fIkey\fR and \fIvalue\fR is created. If an entry with the \fIkey\fR already exists, its value is discarded and replaced with the given \fIvalue\fR.
.PP
See also value(), hasKey(), and removeValue().
.PP
Example: network/archivesearch/archivedialog.ui.h.
.SH "TQString QHttpHeader::toString () const\fC [virtual]\fR"
Returns a string representation of the HTTP header.
.PP
The string is suitable for use by the constructor that takes a TQString. It consists of lines with the format: key, colon, space, value, "\\r\\n".
.SH "TQString QHttpHeader::value ( const TQString & key ) const"
Returns the value for the entry with the given \fIkey\fR. If no entry has this \fIkey\fR, an empty string is returned.
.PP
See also setValue(), removeValue(), hasKey(), and keys().
.SH "SEE ALSO"
.BR http://doc.trolltech.com/qhttpheader.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive TQt documentation is provided in HTML format; it is
located at $TQTDIR/doc/html and can be read using TQt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech.
.P
If you find errors in this manual page, please report them to
.BR qt-bugs@trolltech.com .
Please include the name of the manual page (tqhttpheader.3qt) and the Qt
version (3.3.8).