From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 8614C1F5AD for ; Sun, 5 Apr 2020 01:28:49 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] wwwstatic: set "Vary: Accept-Encoding" in static gzip response Date: Sun, 5 Apr 2020 01:28:49 +0000 Message-Id: <20200405012849.4857-1-e@yhbt.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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; }