aboutsummaryrefslogtreecommitdiff
path: root/src/supplemental/http/http_api.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2025-01-05 11:47:03 -0800
committerGarrett D'Amore <garrett@damore.org>2025-01-05 22:39:17 -0800
commitbce6a79fc55852032e9d653b099a121353aaa238 (patch)
tree6e6aa44e73ea7e671a50103539c55443df8c4dc2 /src/supplemental/http/http_api.h
parentd31844817a5b304a894c5b963cd52aeb9e47c627 (diff)
downloadnng-bce6a79fc55852032e9d653b099a121353aaa238.tar.gz
nng-bce6a79fc55852032e9d653b099a121353aaa238.tar.bz2
nng-bce6a79fc55852032e9d653b099a121353aaa238.zip
http: changing transaction API to inline req and res structures
This is a step towards simplifying this API and ultimately simplifying the HTTP callback API used for the server side.
Diffstat (limited to 'src/supplemental/http/http_api.h')
-rw-r--r--src/supplemental/http/http_api.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/supplemental/http/http_api.h b/src/supplemental/http/http_api.h
index 29a8c5c1..a6dfa6ca 100644
--- a/src/supplemental/http/http_api.h
+++ b/src/supplemental/http/http_api.h
@@ -34,13 +34,14 @@ typedef struct nng_http_chunks nni_http_chunks;
extern const char *nni_http_reason(uint16_t);
-extern int nni_http_req_init(nni_http_req **);
+extern void nni_http_req_init(nni_http_req *);
extern void nni_http_req_reset(nni_http_req *);
extern int nni_http_req_get_buf(nni_http_req *, void **, size_t *);
extern int nni_http_req_parse(nni_http_req *, void *, size_t, size_t *);
extern char *nni_http_req_headers(nni_http_req *);
extern void nni_http_req_get_data(nni_http_req *, void **, size_t *);
+extern void nni_http_res_init(nni_http_res *);
extern void nni_http_res_reset(nni_http_res *);
extern int nni_http_res_get_buf(nni_http_res *, void **, size_t *);
extern int nni_http_res_parse(nni_http_res *, void *, size_t, size_t *);
@@ -74,6 +75,9 @@ extern int nni_http_chunks_parse(nni_http_chunks *, void *, size_t, size_t *);
extern void nni_http_read_chunks(
nni_http_conn *, nni_http_chunks *, nni_aio *);
+extern nni_http_req *nni_http_conn_req(nni_http_conn *);
+extern nni_http_res *nni_http_conn_res(nni_http_conn *);
+
// Private to the server. (Used to support session hijacking.)
extern void nni_http_conn_set_ctx(nni_http_conn *, void *);
extern void *nni_http_conn_get_ctx(nni_http_conn *);
@@ -137,6 +141,7 @@ extern const char *nni_http_req_get_uri(const nni_http_req *);
extern void nni_http_req_set_method(nni_http_req *, const char *);
extern int nni_http_req_set_version(nni_http_req *, const char *);
extern int nni_http_req_set_uri(nni_http_req *, const char *);
+extern int nni_http_req_set_url(nni_http_req *, const nng_url *);
extern uint16_t nni_http_res_get_status(const nni_http_res *);
extern void nni_http_res_set_status(nni_http_res *, uint16_t);
extern const char *nni_http_res_get_version(const nni_http_res *);
@@ -375,9 +380,9 @@ extern void nni_http_client_connect(nni_http_client *, nni_aio *);
// unless some kind of significant error occurs. The caller should dispose
// of the connection if the aio does not complete successfully.
// Note that this will fail with NNG_ENOTSUP if the server attempts to reply
-// with a chunked transfer encoding.
-extern void nni_http_transact_conn(
- nni_http_conn *, nni_http_req *, nni_http_res *, nni_aio *);
+// with a chunked transfer encoding. The request and response used are the
+// ones associated with the connection.
+extern void nni_http_transact_conn(nni_http_conn *, nni_aio *);
// nni_http_transact is used to execute a single transaction to a server.
// The connection is opened, and will be closed when the transaction is