aboutsummaryrefslogtreecommitdiff
path: root/src/supplemental/http/http_msg.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-08-30 14:23:39 -0700
committerGarrett D'Amore <garrett@damore.org>2018-08-30 15:28:43 -0700
commit0cc96c69b3fce09a9c4a8d467d17cfbda76bc02f (patch)
tree855f6995749e56f4a9e69ce7d19437b780d63ba2 /src/supplemental/http/http_msg.c
parentc96b7665469679563ee642a42d175aa24a957f26 (diff)
downloadnng-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_msg.c')
-rw-r--r--src/supplemental/http/http_msg.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/supplemental/http/http_msg.c b/src/supplemental/http/http_msg.c
index d6ab862e..dcd842c5 100644
--- a/src/supplemental/http/http_msg.c
+++ b/src/supplemental/http/http_msg.c
@@ -399,6 +399,20 @@ nni_http_res_copy_data(nni_http_res *res, const void *data, size_t size)
return (0);
}
+// nni_http_res_alloc_data allocates the data region, but does not update any
+// headers. The intended use is for client implementations that want to
+// allocate a buffer to receive the entity into.
+int
+nni_http_res_alloc_data(nni_http_res *res, size_t size)
+{
+ int rv;
+
+ if ((rv = http_entity_alloc_data(&res->data, size)) != 0) {
+ return (rv);
+ }
+ return (0);
+}
+
bool
nni_http_res_is_error(nni_http_res *res)
{