summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Daniels <eric@erdaniels.com>2018-07-17 00:49:55 +0000
committerBrad Fitzpatrick <bradfitz@golang.org>2018-07-17 02:23:17 +0000
commit6e4e29408aba3adbc1bfc3f474ab120f1c983ec2 (patch)
treecfd43855e111a842fc1260c1c159a2b046b0be4b
parentc2ba0ca80454d0d9fdf801619279bbbbe8f50748 (diff)
downloadgo-git-6e4e29408aba3adbc1bfc3f474ab120f1c983ec2.tar.gz
http/internal: document final CRLF behavior on chunkedWriter
Change-Id: I0f76b40dbfda2d382c88aec377db1851c4ac7441 Change-Id: I0f76b40dbfda2d382c88aec377db1851c4ac7441 GitHub-Last-Rev: ab42559278d8cba9e025b431a459d117500a73da GitHub-Pull-Request: golang/go#26410 Reviewed-on: https://go-review.googlesource.com/124255 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-rw-r--r--src/net/http/httputil/httputil.go4
-rw-r--r--src/net/http/internal/chunked.go4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/net/http/httputil/httputil.go b/src/net/http/httputil/httputil.go
index 2e523e9e26..09ea74d6d1 100644
--- a/src/net/http/httputil/httputil.go
+++ b/src/net/http/httputil/httputil.go
@@ -23,7 +23,9 @@ func NewChunkedReader(r io.Reader) io.Reader {
// NewChunkedWriter returns a new chunkedWriter that translates writes into HTTP
// "chunked" format before writing them to w. Closing the returned chunkedWriter
-// sends the final 0-length chunk that marks the end of the stream.
+// sends the final 0-length chunk that marks the end of the stream but does
+// not send the final CRLF that appears after trailers; trailers and the last
+// CRLF must be written separately.
//
// NewChunkedWriter is not needed by normal applications. The http
// package adds chunking automatically if handlers don't set a
diff --git a/src/net/http/internal/chunked.go b/src/net/http/internal/chunked.go
index 63f321d03b..f06e5725f3 100644
--- a/src/net/http/internal/chunked.go
+++ b/src/net/http/internal/chunked.go
@@ -171,7 +171,9 @@ func removeChunkExtension(p []byte) ([]byte, error) {
// NewChunkedWriter returns a new chunkedWriter that translates writes into HTTP
// "chunked" format before writing them to w. Closing the returned chunkedWriter
-// sends the final 0-length chunk that marks the end of the stream.
+// sends the final 0-length chunk that marks the end of the stream but does
+// not send the final CRLF that appears after trailers; trailers and the last
+// CRLF must be written separately.
//
// NewChunkedWriter is not needed by normal applications. The http
// package adds chunking automatically if handlers don't set a