Function

CFHTTPMessageCopyAllHeaderFields

Gets all header fields from a CFHTTPMessage object.

Declaration

CFDictionaryRef CFHTTPMessageCopyAllHeaderFields(CFHTTPMessageRef message);

Parameters

message

The message to examine.

Return Value

A CFDictionaryRef object containing keys and values that are CFStringRef objects, where the key is the header fieldname and the dictionary value is the header field’s value. Returns NULL if the header fields could not be copied. Ownership follows the The Create Rule.

Discussion

HTTP headers are case insensitive. To simplify your code, certain header field names are canonicalized into their standard form. For example, if the server sends a content-length header, it is automatically adjusted to be Content-Length.

The returned dictionary of headers is configured to be case-preserving during the set operation (unless the key already exists with a different case), and case-insensitive when looking up keys.

For example, if you set the header X-foo, and then later set the header X-Foo, the dictionary’s key will be X-foo, but the value will taken from the X-Foo header.

See Also

HTTP Messages

CFHTTPMessageRef

An opaque reference representing an HTTP message.

CFHTTPMessageAddAuthentication

Adds authentication information to a request.

CFHTTPMessageAppendBytes

Appends data to a CFHTTPMessage object.

CFHTTPMessageApplyCredentialDictionary

Use a dictionary containing authentication credentials to perform the authentication method specified by a CFHTTPAuthentication object.

CFHTTPMessageApplyCredentials

Performs the authentication method specified by a CFHTTPAuthentication object.

CFHTTPMessageCopyBody

Gets the body from a CFHTTPMessage object.

CFHTTPMessageCopyHeaderFieldValue

Gets the value of a header field from a CFHTTPMessage object.

CFHTTPMessageCopyRequestMethod

Gets the request method from a CFHTTPMessage object.

CFHTTPMessageCopyRequestURL

Gets the URL from a CFHTTPMessage object.

CFHTTPMessageCopyResponseStatusLine

Gets the status line from a CFHTTPMessage object.

CFHTTPMessageCopySerializedMessage

Serializes a CFHTTPMessage object.

CFHTTPMessageCopyVersion

Gets the HTTP version from a CFHTTPMessage object.

CFHTTPMessageCreateCopy

Gets a copy of a CFHTTPMessage object.

CFHTTPMessageCreateEmpty

Creates and returns a new, empty CFHTTPMessage object.

CFHTTPMessageCreateRequest

Creates and returns a CFHTTPMessage object for an HTTP request.

CFHTTPMessageCreateResponse

Creates and returns a CFHTTPMessage object for an HTTP response.

CFHTTPMessageGetResponseStatusCode

Gets the status code from a CFHTTPMessage object representing an HTTP response.

CFHTTPMessageGetTypeID

Returns the Core Foundation type identifier for the CFHTTPMessage opaque type.

CFHTTPMessageIsHeaderComplete

Determines whether a message header is complete.

CFHTTPMessageIsRequest

Returns a Boolean indicating whether the HTTP message is a request or a response.

CFHTTPMessageSetBody

Sets the body of a CFHTTPMessage object.

CFHTTPMessageSetHeaderFieldValue

Sets the value of a header field in an HTTP message.

kCFHTTPVersion1_0

Specifies HTTP version 1.0.

kCFHTTPVersion1_1

Specifies HTTP version 1.1.