]> Cypherpunks repositories - gostls13.git/commit
net/http: ignore 100-continue responses in Transport
authorBrad Fitzpatrick <bradfitz@golang.org>
Sat, 30 Mar 2013 03:25:11 +0000 (20:25 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Sat, 30 Mar 2013 03:25:11 +0000 (20:25 -0700)
commita79df7bb20c7c19bebfd35674bf686129d7f079f
treec178b91f166653869a8b0a16febe5e53b3ee583f
parent3197be48078311368d5a37a89c61bbd47e00622f
net/http: ignore 100-continue responses in Transport

"There are only two hard problems in computer science:
cache invalidation, naming things, and off-by-one errors."

The HTTP server code already strips Expect: 100-continue on
requests, so httputil.ReverseProxy should be unaffected, but
some servers send unsolicited HTTP/1.1 100 Continue responses,
so we need to skip over them if they're seen to avoid getting
off-by-one on Transport requests/responses.

This does change the behavior of people who were using Client
or Transport directly and explicitly setting "Expect: 100-continue"
themselves, but it didn't work before anyway. Now instead of the
user code seeing a 100 response and then things blowing up, now
it basically works, except the Transport will still blast away
the full request body immediately.  That's the part that needs
to be finished to close this issue.

This is the safe quick fix.

Update #3665

R=golang-dev, dsymonds, dave, jgrahamc
CC=golang-dev
https://golang.org/cl/8166045
src/pkg/net/http/transport.go
src/pkg/net/http/transport_test.go