|
|
|
net/http/httputil: ensure DumpRequestOut dump all of Body
Force a read of Body so requests larger than the buffer
are read completely and hence captured correctly.
Fixes issue 8089.
Patch Set 1 #Patch Set 2 : diff -r 0ba5ecac8038 https://code.google.com/p/go #
Total comments: 2
Patch Set 3 : diff -r 0ba5ecac8038 https://code.google.com/p/go #
Total comments: 1
Total messages: 5
|
bradfitz
https://codereview.appspot.com/92590043/diff/20001/src/pkg/net/http/httputil/dump.go File src/pkg/net/http/httputil/dump.go (right): https://codereview.appspot.com/92590043/diff/20001/src/pkg/net/http/httputil/dump.go#newcode104 src/pkg/net/http/httputil/dump.go:104: ioutil.ReadAll(req.Body) no need to read it to memory. just: ...
|
11 years, 7 months ago (2014年06月04日 20:50:01 UTC) #1 | ||||||||||||||||||||||
https://codereview.appspot.com/92590043/diff/20001/src/pkg/net/http/httputil/... File src/pkg/net/http/httputil/dump.go (right): https://codereview.appspot.com/92590043/diff/20001/src/pkg/net/http/httputil/... src/pkg/net/http/httputil/dump.go:104: ioutil.ReadAll(req.Body) no need to read it to memory. just: io.Copy(ioutil.Discard, req.Body) https://codereview.appspot.com/92590043/diff/20001/src/pkg/net/http/httputil/... File src/pkg/net/http/httputil/dump_test.go (right): https://codereview.appspot.com/92590043/diff/20001/src/pkg/net/http/httputil/... src/pkg/net/http/httputil/dump_test.go:188: func sizedBody(s string, l int) []byte { This could just be: // sizedBody returns a string of length l containing s repeatedly. func sizedBody(s string, l int) string{ return strings.Repeat(s, l/len(s)+1)[:l] }
please run 'hg mail' if you want to continue this review
Hello bradfitz@golang.org, rsc@golang.org (cc: golang-codereviews@googlegroups.com), I'd like you to review this change to https://code.google.com/p/go
https://codereview.appspot.com/92590043/diff/40001/src/pkg/net/http/httputil/... File src/pkg/net/http/httputil/dump_test.go (right): https://codereview.appspot.com/92590043/diff/40001/src/pkg/net/http/httputil/... src/pkg/net/http/httputil/dump_test.go:189: return strings.Repeat(s, l/len(s)+1)[:l] this doesn't even compile. Please fix and verify your test actually passes. Please note you'll need to update the CL to change the files to be at src/net/http/httputil/* now. The "pkg" directory in has been removed. (src/pkg is now just src)
R=close I've taken over this fix in 144650044. Even with the strings/[]byte fix to make it compile, the tests didn't pass. Please test that code compiles & passes tests before sending reviews in the future. Thanks for identifying the problem area, though.