From 07191755f3a38cbac48d15523095136f69d8f772 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Tue, 7 Oct 2025 18:48:44 -0700 Subject: http: implement nng_http_next_header --- include/nng/http.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/nng/http.h b/include/nng/http.h index f8bfb679..18fc03ea 100644 --- a/include/nng/http.h +++ b/include/nng/http.h @@ -197,6 +197,15 @@ NNG_DECL void nng_http_del_header(nng_http *, const char *); // It returns NULL if no matching header can be found. NNG_DECL const char *nng_http_get_header(nng_http *, const char *); +// nng_http_next_header iterates over HTTP headers. For clients, +// it iterates over the response header, but for servers it iterates ovre the +// request header. The key will receive the name of the header, and the value +// the will receive its value. The caller starts the iteration by setting ptr +// to NULL, and then the value must be preserved. The function returns NNG_OK +// on success, or NNG_ENOENT if there are no more headers. +NNG_DECL nng_err nng_http_next_header( + nng_http *, const char **key, const char **val, void **ptr); + // nng_http_get_body returns the body sent by the peer, if one is attached. NNG_DECL void nng_http_get_body(nng_http *, void **, size_t *); -- cgit v1.2.3-70-g09d2