net/http: fix ineffective break in etag scanning

In particular, this lead to the code accepting invalid ETags as long as
they finished with a '"'.

Also remove a duplicate test case.

Change-Id: Id59db3ebc4e4969562f891faef29111e77ee0e65
Reviewed-on: https://go-review.googlesource.com/39690
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Daniel Martí 2017-04-06 12:24:58 +01:00
parent 0bae9b083b
commit 2c1888bf48
2 changed files with 2 additions and 2 deletions

View file

@ -1264,10 +1264,10 @@ func Test_scanETag(t *testing.T) {
{`"etag-2"`, `"etag-2"`, ""},
{`"etag-1", "etag-2"`, `"etag-1"`, `, "etag-2"`},
{"", "", ""},
{"", "", ""},
{"W/", "", ""},
{`W/"truc`, "", ""},
{`w/"case-sensitive"`, "", ""},
{`"spaced etag"`, "", ""},
}
for _, test := range tests {
etag, remain := ExportScanETag(test.in)