'\" t .\" Title: ne_get_response_header .\" Author: .\" Generator: DocBook XSL Stylesheets vsnapshot .\" Date: 03/20/2026 .\" Manual: neon API reference .\" Source: neon .\" Language: English .\" .TH "NE_GET_RESPONSE_HEAD" "3" "03/20/2026" "neon" "neon API reference" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" ne_get_response_header, ne_get_response_trailer, ne_response_header_iterate, ne_response_trailer_iterate \- functions to access response headers and trailers .SH "SYNOPSIS" .sp .ft B .nf #include .fi .ft .HP \w'const\ char\ *ne_get_response_header('u .BI "const char *ne_get_response_header(ne_request\ *" "request" ", const\ char\ *" "name" ");" .HP \w'const\ char\ *ne_get_response_trailer('u .BI "const char *ne_get_response_trailer(ne_request\ *" "req" ", const\ char\ *" "name" ");" .HP \w'void\ *ne_response_header_iterate('u .BI "void *ne_response_header_iterate(ne_request\ *" "request" ", void\ *" "cursor" ", const\ char\ **" "name" ", const\ char\ **" "value" ");" .HP \w'void\ *ne_response_trailer_iterate('u .BI "void *ne_response_trailer_iterate(ne_request\ *" "request" ", void\ *" "cursor" ", const\ char\ **" "name" ", const\ char\ **" "value" ");" .SH "DESCRIPTION" .PP To retrieve the value of a response header field, the \fBne_get_response_header\fR 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\&. .PP To retrieve the value of a header from a chunked response trailer section (sent after, rather than before, the response body), \fBne_get_response_trailer\fR can be used\&. This function otherwise has the same semantics as \fBne_get_response_header\fR\&. Note that trailer fields are used rarely and should be interpreted with care, see \m[blue]\fBRFC 9110 \(sc6\&.5\fR\m[]\&\s-2\u[1]\d\s+2\&. .PP To iterate over all the response headers returned, the \fBne_response_header_iterate\fR function can be used\&. This function takes a \fIcursor\fR parameter which should be NULL to retrieve the first header\&. The function stores the name and value of the next header header in the \fIname\fR and \fIvalue\fR parameters, and returns a new cursor pointer which can be passed to \fBne_response_header_iterate\fR to retrieve the next header\&. .PP The \fBne_response_trailer_iterate\fR function has the same semantics as \fBne_response_header_iterate\fR except it operates on the response trailer fields rather than the header section\&. .SH "RETURN VALUE" .PP \fBne_get_response_header\fR and \fBne_get_response_trailer\fR 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 \fBne_begin_request\fR or \fBne_request_destroy\fR for the same request\&. .PP Likewise, the cursor, names, and values returned by \fBne_response_header_iterate\fR or \fBne_response_trailer_iterate\fR are only valid until the next call to \fBne_begin_request\fR or until the request object is destroyed\&. .SH "EXAMPLES" .PP The following code will output the value of the Last\-Modified header for a resource: .sp .if n \{\ .RS 4 .\} .nf 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\en", mtime); } } ne_request_destroy(req); .fi .if n \{\ .RE .\} .SH "HISTORY" .PP \fBne_get_response_trailer\fR and \fBne_response_trailer_iterate\fR 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 \fBne_get_response_header\fR or \fBne_response_header_iterate\fR\&. .SH "SEE ALSO" .PP \fBne_request_create\fR(3), \fBne_request_destroy\fR(3)\&. .SH "COPYRIGHT" .br Copyright \(co 2001-2026 Joe Orton .br .SH "REFERENCES" .IP " 1." 4 RFC 9110 \(sc6.5 .RS 4 \%https://www.rfc-editor.org/rfc/rfc9110.html#name-trailer-fields .RE