kore

Kore is a web application platform for writing scalable, concurrent web based processes in C or Python.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit b3cdccbc872f108c6e3e2775385824c54e16b6f2
parent 85aad24af57be8ac67cf14e126bf8a8436f37ec9
Author: Joris Vink <joris@coders.se>
Date:   Fri,  3 May 2013 07:49:40 +0200

add http_post_data_text() which returns the post data NUL-terminated to the caller.

Diffstat:
includes/http.h | 1+
src/http.c | 16++++++++++++++++
2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/includes/http.h b/includes/http.h @@ -58,5 +58,6 @@ int http_request_new(struct connection *, struct spdy_stream *, char *, char *, char *, struct http_request **); int http_header_recv(struct netbuf *); +char *http_post_data_text(struct http_request *); #endif /* !__H_HTTP_H */ diff --git a/src/http.c b/src/http.c @@ -387,6 +387,22 @@ http_header_recv(struct netbuf *nb) return (KORE_RESULT_OK); } +char * +http_post_data_text(struct http_request *req) +{ + u_int32_t len; + u_int8_t *data; + char *text; + + data = kore_buf_release(req->post_data, &len); + len++; + + text = (char *)kore_malloc(len); + kore_strlcpy(text, (char *)data, len); + + return (text); +} + static int http_generic_404(struct http_request *req) {