From 0cc96c69b3fce09a9c4a8d467d17cfbda76bc02f Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Thu, 30 Aug 2018 14:23:39 -0700 Subject: fixes #681 HTTP convenience GET method desired... This adds a couple of new methods, and related documentation and test cases. --- src/supplemental/http/http_api.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/supplemental/http/http_api.h') diff --git a/src/supplemental/http/http_api.h b/src/supplemental/http/http_api.h index cf2c78bf..71b24f54 100644 --- a/src/supplemental/http/http_api.h +++ b/src/supplemental/http/http_api.h @@ -101,6 +101,7 @@ extern int nni_http_req_copy_data(nni_http_req *, const void *, size_t); extern int nni_http_res_copy_data(nni_http_res *, const void *, size_t); extern int nni_http_req_set_data(nni_http_req *, const void *, size_t); extern int nni_http_res_set_data(nni_http_res *, const void *, size_t); +extern int nni_http_res_alloc_data(nni_http_res *, size_t); extern const char *nni_http_req_get_method(nni_http_req *); extern const char *nni_http_req_get_version(nni_http_req *); extern const char *nni_http_req_get_uri(nni_http_req *); @@ -306,4 +307,20 @@ extern int nni_http_client_get_tls( extern void nni_http_client_connect(nni_http_client *, nni_aio *); +// nni_http_transact_conn is used to perform a round-trip exchange (i.e. a +// single HTTP transaction). It will not automatically close the connection, +// 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 *); + +// 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 +// complete. Note that this will fail with NNG_ENOTSUP if the server attempts +// to reply with a chunked transfer encoding. +extern void nni_http_transact( + nni_http_client *, nni_http_req *, nni_http_res *, nni_aio *); + #endif // NNG_SUPPLEMENTAL_HTTP_HTTP_API_H -- cgit v1.2.3-70-g09d2