diff options
author | Matthew Gumport <[email protected]> | 2024-10-21 14:55:19 -0700 |
---|---|---|
committer | Kevin Guthrie <[email protected]> | 2024-10-28 11:51:38 -0400 |
commit | fafc38ac59e9539cdfe04f21f4b1e98fa954559e (patch) | |
tree | 474f05c737383aa87df69164f7066ee5008020d8 /pingora-proxy/src/proxy_cache.rs | |
parent | 80541d19801ef54417434d2d28b87d932c8d36f6 (diff) | |
download | pingora-fafc38ac59e9539cdfe04f21f4b1e98fa954559e.tar.gz pingora-fafc38ac59e9539cdfe04f21f4b1e98fa954559e.zip |
change `CachePut::cacheable` to own `ResponseHeader`
This changes the `CachePut` trait to take ownership of the response
header. We have a use-case for mutating the headers as we process the
response, and we would like to avoid copying them in order to do so.
Diffstat (limited to 'pingora-proxy/src/proxy_cache.rs')
-rw-r--r-- | pingora-proxy/src/proxy_cache.rs | 6 |
1 files changed, 3 insertions, 3 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) { |