diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-08-30 14:23:39 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-08-30 15:28:43 -0700 |
| commit | 0cc96c69b3fce09a9c4a8d467d17cfbda76bc02f (patch) | |
| tree | 855f6995749e56f4a9e69ce7d19437b780d63ba2 /src/supplemental/http/http.h | |
| parent | c96b7665469679563ee642a42d175aa24a957f26 (diff) | |
| download | nng-0cc96c69b3fce09a9c4a8d467d17cfbda76bc02f.tar.gz nng-0cc96c69b3fce09a9c4a8d467d17cfbda76bc02f.tar.bz2 nng-0cc96c69b3fce09a9c4a8d467d17cfbda76bc02f.zip | |
fixes #681 HTTP convenience GET method desired...
This adds a couple of new methods, and related documentation
and test cases.
Diffstat (limited to 'src/supplemental/http/http.h')
| -rw-r--r-- | src/supplemental/http/http.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/supplemental/http/http.h b/src/supplemental/http/http.h index 1991da1b..f6656fce 100644 --- a/src/supplemental/http/http.h +++ b/src/supplemental/http/http.h @@ -154,6 +154,9 @@ NNG_DECL int nng_http_req_set_data(nng_http_req *, const void *, size_t); // probably set the content-type header. NNG_DECL int nng_http_req_copy_data(nng_http_req *, const void *, size_t); +// nng_http_req_get_data gets the data for the response. +NNG_DECL void nng_http_req_get_data(nng_http_req *, void **, size_t *); + // nng_http_res represents an HTTP response. typedef struct nng_http_res nng_http_res; @@ -208,6 +211,9 @@ NNG_DECL int nng_http_res_set_version(nng_http_res *, const char *); // nng_http_res_get_version returns the version, usually HTTP/1.1. NNG_DECL const char *nng_http_res_get_version(nng_http_res *); +// nng_http_res_get_data gets the data for the response. +NNG_DECL void nng_http_res_get_data(nng_http_res *, void **, size_t *); + // nng_http_res_set_data adds entity data to the response. The // data object must persist (so only really useful for static data). // The content-length header is updated as well, but the caller should @@ -477,6 +483,22 @@ NNG_DECL int nng_http_client_get_tls( // in the first (index 0) output for the aio. NNG_DECL void nng_http_client_connect(nng_http_client *, nng_aio *); +// nng_http_conn_transact 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 close +// 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. +NNG_DECL void nng_http_conn_transact( + nng_http_conn *, nng_http_req *, nng_http_res *, nng_aio *); + +// nng_http_client_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. +NNG_DECL void nng_http_client_transact( + nng_http_client *, nng_http_req *, nng_http_res *, nng_aio *); + #ifdef __cplusplus } #endif |
