]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: document Server's implicit Content-Length response header
authorBrad Fitzpatrick <bradfitz@golang.org>
Tue, 29 May 2018 20:05:12 +0000 (20:05 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 29 May 2018 22:34:40 +0000 (22:34 +0000)
Fixes #23450

Change-Id: I829399194299d2e6d5e754b60e8f72b321b5da90
Reviewed-on: https://go-review.googlesource.com/115040
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/net/http/server.go

index 2d3486dc66083a5296e643466abc0b9db42cd885..699cc0a1806d2735752e448c7dd37d76744c0898 100644 (file)
@@ -107,7 +107,7 @@ type ResponseWriter interface {
        // is to prefix the Header map keys with the TrailerPrefix
        // constant value. See TrailerPrefix.
        //
-       // To suppress implicit response headers (such as "Date"), set
+       // To suppress automatic response headers (such as "Date"), set
        // their value to nil.
        Header() Header
 
@@ -117,7 +117,9 @@ type ResponseWriter interface {
        // WriteHeader(http.StatusOK) before writing the data. If the Header
        // does not contain a Content-Type line, Write adds a Content-Type set
        // to the result of passing the initial 512 bytes of written data to
-       // DetectContentType.
+       // DetectContentType. Additionally, if the total size of all written
+       // data is under a few KB and there are no Flush calls, the
+       // Content-Length header is added automatically.
        //
        // Depending on the HTTP protocol version and the client, calling
        // Write or WriteHeader may prevent future reads on the