Upload fix.

master
Nicolas Favre-Felix 14 years ago
parent 2db7eb8389
commit 304486646d

@ -1,6 +1,6 @@
# About # 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/).
<pre> <pre>
make clean all make clean all
@ -203,7 +203,7 @@ curl -v "http://127.0.0.1:7379/GET/big-file?type=application/pdf"
[...] [...]
</pre> </pre>
# 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. 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. 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.

@ -208,9 +208,9 @@ int
http_on_body(http_parser *p, const char *at, size_t length) { http_on_body(http_parser *p, const char *at, size_t length) {
struct http_client *c = p->data; struct http_client *c = p->data;
c->body.s = calloc(length+1, 1); c->body.s = realloc(c->body.s, c->body.sz + length);
memcpy(c->body.s, at, length); memcpy(c->body.s + c->body.sz, at, length);
c->body.sz = length; c->body.sz += length;
return 0; return 0;
} }

Loading…
Cancel
Save