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_public.c | 56 +++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'src/supplemental/http/http_public.c') 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 +} -- cgit v1.2.3-70-g09d2