diff --git a/includes/http.h b/includes/http.h index c936195..6329e84 100644 --- 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 index f5d704a..6109c9b 100644 --- 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) {