Welcome! Log In Create A New Profile

Advanced

Re: [PATCH] $request_scheme variable

Chris Branch via nginx-devel
February 27, 2018 05:34PM
Hi, just giving this patch some birthday bumps.

> On 27 Feb 2017, at 11:58, Chris Branch via nginx-devel <nginx-devel@nginx.org> wrote:
>
> # HG changeset patch
> # User Chris Branch <cbranch@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

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] $request_scheme variable

Chris Branch via nginx-devel 533 February 27, 2017 07:00AM

Re: [PATCH] $request_scheme variable

Chris Branch via nginx-devel 159 February 27, 2018 05:34PM

Re: [PATCH] $request_scheme variable

Maxim Dounin 262 February 28, 2018 12:10PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 206
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready