v0.27.0
This commit is contained in:
1 parent
a9f9450f80
commit
762eb9e28b
81 files changed
+1242
-1095
No files matched your search
@@ -284,29 +284,17 @@ async fn observe(State(state): State<Arc<App>>, mut request: Request, next: Next
|
||||
{
|
||||
response.headers_mut().remove("alt-svc");
|
||||
}
|
||||
// Cookie-bearing requests are normally excluded from compression to avoid
|
||||
// compressing potentially private dynamic content. The cache can explicitly
|
||||
// ignore cookies for configured static extensions, though; once that request
|
||||
// is a shared-cache HIT, cache policy has already proven the stored response
|
||||
// contains no Set-Cookie/private/no-store metadata. Local Web Server static
|
||||
// responses are equally independent of request cookies. Allow compression in
|
||||
// those two bounded cases so cached/static browser assets still negotiate
|
||||
// Content-Encoding.
|
||||
if original_headers.contains_key("cookie")
|
||||
&& (exchange.cache_status.load(Ordering::Relaxed) == 1
|
||||
|| response.extensions().get::<StaticSourceResponse>().is_some())
|
||||
{
|
||||
response
|
||||
.extensions_mut()
|
||||
.insert(crate::compression::AllowCookie);
|
||||
let global_compression = &snapshot.envelope.config.compression;
|
||||
let mut compression = global_compression.clone();
|
||||
if let Some(frontend) = frontend_context.as_ref() {
|
||||
compression = frontend.compression.resolve(global_compression, &compression);
|
||||
}
|
||||
response = crate::compression::encode(
|
||||
response,
|
||||
&original_headers,
|
||||
&method,
|
||||
&snapshot.envelope.config.compression,
|
||||
)
|
||||
.await;
|
||||
if let Some(route) = route_context.as_ref() {
|
||||
if let crate::config::CompiledSource::WebServer(service) = &route.source {
|
||||
compression = service.compression.resolve(global_compression, &compression);
|
||||
}
|
||||
}
|
||||
response = crate::compression::encode(response, &original_headers, &method, &compression).await;
|
||||
if let Some(encoding) = response
|
||||
.extensions()
|
||||
.get::<crate::compression::AppliedEncoding>()
|
||||
|
||||
Reference in new issue
Block a user