diff --git a/README.markdown b/README.markdown index 261de83..1ac0c13 100644 --- a/README.markdown +++ b/README.markdown @@ -1,6 +1,6 @@ # About -A very simple web server providing an HTTP interface to Redis. It uses [hiredis](https://github.com/antirez/hiredis), [jansson](https://github.com/akheron/jansson) and libevent. +A very simple web server providing an HTTP interface to Redis. It uses [hiredis](https://github.com/antirez/hiredis), [jansson](https://github.com/akheron/jansson), [libevent](http://monkey.org/~provos/libevent/), and [http-parser](https://github.com/ry/http-parser/).
 make clean all
@@ -203,7 +203,7 @@ curl -v "http://127.0.0.1:7379/GET/big-file?type=application/pdf"
 [...]
 
-# File upload (only with libevent 2) +# File upload Webdis supports file upload using HTTP PUT. The command URI is slightly different, as the last argument is taken from the HTTP body. For example: instead of `/SET/key/value`, the URI becomes `/SET/key` and the value is the entirety of the body. This works for other commands such as LPUSH, etc. diff --git a/client.c b/client.c index da6b78b..188da3d 100644 --- a/client.c +++ b/client.c @@ -208,9 +208,9 @@ int http_on_body(http_parser *p, const char *at, size_t length) { struct http_client *c = p->data; - c->body.s = calloc(length+1, 1); - memcpy(c->body.s, at, length); - c->body.sz = length; + c->body.s = realloc(c->body.s, c->body.sz + length); + memcpy(c->body.s + c->body.sz, at, length); + c->body.sz += length; return 0; }