diff options
Diffstat (limited to 'src/http')
-rw-r--r-- | src/http/modules/ngx_http_memcached_module.c | 16 | ||||
-rw-r--r-- | src/http/modules/ngx_http_ssi_filter_module.c | 2 | ||||
-rw-r--r-- | src/http/modules/perl/nginx.pm | 2 | ||||
-rw-r--r-- | src/http/ngx_http_variables.c | 20 |
4 files changed, 34 insertions, 6 deletions
diff --git a/src/http/modules/ngx_http_memcached_module.c b/src/http/modules/ngx_http_memcached_module.c index ffd872b44..f7205418c 100644 --- 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_http_request_t *r) 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_http_request_t *r) 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; diff --git a/src/http/modules/ngx_http_ssi_filter_module.c b/src/http/modules/ngx_http_ssi_filter_module.c index 549ae4ce2..0de03aae0 100644 --- a/src/http/modules/ngx_http_ssi_filter_module.c +++ b/src/http/modules/ngx_http_ssi_filter_module.c @@ -439,6 +439,8 @@ ngx_http_ssi_body_filter(ngx_http_request_t *r, ngx_chain_t *in) if (rc == NGX_ERROR || rc == NGX_AGAIN) { return rc; } + + break; } } diff --git a/src/http/modules/perl/nginx.pm b/src/http/modules/perl/nginx.pm index 772e6cd75..f510f2df0 100644 --- a/src/http/modules/perl/nginx.pm +++ b/src/http/modules/perl/nginx.pm @@ -47,7 +47,7 @@ our @EXPORT = qw( HTTP_INSUFFICIENT_STORAGE ); -our $VERSION = '0.6.4'; +our $VERSION = '0.6.5'; require XSLoader; XSLoader::load('nginx', $VERSION); diff --git a/src/http/ngx_http_variables.c b/src/http/ngx_http_variables.c index 6316b3d58..af54d29b0 100644 --- a/src/http/ngx_http_variables.c +++ b/src/http/ngx_http_variables.c @@ -8,6 +8,7 @@ #include <ngx_core.h> #include <ngx_event.h> #include <ngx_http.h> +#include <nginx.h> static ngx_int_t ngx_http_variable_request(ngx_http_request_t *r, @@ -66,6 +67,8 @@ static ngx_int_t ngx_http_variable_sent_keep_alive(ngx_http_request_t *r, static ngx_int_t ngx_http_variable_sent_transfer_encoding(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data); +static ngx_int_t ngx_http_variable_nginx_version(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data); /* * TODO: @@ -205,6 +208,9 @@ static ngx_http_variable_t ngx_http_core_variables[] = { offsetof(ngx_http_request_t, limit_rate), NGX_HTTP_VAR_CHANGABLE|NGX_HTTP_VAR_NOCACHABLE, 0 }, + { ngx_string("nginx_version"), NULL, ngx_http_variable_nginx_version, + 0, 0, 0 }, + { ngx_null_string, NULL, NULL, 0, 0, 0 } }; @@ -1205,6 +1211,20 @@ ngx_http_variable_request_body_file(ngx_http_request_t *r, } +static ngx_int_t +ngx_http_variable_nginx_version(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data) +{ + v->len = sizeof(NGINX_VERSION) - 1; + v->valid = 1; + v->no_cachable = 0; + v->not_found = 0; + v->data = (u_char *) NGINX_VERSION; + + return NGX_OK; +} + + ngx_int_t ngx_http_variables_add_core_vars(ngx_conf_t *cf) { |