diff options
| author | David Url <david@urld.io> | 2018-08-23 17:28:59 +0200 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2018-10-03 15:29:15 +0000 |
| commit | 0df9fa2ebec975359c8ee1150ecf7f28f12b39ee (patch) | |
| tree | 6f2d53b6454b9e49136d9f078c2b594ea0bf0355 /src/net/http/clientserver_test.go | |
| parent | b8ac64a581b1e8e033cd7c9919d7dcf8fb16d17b (diff) | |
| download | go-0df9fa2ebec975359c8ee1150ecf7f28f12b39ee.tar.xz | |
net/http: log call site which causes multiple header writes
If an illegal header write is detected, find the first caller outside of
net/http using runtime.CallersFrames and include the call site in the log
message.
Fixes #18761
Change-Id: I92be00ac206c6ebdd60344ad7bf40a7c4c188547
Reviewed-on: https://go-review.googlesource.com/c/130997
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/net/http/clientserver_test.go')
| -rw-r--r-- | src/net/http/clientserver_test.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/net/http/clientserver_test.go b/src/net/http/clientserver_test.go index 3e88c64b6f..465bae1478 100644 --- a/src/net/http/clientserver_test.go +++ b/src/net/http/clientserver_test.go @@ -1474,11 +1474,11 @@ func testWriteHeaderAfterWrite(t *testing.T, h2, hijack bool) { return } gotLog := strings.TrimSpace(errorLog.String()) - wantLog := "http: multiple response.WriteHeader calls" + wantLog := "http: superfluous response.WriteHeader call from net/http_test.testWriteHeaderAfterWrite.func1 (clientserver_test.go:" if hijack { - wantLog = "http: response.WriteHeader on hijacked connection" + wantLog = "http: response.WriteHeader on hijacked connection from net/http_test.testWriteHeaderAfterWrite.func1 (clientserver_test.go:" } - if gotLog != wantLog { + if !strings.HasPrefix(gotLog, wantLog) { t.Errorf("stderr output = %q; want %q", gotLog, wantLog) } } |
