[nginx] Added r->schema.

Ruslan Ermilov ru at nginx.com
Fri Jun 8 08:01:20 UTC 2018


On Fri, Jun 08, 2018 at 11:29:05AM +0800, 洪志道 wrote:
> Hi.
> 
> diff -r 8e6bb4e6045f src/http/ngx_http_variables.c
> --- a/src/http/ngx_http_variables.c Thu Jun 07 20:04:22 2018 +0300
> +++ b/src/http/ngx_http_variables.c Thu Jun 07 12:20:05 2018 -0400
> @@ -1420,25 +1420,11 @@
>  ngx_http_variable_scheme(ngx_http_request_t *r,
>      ngx_http_variable_value_t *v, uintptr_t data)
>  {
> -#if (NGX_HTTP_SSL)
> -
> -    if (r->connection->ssl) {
> -        v->len = sizeof("https") - 1;
> -        v->valid = 1;
> -        v->no_cacheable = 0;
> -        v->not_found = 0;
> -        v->data = (u_char *) "https";
> -
> -        return NGX_OK;
> -    }
> -
> -#endif
> -
> -    v->len = sizeof("http") - 1;
>      v->valid = 1;
>      v->no_cacheable = 0;
>      v->not_found = 0;
> -    v->data = (u_char *) "http";
> +    v->len = r->schema.len;
> +    v->data = r->schema.data;
> 
>      return NGX_OK;
>  }
> 
> Thanks.

A similar patch has already been considered and rejected:
https://trac.nginx.org/nginx/ticket/1549#comment:5

See also https://trac.nginx.org/nginx/ticket/711.


More information about the nginx-devel mailing list