]> Cypherpunks repositories - gostls13.git/commit
net/http: Don't set Content-Length: -1 when responding to a POST
authorPeter Waldschmidt <peter@waldschmidt.com>
Wed, 29 Apr 2015 20:59:38 +0000 (16:59 -0400)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 29 Apr 2015 22:58:37 +0000 (22:58 +0000)
commit632778c3a397f348cc21bc6e3baaf30911827cb5
tree31381482855bd056d251b27bcb90ed9e79419a18
parentafd2d2b6df3ebfe99faf347030f15adfdf422fa0
net/http: Don't set Content-Length: -1 when responding to a POST

Fixes an issue where Response.Write writes out a Content-Length: -1
header when the corresponding Request is a POST or PUT and the
ContentLength was not previously set.

This was encountered when using httputil.DumpResponse
to write out the response from a server that responded to a PUT
request with no Content-Length header. The dumped output is
thus invalid.

Change-Id: I52c6ae8ef3443f1f9de92aeee9f9581dabb05991
Reviewed-on: https://go-review.googlesource.com/9496
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
src/net/http/responsewrite_test.go
src/net/http/transfer.go