diff options
Diffstat (limited to 'src/http/ngx_http_variables.c')
-rw-r--r-- | src/http/ngx_http_variables.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/http/ngx_http_variables.c b/src/http/ngx_http_variables.c index 1370162c1..261592978 100644 --- a/src/http/ngx_http_variables.c +++ b/src/http/ngx_http_variables.c @@ -44,6 +44,8 @@ static ngx_int_t ngx_http_variable_remote_user(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data); 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_request_completion(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data); /* @@ -135,6 +137,9 @@ static ngx_http_variable_t ngx_http_core_variables[] = { { ngx_string("body_bytes_sent"), ngx_http_variable_body_bytes_sent, 0, 0, 0 }, + { ngx_string("request_completion"), ngx_http_variable_request_completion, + 0, 0, 0 }, + { ngx_null_string, NULL, 0, 0, 0 } }; @@ -798,6 +803,30 @@ ngx_http_variable_body_bytes_sent(ngx_http_request_t *r, } +static ngx_int_t +ngx_http_variable_request_completion(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data) +{ + if (r->request_complete) { + v->len = 2; + v->valid = 1; + v->no_cachable = 0; + v->not_found = 0; + v->data = (u_char *) "OK"; + + return NGX_OK; + } + + v->len = 0; + v->valid = 1; + v->no_cachable = 0; + v->not_found = 0; + v->data = (u_char *) ""; + + return NGX_OK; +} + + ngx_int_t ngx_http_variables_add_core_vars(ngx_conf_t *cf) { |