Mercurial > hg > nginx-vendor-0-5
diff src/http/modules/ngx_http_memcached_module.c @ 320:1e9e2c5e7c14 NGINX_0_5_30
nginx 0.5.30
*) Feature: the $args variable can be set with the "set" directive.
*) Feature: the $is_args variable.
*) Bugfix: if a client has closed connection to mail proxy then nginx
might not close connection to backend.
*) Bugfix: now nginx escapes space in $memcached_key variable.
*) Bugfix: a segmentation fault might occur in worker process when the
HTTPS protocol was used in the "proxy_pass" directive.
*) Bugfix: the perl $$ variable value in ngx_http_perl_module was equal
to the master process identification number.
*) Bugfix: fix building on Solaris/amd64 by Sun Studio 11 and early
versions; bug appeared in 0.5.29.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 30 Jul 2007 00:00:00 +0400 |
parents | 95d92ec39071 |
children | f70f2f565fe0 |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_memcached_module.c +++ b/src/http/modules/ngx_http_memcached_module.c @@ -226,6 +226,7 @@ static ngx_int_t ngx_http_memcached_create_request(ngx_http_request_t *r) { size_t len; + uintptr_t escape; ngx_buf_t *b; ngx_chain_t *cl; ngx_http_memcached_ctx_t *ctx; @@ -242,10 +243,9 @@ ngx_http_memcached_create_request(ngx_ht return NGX_ERROR; } - len = sizeof("get ") - 1 + vv->len + sizeof(CRLF) - 1; - if (vv->len) { - len += 1 + vv->len; - } + escape = 2 * ngx_escape_uri(NULL, vv->data, vv->len, NGX_ESCAPE_MEMCACHED); + + len = sizeof("get ") - 1 + vv->len + escape + sizeof(CRLF) - 1; b = ngx_create_temp_buf(r->pool, len); if (b == NULL) { @@ -268,7 +268,13 @@ ngx_http_memcached_create_request(ngx_ht ctx->key.data = b->last; - b->last = ngx_copy(b->last, vv->data, vv->len); + if (escape == 0) { + b->last = ngx_copy(b->last, vv->data, vv->len); + + } else { + b->last = (u_char *) ngx_escape_uri(b->last, vv->data, vv->len, + NGX_ESCAPE_MEMCACHED); + } ctx->key.len = b->last - ctx->key.data;