75 | 75 |
static ngx_int_t ngx_http_variable_request_body(ngx_http_request_t *r,
|
76 | 76 |
ngx_http_variable_value_t *v, uintptr_t data);
|
77 | 77 |
static ngx_int_t ngx_http_variable_request_body_file(ngx_http_request_t *r,
|
|
78 |
ngx_http_variable_value_t *v, uintptr_t data);
|
|
79 |
static ngx_int_t ngx_http_variable_status(ngx_http_request_t *r,
|
78 | 80 |
ngx_http_variable_value_t *v, uintptr_t data);
|
79 | 81 |
|
80 | 82 |
static ngx_int_t ngx_http_variable_sent_content_type(ngx_http_request_t *r,
|
|
224 | 226 |
ngx_http_variable_request_body_file,
|
225 | 227 |
0, 0, 0 },
|
226 | 228 |
|
|
229 |
{ ngx_string("status"), NULL,
|
|
230 |
ngx_http_variable_status, 0,
|
|
231 |
NGX_HTTP_VAR_NOCACHEABLE, 0 },
|
|
232 |
|
227 | 233 |
{ ngx_string("sent_http_content_type"), NULL,
|
228 | 234 |
ngx_http_variable_sent_content_type, 0, 0, 0 },
|
229 | 235 |
|
|
1449 | 1455 |
v->no_cacheable = 0;
|
1450 | 1456 |
v->not_found = 0;
|
1451 | 1457 |
v->data = p;
|
|
1458 |
|
|
1459 |
return NGX_OK;
|
|
1460 |
}
|
|
1461 |
|
|
1462 |
|
|
1463 |
static ngx_int_t
|
|
1464 |
ngx_http_variable_status(ngx_http_request_t *r,
|
|
1465 |
ngx_http_variable_value_t *v, uintptr_t data)
|
|
1466 |
{
|
|
1467 |
ngx_uint_t status;
|
|
1468 |
|
|
1469 |
v->data = ngx_pnalloc(r->pool, NGX_INT_T_LEN);
|
|
1470 |
if (v->data == NULL) {
|
|
1471 |
return NGX_ERROR;
|
|
1472 |
}
|
|
1473 |
|
|
1474 |
if (r->err_status) {
|
|
1475 |
status = r->err_status;
|
|
1476 |
|
|
1477 |
} else if (r->headers_out.status) {
|
|
1478 |
status = r->headers_out.status;
|
|
1479 |
|
|
1480 |
} else if (r->http_version == NGX_HTTP_VERSION_9) {
|
|
1481 |
status = 9;
|
|
1482 |
|
|
1483 |
} else {
|
|
1484 |
status = 0;
|
|
1485 |
}
|
|
1486 |
|
|
1487 |
v->len = ngx_sprintf(v->data, "%03ui", status) - v->data;
|
|
1488 |
v->valid = 1;
|
|
1489 |
v->no_cacheable = 0;
|
|
1490 |
v->not_found = 0;
|
1452 | 1491 |
|
1453 | 1492 |
return NGX_OK;
|
1454 | 1493 |
}
|