<!--
{
  "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/CFHTTPMessageCopyAllHeaderFields(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "CFNetwork"
    ],
    "preciseIdentifier" : "c:@F@CFHTTPMessageCopyAllHeaderFields"
  },
  "title" : "CFHTTPMessageCopyAllHeaderFields(_:)"
}
-->

# CFHTTPMessageCopyAllHeaderFields(_:)

Gets all header fields from a `CFHTTPMessage` object.

```
func CFHTTPMessageCopyAllHeaderFields(_ message: CFHTTPMessage) -> Unmanaged<CFDictionary>?
```

## 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](https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/Concepts/Ownership.html#//apple_ref/doc/uid/20001148-103029).

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

---

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)