1QHttpHeader(3qt) QHttpHeader(3qt)
2
3
4
6 QHttpHeader - Header information for HTTP
7
9 #include <qhttp.h>
10
11 Inherited by QHttpResponseHeader and QHttpRequestHeader.
12
13 Public Members
14 QHttpHeader ()
15 QHttpHeader ( const QHttpHeader & header )
16 QHttpHeader ( const QString & str )
17 virtual ~QHttpHeader ()
18 QHttpHeader & operator= ( const QHttpHeader & h )
19 QString value ( const QString & key ) const
20 void setValue ( const QString & key, const QString & value )
21 void removeValue ( const QString & key )
22 QStringList keys () const
23 bool hasKey ( const QString & key ) const
24 bool hasContentLength () const
25 uint contentLength () const
26 void setContentLength ( int len )
27 bool hasContentType () const
28 QString contentType () const
29 void setContentType ( const QString & type )
30 virtual QString toString () const
31 bool isValid () const
32 virtual int majorVersion () const = 0
33 virtual int minorVersion () const = 0
34
36 The QHttpHeader class contains header information for HTTP.
37
38 In most cases you should use the more specialized derivatives of this
39 class, QHttpResponseHeader and QHttpRequestHeader, rather than directly
40 using QHttpHeader.
41
42 QHttpHeader provides the HTTP header fields. A HTTP header field
43 consists of a name followed by a colon, a single space, and the field
44 value. (See RFC 1945.) Field names are case-insensitive. A typical
45 header field looks like this:
46
47 content-type: text/html
48
49 In the API the header field name is called the "key" and the content is
50 called the "value". You can get and set a header field's value by using
51 its key with value() and setValue(), e.g.
52
53 header.setValue( "content-type", "text/html" );
54 QString contentType = header.value( "content-type" );
55
56 Some fields are so common that getters and setters are provided for
57 them as a convenient alternative to using value() and setValue(), e.g.
58 contentLength() and contentType(), setContentLength() and
59 setContentType().
60
61 Each header key has a single value associated with it. If you set the
62 value for a key which already exists the previous value will be
63 discarded.
64
65 See also QHttpRequestHeader, QHttpResponseHeader, and Input/Output and
66 Networking.
67
70 Constructs an empty HTTP header.
71
73 Constructs a copy of header.
74
76 Constructs a HTTP header for str.
77
78 This constructor parses the string str for header fields and adds this
79 information. The str should consist of one or more" \r\n" delimited
80 lines; each of these lines should have the format key, colon, space,
81 value.
82
84 Destructor.
85
87 Returns the value of the special HTTP header field content-length.
88
89 See also setContentLength() and hasContentLength().
90
92 Returns the value of the special HTTP header field content-type.
93
94 See also setContentType() and hasContentType().
95
97 Returns TRUE if the header has an entry for the special HTTP header
98 field content-length; otherwise returns FALSE.
99
100 See also contentLength() and setContentLength().
101
103 Returns TRUE if the header has an entry for the the special HTTP header
104 field content-type; otherwise returns FALSE.
105
106 See also contentType() and setContentType().
107
109 Returns TRUE if the HTTP header has an entry with the given key;
110 otherwise returns FALSE.
111
112 See also value(), setValue(), and keys().
113
115 Returns TRUE if the HTTP header is valid; otherwise returns FALSE.
116
117 A QHttpHeader is invalid if it was created by parsing a malformed
118 string.
119
121 Returns a list of the keys in the HTTP header.
122
123 See also hasKey().
124
126 Returns the major protocol-version of the HTTP header.
127
128 Reimplemented in QHttpResponseHeader and QHttpRequestHeader.
129
131 Returns the minor protocol-version of the HTTP header.
132
133 Reimplemented in QHttpResponseHeader and QHttpRequestHeader.
134
136 Assigns h and returns a reference to this http header.
137
139 Removes the entry with the key key from the HTTP header.
140
141 See also value() and setValue().
142
144 Sets the value of the special HTTP header field content-length to len.
145
146 See also contentLength() and hasContentLength().
147
149 Sets the value of the special HTTP header field content-type to type.
150
151 See also contentType() and hasContentType().
152
153 Example: network/archivesearch/archivedialog.ui.h.
154
156 Sets the value of the entry with the key to value.
157
158 If no entry with key exists, a new entry with the given key and value
159 is created. If an entry with the key already exists, its value is
160 discarded and replaced with the given value.
161
162 See also value(), hasKey(), and removeValue().
163
164 Example: network/archivesearch/archivedialog.ui.h.
165
167 Returns a string representation of the HTTP header.
168
169 The string is suitable for use by the constructor that takes a QString.
170 It consists of lines with the format: key, colon, space, value, "\r\n".
171
173 Returns the value for the entry with the given key. If no entry has
174 this key, an empty string is returned.
175
176 See also setValue(), removeValue(), hasKey(), and keys().
177
178
180 http://doc.trolltech.com/qhttpheader.html
181 http://www.trolltech.com/faq/tech.html
182
184 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
185 license file included in the distribution for a complete license
186 statement.
187
189 Generated automatically from the source code.
190
192 If you find a bug in Qt, please report it as described in
193 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
194 help you. Thank you.
195
196 The definitive Qt documentation is provided in HTML format; it is
197 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
198 web browser. This man page is provided as a convenience for those users
199 who prefer man pages, although this format is not officially supported
200 by Trolltech.
201
202 If you find errors in this manual page, please report them to qt-
203 bugs@trolltech.com. Please include the name of the manual page
204 (qhttpheader.3qt) and the Qt version (3.3.8).
205
206
207
208Trolltech AS 2 February 2007 QHttpHeader(3qt)