aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2025-10-08 08:20:23 -0700
committerGarrett D'Amore <garrett@damore.org>2025-10-08 14:14:58 -0700
commit57ce9f1035a7d265d0f8b0d907dc893d4fcbcaeb (patch)
tree154042c271f68d2cb6991bcc4cdae22e65f51207 /include
parent3971d119c129bf5685f9fd14d0f1f785581c3565 (diff)
downloadnng-57ce9f1035a7d265d0f8b0d907dc893d4fcbcaeb.tar.gz
nng-57ce9f1035a7d265d0f8b0d907dc893d4fcbcaeb.tar.bz2
nng-57ce9f1035a7d265d0f8b0d907dc893d4fcbcaeb.zip
fixes #2133 websocket: new header iteration options
Diffstat (limited to 'include')
-rw-r--r--include/nng/http.h2
-rw-r--r--include/nng/nng.h15
2 files changed, 8 insertions, 9 deletions
diff --git a/include/nng/http.h b/include/nng/http.h
index 18fc03ea..864dcc4f 100644
--- a/include/nng/http.h
+++ b/include/nng/http.h
@@ -203,7 +203,7 @@ NNG_DECL const char *nng_http_get_header(nng_http *, const char *);
// 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_DECL bool 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.
diff --git a/include/nng/nng.h b/include/nng/nng.h
index 4108f027..57283f00 100644
--- a/include/nng/nng.h
+++ b/include/nng/nng.h
@@ -772,6 +772,9 @@ NNG_DECL nng_err nng_pipe_get_int(nng_pipe, const char *, int *);
NNG_DECL nng_err nng_pipe_get_ms(nng_pipe, const char *, nng_duration *);
NNG_DECL nng_err nng_pipe_get_size(nng_pipe, const char *, size_t *);
NNG_DECL nng_err nng_pipe_get_string(nng_pipe, const char *, const char **);
+NNG_DECL nng_err nng_pipe_get_strdup(nng_pipe, const char *, char **);
+NNG_DECL nng_err nng_pipe_get_strcpy(nng_pipe, const char *, char *, size_t);
+NNG_DECL nng_err nng_pipe_get_strlen(nng_pipe, const char *, size_t *);
NNG_DECL nng_err nng_pipe_get_addr(nng_pipe, const char *, nng_sockaddr *);
NNG_DECL nng_err nng_pipe_peer_cert(nng_pipe, nng_tls_cert **);
@@ -893,14 +896,10 @@ NNG_DECL nng_listener nng_pipe_listener(nng_pipe);
// headers from the peer on a pipe.
#define NNG_OPT_WS_HEADER "ws:header:"
-// NNG_OPT_WS_HEADER_KEY is also a prefix, but the value it contains
-// is the name (key) of the header at the index referenced. This
-// allows successive iteration through headers.
-#define NNG_OPT_WS_HEADER_KEY "ws:header_k:"
-
-// NNG_OPT_WS_HEADER_VAL is also a prefix, but the value it contains
-// is the value of the header at the index referenced.
-#define NNG_OPT_WS_HEADER_VAL "ws:header_v:"
+#define NNG_OPT_WS_HEADER_NEXT "ws:hdr-next"
+#define NNG_OPT_WS_HEADER_RESET "ws:hdr-reset"
+#define NNG_OPT_WS_HEADER_KEY "ws:hdr-key"
+#define NNG_OPT_WS_HEADER_VALUE "ws:hdr-val"
// NNG_OPT_WS_REQUEST_URI is used to obtain the URI sent by the client.
// This can be useful when a handler supports an entire directory tree.