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

This commit is contained in:
Joris Vink 2013-05-03 07:49:40 +02:00
parent 85aad24af5
commit b3cdccbc87
2 changed files with 17 additions and 0 deletions

View File

@ -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 */

View File

@ -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)
{