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

Issue 12632043: code review 12632043: net/http: fix early side effects in the ResponseWriter'... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 9 months ago by bradfitz
Modified:
10 years, 9 months ago
Reviewers:
rsc
CC:
golang-dev, rsc, ioe
Visibility:
Public.

Description

net/http: fix early side effects in the ResponseWriter's ReadFrom The ResponseWriter's ReadFrom method was causing side effects on the output before any data was read. Now, bail out early and do a normal copy (which does a read before writing) when our input and output are known to not to be the pair of types we need for sendfile. Fixes issue 5660

Patch Set 1 #

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

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

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

Patch Set 5 : diff -r 08caa64606f9 https://go.googlecode.com/hg/ #

Total comments: 2

Patch Set 6 : diff -r c6b37ee14a9f https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+83 lines, -8 lines) Patch
M src/pkg/net/http/serve_test.go View 1 2 3 1 chunk +45 lines, -0 lines 0 comments Download
M src/pkg/net/http/server.go View 1 2 3 3 chunks +38 lines, -8 lines 0 comments Download

Messages

Total messages: 18
bradfitz
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://go.googlecode.com/hg/
10 years, 9 months ago (2013-08-07 22:53:46 UTC) #1
rsc
Hmm. To work around a bad interaction between io.Copy and an http.ResponseWriter, we're making a ...
10 years, 9 months ago (2013-08-07 23:25:23 UTC) #2
bradfitz
Suggestions welcome. On Wed, Aug 7, 2013 at 4:25 PM, Russ Cox <rsc@golang.org> wrote: > ...
10 years, 9 months ago (2013-08-07 23:27:28 UTC) #3
rsc
It is possible that, now that we understand what is going on, issue 5660 is ...
10 years, 9 months ago (2013-08-07 23:28:57 UTC) #4
bradfitz
On Wed, Aug 7, 2013 at 4:28 PM, Russ Cox <rsc@golang.org> wrote: > It is ...
10 years, 9 months ago (2013-08-07 23:32:45 UTC) #5
rsc
On Wed, Aug 7, 2013 at 7:32 PM, Brad Fitzpatrick <bradfitz@golang.org>wrote: > >> It is ...
10 years, 9 months ago (2013-08-07 23:56:52 UTC) #6
bradfitz
On Wed, Aug 7, 2013 at 4:56 PM, Russ Cox <rsc@golang.org> wrote: > On Wed, ...
10 years, 9 months ago (2013-08-08 00:01:17 UTC) #7
rsc
On Wed, Aug 7, 2013 at 8:01 PM, Brad Fitzpatrick <bradfitz@golang.org>wrote: > Can I keep ...
10 years, 9 months ago (2013-08-08 00:02:46 UTC) #8
bradfitz
On Wed, Aug 7, 2013 at 5:02 PM, Russ Cox <rsc@golang.org> wrote: > On Wed, ...
10 years, 9 months ago (2013-08-08 00:05:51 UTC) #9
bradfitz
Hello golang-dev@googlegroups.com, rsc@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
10 years, 9 months ago (2013-08-08 02:45:48 UTC) #10
bradfitz
PTAL Now without any os/exec changes. On Wed, Aug 7, 2013 at 7:45 PM, <bradfitz@golang.org> ...
10 years, 9 months ago (2013-08-08 02:46:53 UTC) #11
ioe
On Thursday, August 8, 2013 2:05:49 AM UTC+2, Brad Fitzpatrick wrote: > On Wed, Aug ...
10 years, 9 months ago (2013-08-08 15:05:19 UTC) #12
rsc
On Wed, Aug 7, 2013 at 8:05 PM, Brad Fitzpatrick <bradfitz@golang.org>wrote: > Sure, that works. ...
10 years, 9 months ago (2013-08-08 16:08:31 UTC) #13
bradfitz
I'm happy statting. On Aug 8, 2013 9:08 AM, "Russ Cox" <rsc@golang.org> wrote: > On ...
10 years, 9 months ago (2013-08-08 16:19:51 UTC) #14
bradfitz
Russ, This cool? On Wed, Aug 7, 2013 at 7:46 PM, Brad Fitzpatrick <bradfitz@golang.org>wrote: > ...
10 years, 9 months ago (2013-08-08 20:35:44 UTC) #15
rsc
LGTM https://codereview.appspot.com/12632043/diff/19001/src/pkg/net/http/server.go File src/pkg/net/http/server.go (right): https://codereview.appspot.com/12632043/diff/19001/src/pkg/net/http/server.go#newcode381 src/pkg/net/http/server.go:381: if !ok || !regFile { you could possibly ...
10 years, 9 months ago (2013-08-08 20:54:40 UTC) #16
bradfitz
https://codereview.appspot.com/12632043/diff/19001/src/pkg/net/http/server.go File src/pkg/net/http/server.go (right): https://codereview.appspot.com/12632043/diff/19001/src/pkg/net/http/server.go#newcode381 src/pkg/net/http/server.go:381: if !ok || !regFile { On 2013/08/08 20:54:40, rsc ...
10 years, 9 months ago (2013-08-08 20:58:08 UTC) #17
bradfitz
10 years, 9 months ago (2013-08-08 21:03:02 UTC) #18
*** Submitted as https://code.google.com/p/go/source/detail?r=f53cee5f15de ***

net/http: fix early side effects in the ResponseWriter's ReadFrom

The ResponseWriter's ReadFrom method was causing side effects on
the output before any data was read.

Now, bail out early and do a normal copy (which does a read
before writing) when our input and output are known to not to
be the pair of types we need for sendfile.

Fixes issue 5660

R=golang-dev, rsc, nightlyone
CC=golang-dev
https://codereview.appspot.com/12632043
Sign in to reply to this message.

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