forked from mirrors/kore
add http_post_data_text() which returns the post data NUL-terminated to the caller.
This commit is contained in:
parent
85aad24af5
commit
b3cdccbc87
|
@ -58,5 +58,6 @@ int http_request_new(struct connection *, struct spdy_stream *,
|
||||||
char *, char *, char *, struct http_request **);
|
char *, char *, char *, struct http_request **);
|
||||||
|
|
||||||
int http_header_recv(struct netbuf *);
|
int http_header_recv(struct netbuf *);
|
||||||
|
char *http_post_data_text(struct http_request *);
|
||||||
|
|
||||||
#endif /* !__H_HTTP_H */
|
#endif /* !__H_HTTP_H */
|
||||||
|
|
16
src/http.c
16
src/http.c
|
@ -387,6 +387,22 @@ http_header_recv(struct netbuf *nb)
|
||||||
return (KORE_RESULT_OK);
|
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
|
static int
|
||||||
http_generic_404(struct http_request *req)
|
http_generic_404(struct http_request *req)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue