---
title: "CFHTTPMessageAppendBytes(_:_:_:)"
framework: cfnetwork
role: symbol
role_heading: Function
path: "cfnetwork/cfhttpmessageappendbytes(_:_:_:)"
---

# CFHTTPMessageAppendBytes(_:_:_:)

Appends data to a CFHTTPMessage object.

## Declaration

```swift
func CFHTTPMessageAppendBytes(_ message: CFHTTPMessage, _ newBytes: UnsafePointer<UInt8>, _ numBytes: CFIndex) -> Bool
```

## 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

Return Value TRUE if the data was successfully appended, otherwise FALSE.

## Discussion

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

- [CFHTTPMessage](cfnetwork/cfhttpmessage.md)
- [CFHTTPMessageAddAuthentication(_:_:_:_:_:_:)](cfnetwork/cfhttpmessageaddauthentication(_:_:_:_:_:_:).md)
- [CFHTTPMessageApplyCredentialDictionary(_:_:_:_:)](cfnetwork/cfhttpmessageapplycredentialdictionary(_:_:_:_:).md)
- [CFHTTPMessageApplyCredentials(_:_:_:_:_:)](cfnetwork/cfhttpmessageapplycredentials(_:_:_:_:_:).md)
- [CFHTTPMessageCopyAllHeaderFields(_:)](cfnetwork/cfhttpmessagecopyallheaderfields(_:).md)
- [CFHTTPMessageCopyBody(_:)](cfnetwork/cfhttpmessagecopybody(_:).md)
- [CFHTTPMessageCopyHeaderFieldValue(_:_:)](cfnetwork/cfhttpmessagecopyheaderfieldvalue(_:_:).md)
- [CFHTTPMessageCopyRequestMethod(_:)](cfnetwork/cfhttpmessagecopyrequestmethod(_:).md)
- [CFHTTPMessageCopyRequestURL(_:)](cfnetwork/cfhttpmessagecopyrequesturl(_:).md)
- [CFHTTPMessageCopyResponseStatusLine(_:)](cfnetwork/cfhttpmessagecopyresponsestatusline(_:).md)
- [CFHTTPMessageCopySerializedMessage(_:)](cfnetwork/cfhttpmessagecopyserializedmessage(_:).md)
- [CFHTTPMessageCopyVersion(_:)](cfnetwork/cfhttpmessagecopyversion(_:).md)
- [CFHTTPMessageCreateCopy(_:_:)](cfnetwork/cfhttpmessagecreatecopy(_:_:).md)
- [CFHTTPMessageCreateEmpty(_:_:)](cfnetwork/cfhttpmessagecreateempty(_:_:).md)
- [CFHTTPMessageCreateRequest(_:_:_:_:)](cfnetwork/cfhttpmessagecreaterequest(_:_:_:_:).md)
