]> Cypherpunks repositories - gostls13.git/commit
net/http: buffer before chunking
authorBrad Fitzpatrick <bradfitz@golang.org>
Fri, 11 Jan 2013 18:03:43 +0000 (10:03 -0800)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 11 Jan 2013 18:03:43 +0000 (10:03 -0800)
commitbef4cb475c0638ab5193f75f2683b35a7c7f6547
tree5be14be3f30940b31e1b102bfb715b78ce49e9a6
parent98259b92115f24b41c5ba40c3cddb68f6f0077f8
net/http: buffer before chunking

This introduces a buffer between writing from a handler and
writing chunks.  Further, it delays writing the header until
the first full chunk is ready.  In the case where the first
full chunk is also the final chunk (for small responses), that
means we can also compute a Content-Length, which is a nice
side effect for certain benchmarks.

Fixes #2357

R=golang-dev, dave, minux.ma, rsc, adg, balasanjay
CC=golang-dev
https://golang.org/cl/6964043
src/pkg/net/http/header.go
src/pkg/net/http/serve_test.go
src/pkg/net/http/server.go