diff options
author | Russ Cox <rsc@golang.org> | 2011-07-15 12:07:37 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2011-07-15 12:07:37 -0400 |
commit | e07c6e6ee78c20b78981591ebc2d0b6cb4094b21 (patch) | |
tree | 24f0fd67c7eb5a57d2cca223a9117041ce82ef3c | |
parent | 4c6280b0f1afd82b2c249fb5a8903d5b5ae54063 (diff) | |
download | go-e07c6e6ee78c20b78981591ebc2d0b6cb4094b21.tar.gz go-e07c6e6ee78c20b78981591ebc2d0b6cb4094b21.zip |
http: fixes for sniffing
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4753044
-rw-r--r-- | src/pkg/http/server.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pkg/http/server.go b/src/pkg/http/server.go index d71a24959a..ca9ab64742 100644 --- a/src/pkg/http/server.go +++ b/src/pkg/http/server.go @@ -131,7 +131,7 @@ func (r *response) ReadFrom(src io.Reader) (n int64, err os.Error) { // WriteHeader if it hasn't been called yet, and WriteHeader // is what sets r.chunking. r.Flush() - if !r.chunking && r.bodyAllowed() { + if !r.chunking && r.bodyAllowed() && !r.needSniff { if rf, ok := r.conn.rwc.(io.ReaderFrom); ok { n, err = rf.ReadFrom(src) r.written += n @@ -367,8 +367,8 @@ func (w *response) sniff() { if w.chunking && len(data) > 0 { fmt.Fprintf(w.conn.buf, "%x\r\n", len(data)) - w.conn.buf.Write(data) } + w.conn.buf.Write(data) } // bodyAllowed returns true if a Write is allowed for this response type. |