user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* [PATCH] wwwstatic: set "Vary: Accept-Encoding" in static gzip response
@ 2020-04-05  1:28 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2020-04-05  1:28 UTC (permalink / raw)
  To: meta

We don't want to confuse intermediate caches into serving
gzipped content to any clients which can't handle it.  It
probably doesn't matter in practice, though, since every HTTP
client seems to handle "Content-Encoding: gzip" regardless of
whether it was requested or not, though I could expect some
nc/socat/telnet/s_client users being annoyed.

This also matches the behavior of Plack::Middleware::Deflater
and other deflater implementations.
---
 lib/PublicInbox/WwwStatic.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/WwwStatic.pm b/lib/PublicInbox/WwwStatic.pm
index 0c534b46..3c933156 100644
--- a/lib/PublicInbox/WwwStatic.pm
+++ b/lib/PublicInbox/WwwStatic.pm
@@ -117,7 +117,9 @@ sub try_gzip_static ($$$$) {
 	return unless -f $gz && (stat(_))[9] == $mtime;
 	my $res = response($env, $h, $gz, $type);
 	return if ($res->[0] > 300 || $res->[0] < 200);
-	push @{$res->[1]}, qw(Cache-Control no-transform Content-Encoding gzip);
+	push @{$res->[1]}, qw(Cache-Control no-transform
+				Content-Encoding gzip
+				Vary Accept-Encoding);
 	$res;
 }
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-04-05  1:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-05  1:28 [PATCH] wwwstatic: set "Vary: Accept-Encoding" in static gzip response Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).