Add 'callback' query string parameter for JSONP.

master
Nicolas Favre-Felix 14 years ago
parent dde59c943a
commit 6a3ca7658e

@ -21,7 +21,7 @@ curl -d "GET/hello" http://127.0.0.1:7379/
# Features
* GET and POST are supported.
* JSON output by default, optional JSONP parameter (`?jsonp=myFunction`).
* JSON output by default, optional JSONP parameter (`?jsonp=myFunction` or `?callback=myFunction`).
* Raw Redis 2.0 protocol output with `.raw` suffix
* BSON support for compact responses and MongoDB compatibility.
* HTTP 1.1 pipelining (70,000 http requests per second on a desktop Linux machine.)

@ -105,7 +105,8 @@ http_client_on_query_string(struct http_parser *parser, const char *at, size_t s
if(key_len == 4 && strncmp(key, "type", 4) == 0) {
c->type = calloc(1 + val_len, 1);
memcpy(c->type, val, val_len);
} else if(key_len == 5 && strncmp(key, "jsonp", 5) == 0) {
} else if((key_len == 5 && strncmp(key, "jsonp", 5) == 0)
|| (key_len == 8 && strncmp(key, "callback", 8) == 0)) {
c->jsonp = calloc(1 + val_len, 1);
memcpy(c->jsonp, val, val_len);
}

Loading…
Cancel
Save