From 5ff3d3d3ab82be4b2171e06f1def9cdddaef4115 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Wed, 27 Dec 2017 16:32:33 -0800 Subject: fixes #180 add websocket header properties --- src/supplemental/http/http_msg.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/supplemental/http/http_msg.c') diff --git a/src/supplemental/http/http_msg.c b/src/supplemental/http/http_msg.c index 2e245868..8b3c6a7c 100644 --- a/src/supplemental/http/http_msg.c +++ b/src/supplemental/http/http_msg.c @@ -520,6 +520,32 @@ http_res_prepare(nni_http_res *res) return (rv); } +char * +nni_http_req_headers(nni_http_req *req) +{ + char * s; + size_t len; + + len = http_sprintf_headers(NULL, 0, &req->hdrs) + 1; + if ((s = nni_alloc(len)) != NULL) { + http_sprintf_headers(s, len, &req->hdrs); + } + return (s); +} + +char * +nni_http_res_headers(nni_http_res *res) +{ + char * s; + size_t len; + + len = http_sprintf_headers(NULL, 0, &res->hdrs) + 1; + if ((s = nni_alloc(len)) != NULL) { + http_sprintf_headers(s, len, &res->hdrs); + } + return (s); +} + int nni_http_req_get_buf(nni_http_req *req, void **data, size_t *szp) { -- cgit v1.2.3-70-g09d2