mirror of
https://github.com/nginx/nginx.git
synced 2025-07-20 19:27:29 +08:00
Merge 70c1e01dd9
into c52c5698cd
This commit is contained in:
commit
c9e706e2f4
@ -1045,6 +1045,8 @@ ngx_http_core_find_config_phase(ngx_http_request_t *r,
|
||||
ngx_memcpy(p, r->args.data, r->args.len);
|
||||
}
|
||||
|
||||
r->request_auto_redirect = 1;
|
||||
|
||||
ngx_http_finalize_request(r, NGX_HTTP_MOVED_PERMANENTLY);
|
||||
return NGX_OK;
|
||||
}
|
||||
|
@ -545,6 +545,7 @@ struct ngx_http_request_s {
|
||||
unsigned error_page:1;
|
||||
unsigned filter_finalize:1;
|
||||
unsigned post_action:1;
|
||||
unsigned request_auto_redirect:1;
|
||||
unsigned request_complete:1;
|
||||
unsigned request_output:1;
|
||||
unsigned header_sent:1;
|
||||
|
@ -93,6 +93,8 @@ static ngx_int_t ngx_http_variable_body_bytes_sent(ngx_http_request_t *r,
|
||||
ngx_http_variable_value_t *v, uintptr_t data);
|
||||
static ngx_int_t ngx_http_variable_pipe(ngx_http_request_t *r,
|
||||
ngx_http_variable_value_t *v, uintptr_t data);
|
||||
static ngx_int_t ngx_http_variable_request_auto_redirect(ngx_http_request_t *r,
|
||||
ngx_http_variable_value_t *v, uintptr_t data);
|
||||
static ngx_int_t ngx_http_variable_request_completion(ngx_http_request_t *r,
|
||||
ngx_http_variable_value_t *v, uintptr_t data);
|
||||
static ngx_int_t ngx_http_variable_request_body(ngx_http_request_t *r,
|
||||
@ -284,6 +286,10 @@ static ngx_http_variable_t ngx_http_core_variables[] = {
|
||||
{ ngx_string("pipe"), NULL, ngx_http_variable_pipe,
|
||||
0, 0, 0 },
|
||||
|
||||
{ ngx_string("request_auto_redirect"), NULL,
|
||||
ngx_http_variable_request_auto_redirect,
|
||||
0, 0, 0 },
|
||||
|
||||
{ ngx_string("request_completion"), NULL,
|
||||
ngx_http_variable_request_completion,
|
||||
0, 0, 0 },
|
||||
@ -2088,6 +2094,20 @@ ngx_http_variable_set_limit_rate(ngx_http_request_t *r,
|
||||
}
|
||||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_variable_request_auto_redirect(ngx_http_request_t *r,
|
||||
ngx_http_variable_value_t *v, uintptr_t data)
|
||||
{
|
||||
if (r->request_auto_redirect) {
|
||||
*v = ngx_http_variable_true_value;
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
*v = ngx_http_variable_null_value;
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_variable_request_completion(ngx_http_request_t *r,
|
||||
ngx_http_variable_value_t *v, uintptr_t data)
|
||||
|
Loading…
Reference in New Issue
Block a user