Mercurial > hg > nginx-quic
diff src/http/ngx_http_cache.h @ 5878:2c89956b6a76
Cache: hash of Vary headers now stored in cache.
To cache responses with Vary, we now calculate hash of headers listed
in Vary, and return the response from cache only if new request headers
match.
As of now, only one variant of the same resource can be stored in cache.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 27 Oct 2014 21:13:58 +0300 |
parents | 44b9ab7752e3 |
children | c525c0454aa5 |
line wrap: on
line diff
--- a/src/http/ngx_http_cache.h +++ b/src/http/ngx_http_cache.h @@ -25,8 +25,9 @@ #define NGX_HTTP_CACHE_KEY_LEN 16 #define NGX_HTTP_CACHE_ETAG_LEN 42 +#define NGX_HTTP_CACHE_VARY_LEN 42 -#define NGX_HTTP_CACHE_VERSION 2 +#define NGX_HTTP_CACHE_VERSION 3 typedef struct { @@ -71,6 +72,8 @@ struct ngx_http_cache_s { time_t date; ngx_str_t etag; + ngx_str_t vary; + u_char variant[NGX_HTTP_CACHE_KEY_LEN]; size_t header_start; size_t body_start; @@ -112,6 +115,9 @@ typedef struct { u_short body_start; u_char etag_len; u_char etag[NGX_HTTP_CACHE_ETAG_LEN]; + u_char vary_len; + u_char vary[NGX_HTTP_CACHE_VARY_LEN]; + u_char variant[NGX_HTTP_CACHE_KEY_LEN]; } ngx_http_file_cache_header_t;