mirror of
https://github.com/nginx/nginx.git
synced 2024-11-28 11:43:51 -06:00
Added the $https variable.
This commit is contained in:
parent
df54c36d90
commit
247332a1e2
@ -48,6 +48,8 @@ static ngx_int_t ngx_http_variable_server_port(ngx_http_request_t *r,
|
||||
ngx_http_variable_value_t *v, uintptr_t data);
|
||||
static ngx_int_t ngx_http_variable_scheme(ngx_http_request_t *r,
|
||||
ngx_http_variable_value_t *v, uintptr_t data);
|
||||
static ngx_int_t ngx_http_variable_https(ngx_http_request_t *r,
|
||||
ngx_http_variable_value_t *v, uintptr_t data);
|
||||
static ngx_int_t ngx_http_variable_is_args(ngx_http_request_t *r,
|
||||
ngx_http_variable_value_t *v, uintptr_t data);
|
||||
static ngx_int_t ngx_http_variable_document_root(ngx_http_request_t *r,
|
||||
@ -157,6 +159,8 @@ static ngx_http_variable_t ngx_http_core_variables[] = {
|
||||
|
||||
{ ngx_string("scheme"), NULL, ngx_http_variable_scheme, 0, 0, 0 },
|
||||
|
||||
{ ngx_string("https"), NULL, ngx_http_variable_https, 0, 0, 0 },
|
||||
|
||||
{ ngx_string("request_uri"), NULL, ngx_http_variable_request,
|
||||
offsetof(ngx_http_request_t, unparsed_uri), 0, 0 },
|
||||
|
||||
@ -1090,6 +1094,30 @@ ngx_http_variable_scheme(ngx_http_request_t *r,
|
||||
}
|
||||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_variable_https(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("on") - 1;
|
||||
v->valid = 1;
|
||||
v->no_cacheable = 0;
|
||||
v->not_found = 0;
|
||||
v->data = (u_char *) "on";
|
||||
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
*v = ngx_http_variable_null_value;
|
||||
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_variable_is_args(ngx_http_request_t *r,
|
||||
ngx_http_variable_value_t *v, uintptr_t data)
|
||||
|
Loading…
Reference in New Issue
Block a user