Skip to content

Commit e19af0f

Browse files
mraerinodmitshur
authored andcommitted
[release-branch.go1.13] net/http: fix panic with If-None-Match value in http.ServeContent
Updates #39817. Fixes #39925. Change-Id: I79f2ad7c836a8a46569f603aca583fdd526d22dc GitHub-Last-Rev: 5b88aad GitHub-Pull-Request: #39821 Reviewed-on: https://go-review.googlesource.com/c/go/+/239699 Run-TryBot: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]> (cherry picked from commit ce81a8f) Reviewed-on: https://go-review.googlesource.com/c/go/+/242077 Run-TryBot: Dmitri Shuralyov <[email protected]> Reviewed-by: Marcus Weiner <[email protected]> Reviewed-by: Emmanuel Odeke <[email protected]>
1 parent 3c1722c commit e19af0f

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/net/http/fs.go

+1
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,7 @@ func checkIfNoneMatch(w ResponseWriter, r *Request) condResult {
408408
}
409409
if buf[0] == ',' {
410410
buf = buf[1:]
411+
continue
411412
}
412413
if buf[0] == '*' {
413414
return condFalse

src/net/http/fs_test.go

+9
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,15 @@ func TestServeContent(t *testing.T) {
837837
wantStatus: 200,
838838
wantContentType: "text/css; charset=utf-8",
839839
},
840+
"if_none_match_malformed": {
841+
file: "testdata/style.css",
842+
serveETag: `"foo"`,
843+
reqHeader: map[string]string{
844+
"If-None-Match": `,`,
845+
},
846+
wantStatus: 200,
847+
wantContentType: "text/css; charset=utf-8",
848+
},
840849
"range_good": {
841850
file: "testdata/style.css",
842851
serveETag: `"A"`,

0 commit comments

Comments
 (0)