working
This commit is contained in:
parent
a3f3b143f4
commit
a00d33f2bd
|
@ -104,5 +104,22 @@ ngx_module_t ngx_http_key_header_module =
|
|||
static ngx_int_t
|
||||
ngx_http_key_header_filter(ngx_http_request_t *r )
|
||||
{
|
||||
if(r->loc_conf != NULL) {
|
||||
ngx_http_key_header_loc_conf_t *conf = ngx_http_get_module_loc_conf(r, ngx_http_key_header_module);
|
||||
if(conf->enabled) {
|
||||
ngx_table_elt_t *h;
|
||||
h = ngx_list_push(&r->headers_out.headers);
|
||||
if(h == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
u_char hexKey[2 * NGX_HTTP_CACHE_KEY_LEN + 1];
|
||||
ngx_hex_dump(hexKey, r->cache->key, NGX_HTTP_CACHE_KEY_LEN);
|
||||
|
||||
h->hash = 1;
|
||||
ngx_str_set(&h->key, "X-Cache-Key");
|
||||
ngx_str_set(&h->value, hexKey);
|
||||
}
|
||||
}
|
||||
return ngx_http_next_header_filter(r);
|
||||
}
|
Loading…
Reference in New Issue