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_public.c | |
| 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_public.c')
| -rw-r--r-- | src/supplemental/http/http_public.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/supplemental/http/http_public.c b/src/supplemental/http/http_public.c index f275db28..84811e54 100644 --- a/src/supplemental/http/http_public.c +++ b/src/supplemental/http/http_public.c @@ -226,6 +226,30 @@ nng_http_res_set_data(nng_http_res *res, const void *data, size_t sz) #endif } +void +nng_http_req_get_data(nng_http_req *req, void **datap, size_t *lenp) +{ +#ifdef NNG_SUPP_HTTP + nni_http_req_get_data(req, datap, lenp); +#else + NNI_ARG_UNUSED(req); + *datap = NULL; + *lenp = 0; +#endif +} + +void +nng_http_res_get_data(nng_http_res *res, void **datap, size_t *lenp) +{ +#ifdef NNG_SUPP_HTTP + nni_http_res_get_data(res, datap, lenp); +#else + NNI_ARG_UNUSED(res); + *datap = NULL; + *lenp = 0; +#endif +} + const char * nng_http_req_get_method(nng_http_req *req) { @@ -811,3 +835,35 @@ nng_http_client_connect(nng_http_client *cli, nng_aio *aio) } #endif } + +void +nng_http_client_transact( + nng_http_client *cli, nng_http_req *req, nng_http_res *res, nng_aio *aio) +{ +#ifdef NNG_SUPP_HTTP + nni_http_transact(cli, req, res, aio); +#else + NNI_ARG_UNUSED(cli); + NNI_ARG_UNUSED(req); + NNI_ARG_UNUSED(res); + if (nni_aio_begin(aio) == 0) { + nni_aio_finish_error(aio, NNG_ENOTSUP); + } +#endif +} + +void +nng_http_conn_transact( + nng_http_conn *conn, nng_http_req *req, nng_http_res *res, nng_aio *aio) +{ +#ifdef NNG_SUPP_HTTP + nni_http_transact_conn(conn, req, res, aio); +#else + NNI_ARG_UNUSED(conn); + NNI_ARG_UNUSED(req); + NNI_ARG_UNUSED(res); + if (nni_aio_begin(aio) == 0) { + nni_aio_finish_error(aio, NNG_ENOTSUP); + } +#endif +} |
