aboutsummaryrefslogtreecommitdiff
path: root/src/supplemental/http/http_client.c
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_client.c
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_client.c')
-rw-r--r--src/supplemental/http/http_client.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/supplemental/http/http_client.c b/src/supplemental/http/http_client.c
index 52b6874d..8701a96b 100644
--- a/src/supplemental/http/http_client.c
+++ b/src/supplemental/http/http_client.c
@@ -361,8 +361,7 @@ http_txn_cancel(nni_aio *aio, void *arg, int rv)
// for Chunked Transfer Encoding is missing. Note that cancelling the aio
// is generally fatal to the connection.
void
-nni_http_transact_conn(
- nni_http_conn *conn, nni_http_req *req, nni_http_res *res, nni_aio *aio)
+nni_http_transact_conn(nni_http_conn *conn, nni_aio *aio)
{
http_txn *txn;
int rv;
@@ -380,10 +379,12 @@ nni_http_transact_conn(
nni_aio_list_init(&txn->aios);
txn->client = NULL;
txn->conn = conn;
- txn->req = req;
- txn->res = res;
+ txn->req = nni_http_conn_req(conn);
+ txn->res = nni_http_conn_res(conn);
txn->state = HTTP_SENDING;
+ nni_http_res_reset(txn->res);
+
nni_mtx_lock(&http_txn_lk);
if (!nni_aio_start(aio, http_txn_cancel, txn)) {
nni_mtx_unlock(&http_txn_lk);
@@ -392,7 +393,7 @@ nni_http_transact_conn(
}
nni_http_res_reset(txn->res);
nni_list_append(&txn->aios, aio);
- nni_http_write_req(conn, req, txn->aio);
+ nni_http_write_req(conn, txn->req, txn->aio);
nni_mtx_unlock(&http_txn_lk);
}