diff options
Diffstat (limited to 'pingora-proxy')
-rw-r--r-- | pingora-proxy/src/proxy_cache.rs | 6 | ||||
-rw-r--r-- | pingora-proxy/tests/utils/server_utils.rs | 7 |
2 files changed, 9 insertions, 4 deletions
diff --git a/pingora-proxy/src/proxy_cache.rs b/pingora-proxy/src/proxy_cache.rs index 865c592..ed611f8 100644 --- a/pingora-proxy/src/proxy_cache.rs +++ b/pingora-proxy/src/proxy_cache.rs @@ -442,7 +442,7 @@ impl<SV> HttpProxy<SV> { // the request to fail when the chunked response exceeds the maximum // file size again. if session.cache.max_file_size_bytes().is_some() - && !header.headers.contains_key(header::CONTENT_LENGTH) + && !meta.headers().contains_key(header::CONTENT_LENGTH) { session.cache.disable(NoCacheReason::ResponseTooLarge); return Ok(()); @@ -450,7 +450,7 @@ impl<SV> HttpProxy<SV> { session.cache.response_became_cacheable(); - if header.status == StatusCode::OK { + if meta.response_header().status == StatusCode::OK { self.inner.cache_miss(session, ctx); } else { // we've allowed caching on the next request, @@ -467,7 +467,7 @@ impl<SV> HttpProxy<SV> { // on the cache, validate that the response does not exceed the maximum asset size. if session.cache.enabled() { if let Some(max_file_size) = session.cache.max_file_size_bytes() { - let content_length_hdr = header.headers.get(header::CONTENT_LENGTH); + let content_length_hdr = meta.headers().get(header::CONTENT_LENGTH); if let Some(content_length) = header_value_content_length(content_length_hdr) { diff --git a/pingora-proxy/tests/utils/server_utils.rs b/pingora-proxy/tests/utils/server_utils.rs index 62b5882..1f19a16 100644 --- a/pingora-proxy/tests/utils/server_utils.rs +++ b/pingora-proxy/tests/utils/server_utils.rs @@ -463,7 +463,12 @@ impl ProxyHttp for ExampleProxyCache { _ctx: &mut Self::CTX, ) -> Result<RespCacheable> { let cc = CacheControl::from_resp_headers(resp); - Ok(resp_cacheable(cc.as_ref(), resp, false, &CACHE_DEFAULT)) + Ok(resp_cacheable( + cc.as_ref(), + resp.clone(), + false, + &CACHE_DEFAULT, + )) } fn upstream_response_filter( |