1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
|
'\" 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 QString & str )"
.br
.ti -1c
.BI "virtual \fB~QHttpHeader\fR ()"
.br
.ti -1c
.BI "QHttpHeader & \fBoperator=\fR ( const QHttpHeader & h )"
.br
.ti -1c
.BI "QString \fBvalue\fR ( const QString & key ) const"
.br
.ti -1c
.BI "void \fBsetValue\fR ( const QString & key, const QString & value )"
.br
.ti -1c
.BI "void \fBremoveValue\fR ( const QString & key )"
.br
.ti -1c
.BI "QStringList \fBkeys\fR () const"
.br
.ti -1c
.BI "bool \fBhasKey\fR ( const QString & 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 "QString \fBcontentType\fR () const"
.br
.ti -1c
.BI "void \fBsetContentType\fR ( const QString & type )"
.br
.ti -1c
.BI "virtual QString \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
QString 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 QString & 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 "QString 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 QString & 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 "QStringList 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 QString & 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 QString & 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 QString & key, const QString & 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 "QString 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 QString. It consists of lines with the format: key, colon, space, value, "\\r\\n".
.SH "QString QHttpHeader::value ( const QString & 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 Qt documentation is provided in HTML format; it is
located at $QTDIR/doc/html and can be read using Qt 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 [email protected] .
Please include the name of the manual page (tqhttpheader.3qt) and the Qt
version (3.3.8).
|