# HG changeset patch # User Chris Branch <cbra...@cloudflare.com> # Date 1488195909 0 # Mon Feb 27 11:45:09 2017 +0000 # Node ID 05f555d65a33ebf005fedc569fb52eba3758e1d7 # Parent 87cf6ddb41c216876d13cffa5e637a61b159362c $request_scheme variable.
Contains the URI scheme supplied by the client. If no scheme supplied, equivalent to $scheme. Scheme can be supplied by the client in two ways: * HTTP/2 :scheme pseudo-header. * HTTP/1 absolute URI in request line. diff -r 87cf6ddb41c2 -r 05f555d65a33 src/http/ngx_http_variables.c --- a/src/http/ngx_http_variables.c Fri Feb 17 17:01:27 2017 +0300 +++ b/src/http/ngx_http_variables.c Mon Feb 27 11:45:09 2017 +0000 @@ -105,6 +105,8 @@ ngx_http_variable_value_t *v, uintptr_t data); static ngx_int_t ngx_http_variable_request_id(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data); +static ngx_int_t ngx_http_variable_request_scheme(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data); static ngx_int_t ngx_http_variable_status(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data); @@ -288,6 +290,10 @@ ngx_http_variable_request_id, 0, 0, 0 }, + { ngx_string("request_scheme"), NULL, + ngx_http_variable_request_scheme, + 0, 0, 0 }, + { ngx_string("status"), NULL, ngx_http_variable_status, 0, NGX_HTTP_VAR_NOCACHEABLE, 0 }, @@ -2158,6 +2164,24 @@ static ngx_int_t +ngx_http_variable_request_scheme(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data) +{ + if (r->schema_start) { + v->len = r->schema_end - r->schema_start; + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + v->data = r->schema_start; + + return NGX_OK; + } + + return ngx_http_variable_scheme(r, v, data); +} + + +static ngx_int_t ngx_http_variable_connection(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data) { _______________________________________________ nginx-devel mailing list nginx-devel@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-devel