comparison src/http/ngx_http_upstream.c @ 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 60fde1bc7236
children 973ee2276300
comparison
equal deleted inserted replaced
5877:60fde1bc7236 5878:2c89956b6a76
4158 4158
4159 if (u->conf->ignore_headers & NGX_HTTP_UPSTREAM_IGN_VARY) { 4159 if (u->conf->ignore_headers & NGX_HTTP_UPSTREAM_IGN_VARY) {
4160 return NGX_OK; 4160 return NGX_OK;
4161 } 4161 }
4162 4162
4163 u->cacheable = 0; 4163 if (r->cache == NULL) {
4164 return NGX_OK;
4165 }
4166
4167 if (h->value.len > NGX_HTTP_CACHE_VARY_LEN
4168 || (h->value.len == 1 && h->value.data[0] == '*'))
4169 {
4170 u->cacheable = 0;
4171 }
4172
4173 r->cache->vary = h->value;
4164 4174
4165 #endif 4175 #endif
4166 4176
4167 return NGX_OK; 4177 return NGX_OK;
4168 } 4178 }