|  | Home · Overviews · Examples

# QHttpHeader Class Reference
[com.trolltech.qt.network module]

The `QHttpHeader` class contains header information for HTTP. More...

Inherited by `QHttpRequestHeader` and `QHttpResponseHeader`.

## Detailed Description

The `QHttpHeader` class contains header information for HTTP.

In most cases you should use the more specialized derivatives of this class, `QHttpResponseHeader` and `QHttpRequestHeader`, rather than directly using `QHttpHeader`.

`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:

        content-type: text/html

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.

        header.setValue("content-type", "text/html");
        QString contentType = header.value("content-type");

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`.

Each header key has a single value associated with it. If you set the value for a key which already exists the previous value will be discarded.

See also `QHttpRequestHeader` and `QHttpResponseHeader`.