aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2025-10-07 18:48:44 -0700
committerGarrett D'Amore <garrett@damore.org>2025-10-07 18:48:44 -0700
commit07191755f3a38cbac48d15523095136f69d8f772 (patch)
tree2d9209adc4c9e3774a88b8d2581513ea137e3ca2 /include
parent46ade0691f41ac01cb5304b82cc67e99cd280a6d (diff)
downloadnng-07191755f3a38cbac48d15523095136f69d8f772.tar.gz
nng-07191755f3a38cbac48d15523095136f69d8f772.tar.bz2
nng-07191755f3a38cbac48d15523095136f69d8f772.zip
http: implement nng_http_next_header
Diffstat (limited to 'include')
-rw-r--r--include/nng/http.h9
1 files changed, 9 insertions, 0 deletions
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 *);