From d96bddeabb7dd52dad73eed021e69ddd2b67b39c Mon Sep 17 00:00:00 2001 From: Marcus Weiner Date: Wed, 24 Jun 2020 16:38:44 +0200 Subject: [PATCH 1/2] Fix panic with specific If-None-Match value --- src/net/http/fs.go | 1 + 1 file changed, 1 insertion(+) diff --git a/src/net/http/fs.go b/src/net/http/fs.go index 07d15b07e92f11..922706ada14815 100644 --- a/src/net/http/fs.go +++ b/src/net/http/fs.go @@ -413,6 +413,7 @@ func checkIfNoneMatch(w ResponseWriter, r *Request) condResult { } if buf[0] == ',' { buf = buf[1:] + continue } if buf[0] == '*' { return condFalse From 5b88aada219aaa2af0c7e1969ed6fa646117d9da Mon Sep 17 00:00:00 2001 From: Marcus Weiner Date: Wed, 24 Jun 2020 17:23:52 +0200 Subject: [PATCH 2/2] Test malformed header --- src/net/http/fs_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/net/http/fs_test.go b/src/net/http/fs_test.go index 435e34be3af080..c082ceee71b30a 100644 --- a/src/net/http/fs_test.go +++ b/src/net/http/fs_test.go @@ -849,6 +849,15 @@ func TestServeContent(t *testing.T) { wantStatus: 200, wantContentType: "text/css; charset=utf-8", }, + "if_none_match_malformed": { + file: "testdata/style.css", + serveETag: `"foo"`, + reqHeader: map[string]string{ + "If-None-Match": `,`, + }, + wantStatus: 200, + wantContentType: "text/css; charset=utf-8", + }, "range_good": { file: "testdata/style.css", serveETag: `"A"`,