From a00d33f2bd4df26de34007601004f89468470480 Mon Sep 17 00:00:00 2001 From: hladu357 Date: Wed, 15 May 2024 16:16:58 +0200 Subject: [PATCH] working --- http_key_header_module.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/http_key_header_module.c b/http_key_header_module.c index b03cf75..fb71a86 100644 --- a/http_key_header_module.c +++ b/http_key_header_module.c @@ -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); } \ No newline at end of file