Function

CFHTTPMessageAppendBytes

Appends data to a CFHTTPMessage object.

Declaration

Boolean CFHTTPMessageAppendBytes(CFHTTPMessageRef message, const UInt8 *newBytes, CFIndex numBytes);

Parameters

message

The message to modify.

newBytes

A reference to the data to append.

numBytes

The length of the data pointed to by newBytes.

Return Value

TRUE if the data was successfully appended, otherwise FALSE.

Discussion

This function appends the data specified by newBytes to the specified message object which was created by calling CFHTTPMessageCreateEmpty. The data is an incoming serialized HTTP request or response received from a client or a server. While appending the data, this function deserializes it, removes any HTTP-based formatting that the message may contain, and stores the message in the message object. You can then call CFHTTPMessageCopyVersion, CFHTTPMessageCopyBody, CFHTTPMessageCopyHeaderFieldValue, and CFHTTPMessageCopyAllHeaderFields to get the message’s HTTP version, the message’s body, a specific header field, and all of the message’s headers, respectively.

If the message is a request, you can also call CFHTTPMessageCopyRequestURL and CFHTTPMessageCopyRequestMethod to get the message’s request URL and request method, respectively.

If the message is a response, you can also call CFHTTPMessageGetResponseStatusCode and CFHTTPMessageCopyResponseStatusLine to get the message’s status code and status line, respectively.

See Also

HTTP Messages

CFHTTPMessageRef

An opaque reference representing an HTTP message.

CFHTTPMessageAddAuthentication

Adds authentication information to a request.

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.

CFHTTPMessageCopyAllHeaderFields

Gets all header fields from a CFHTTPMessage 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.