---
name: "ne_get_response_header"
section: "3"
platform: "linux"
package: "neon"
version: "0.37.1-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/ne_get_response_header"
---

# ne\_get\_response\_header(3)

functions to access response headers and trailers

## NAME

ne\_get\_response\_header, ne\_get\_response\_trailer, ne\_response\_header\_iterate, ne\_response\_trailer\_iterate - functions to access response headers and trailers

## SYNOPSIS

```
#include <ne_request.h>
```

**const char \*ne\_get\_response\_header(ne\_request \****request***, const char \****name***);**

**const char \*ne\_get\_response\_trailer(ne\_request \****req***, const char \****name***);**

**void \*ne\_response\_header\_iterate(ne\_request \****request***, void \****cursor***, const char \*\****name***, const char \*\****value***);**

**void \*ne\_response\_trailer\_iterate(ne\_request \****request***, void \****cursor***, const char \*\****name***, const char \*\****value***);**

## DESCRIPTION

To retrieve the value of a response header field, the **ne\_get\_response\_header** function can be used, and is given the name of the header to return. If multiple HTTP response headers are received with the same name, their values are combined together in a comma-separated list.

To retrieve the value of a header from a chunked response trailer section (sent after, rather than before, the response body), **ne\_get\_response\_trailer** can be used. This function otherwise has the same semantics as **ne\_get\_response\_header**. Note that trailer fields are used rarely and should be interpreted with care, see **RFC 9110 §6.5**\[1\].

To iterate over all the response headers returned, the **ne\_response\_header\_iterate** function can be used. This function takes a *cursor* parameter which should be NULL to retrieve the first header. The function stores the name and value of the next header header in the *name* and *value* parameters, and returns a new cursor pointer which can be passed to **ne\_response\_header\_iterate** to retrieve the next header.

The **ne\_response\_trailer\_iterate** function has the same semantics as **ne\_response\_header\_iterate** except it operates on the response trailer fields rather than the header section.

## RETURN VALUE

**ne\_get\_response\_header** and **ne\_get\_response\_trailer** each return a string, or NULL if no header or trailer field with that name was found. The return value pointer is valid only until the next call to **ne\_begin\_request** or **ne\_request\_destroy** for the same request.

Likewise, the cursor, names, and values returned by **ne\_response\_header\_iterate** or **ne\_response\_trailer\_iterate** are only valid until the next call to **ne\_begin\_request** or until the request object is destroyed.

## EXAMPLES

The following code will output the value of the Last-Modified header for a resource:

```
ne_request *req = ne_request_create(sess, "GET", "/foo.txt");
if (ne_request_dispatch(req) == NE_OK) {
    const char *mtime = ne_get_response_header(req, "Last-Modified");
    if (mtime) {
        printf("/foo.txt has last-modified value %s\n", mtime);
    }
}
ne_request_destroy(req);
```

## HISTORY

**ne\_get\_response\_trailer** and **ne\_response\_trailer\_iterate** are available in neon 0.37.0 and later. In older releases, trailer fields were merged with normal response headers and could be accessed using **ne\_get\_response\_header** or **ne\_response\_header\_iterate**.

## SEE ALSO

[**ne\_request\_create**(3)](/ne_request_create/3.md), [**ne\_request\_destroy**(3)](/ne_request_destroy/3.md).

## COPYRIGHT

Copyright © 2001-2026 Joe Orton\

## REFERENCES

- 1\.

  RFC 9110 §6.5

  https://www.rfc-editor.org/rfc/rfc9110.html#name-trailer-fields
