<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.1.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CFNetwork",
  "identifier" : "/documentation/CFNetwork/CFHTTPMessageAppendBytes(_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "CFNetwork"
    ],
    "preciseIdentifier" : "c:@F@CFHTTPMessageAppendBytes"
  },
  "title" : "CFHTTPMessageAppendBytes(_:_:_:)"
}
-->

# CFHTTPMessageAppendBytes(_:_:_:)

Appends data to a `CFHTTPMessage` object.

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

`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(_:_:)`](/documentation/CFNetwork/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(_:)`](/documentation/CFNetwork/CFHTTPMessageCopyVersion(_:)), [`CFHTTPMessageCopyBody(_:)`](/documentation/CFNetwork/CFHTTPMessageCopyBody(_:)), [`CFHTTPMessageCopyHeaderFieldValue(_:_:)`](/documentation/CFNetwork/CFHTTPMessageCopyHeaderFieldValue(_:_:)), and [`CFHTTPMessageCopyAllHeaderFields(_:)`](/documentation/CFNetwork/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(_:)`](/documentation/CFNetwork/CFHTTPMessageCopyRequestURL(_:)) and [`CFHTTPMessageCopyRequestMethod(_:)`](/documentation/CFNetwork/CFHTTPMessageCopyRequestMethod(_:)) to get the message’s request URL and request method, respectively.

If the message is a response, you can also call [`CFHTTPMessageGetResponseStatusCode(_:)`](/documentation/CFNetwork/CFHTTPMessageGetResponseStatusCode(_:)) and [`CFHTTPMessageCopyResponseStatusLine(_:)`](/documentation/CFNetwork/CFHTTPMessageCopyResponseStatusLine(_:)) to get the message’s status code and status line, respectively.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)