Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4624)

Issue 8166045: code review 8166045: net/http: ignore 100-continue responses in Transport (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years ago by bradfitz
Modified:
11 years ago
CC:
golang-dev, dsymonds, dfc, jgc
Visibility:
Public.

Description

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 Issue 3665

Patch Set 1 #

Patch Set 2 : diff -r 192e257c6507 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 192e257c6507 https://go.googlecode.com/hg/ #

Total comments: 2

Patch Set 4 : diff -r f248b961193a https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+102 lines, -0 lines) Patch
M src/pkg/net/http/transport.go View 1 2 3 1 chunk +8 lines, -0 lines 0 comments Download
M src/pkg/net/http/transport_test.go View 1 2 chunks +94 lines, -0 lines 0 comments Download

Messages

Total messages: 9
bradfitz
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://go.googlecode.com/hg/
11 years ago (2013-03-30 00:04:33 UTC) #1
bradfitz
Don't be afraid of the CL size. It's all test. The actual fix is tiny: ...
11 years ago (2013-03-30 00:06:46 UTC) #2
dsymonds
LGTM But drop the second "actually" in the comment.
11 years ago (2013-03-30 00:20:43 UTC) #3
dfc
+cc jgc as the CloudFlare folks must hate 100-Continue as much as I do.
11 years ago (2013-03-30 00:53:44 UTC) #4
dfc
https://codereview.appspot.com/8166045/diff/4003/src/pkg/net/http/transport_test.go File src/pkg/net/http/transport_test.go (right): https://codereview.appspot.com/8166045/diff/4003/src/pkg/net/http/transport_test.go#newcode1411 src/pkg/net/http/transport_test.go:1411: registerPipe := func(pw *io.PipeWriter) { I like this local ...
11 years ago (2013-03-30 01:10:08 UTC) #5
bradfitz
*** Submitted as https://code.google.com/p/go/source/detail?r=466040fd273e *** net/http: ignore 100-continue responses in Transport "There are only two ...
11 years ago (2013-03-30 03:25:19 UTC) #6
albert.strasheim
Hello On 2013/03/30 03:25:19, bradfitz wrote: > *** Submitted as https://code.google.com/p/go/source/detail?r=466040fd273e *** > net/http: ignore ...
11 years ago (2013-03-30 05:32:51 UTC) #7
swhite
LGTM. This should fix my off-by-one issue on keep-alives with 100's in the response stream.
11 years ago (2013-03-30 16:41:39 UTC) #8
bradfitz
11 years ago (2013-03-30 16:51:08 UTC) #9
On Fri, Mar 29, 2013 at 10:32 PM, <fullung@gmail.com> wrote:

> Hello
>
>
> On 2013/03/30 03:25:19, bradfitz wrote:
>
>> *** Submitted as
>>
>
https://code.google.com/p/go/**source/detail?r=466040fd273e<https://code.goog...
>
>> net/http: ignore 100-continue responses in Transport
>>
>
> Seeing quite a few of these on linux/386:
>
> --- FAIL: TestTransportReading100Continu**e-74 (0.00 seconds)
> transport_test.go:1484: Do (i=3): Post http://dummy.tld/: malformed HTTP
> status code "/"
> transport_test.go:1437: EOF
> FAIL
>

I can reproduce.

Sorry. One day I'll be able to write a test that works on your systems on
the first try.

Trying to figure out the fix now.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b