From: Aaron Jacobs Date: Wed, 14 Sep 2016 02:57:15 +0000 (+1000) Subject: net/http: clarify Request.ContentLength behavior on the client. X-Git-Tag: go1.8beta1~1338 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=a562351e512682046623ecbd106f4973f3525be9;p=gostls13.git net/http: clarify Request.ContentLength behavior on the client. While you could argue the previous wording technically said that -1 is an acceptable way to indicate "unknown" on the client, it could be read as ambiguous. Now it's clear that both 0 and -1 mean unknown. Change-Id: I3bc5a3fd5afd1999e487296ec121eb548415e6b0 Reviewed-on: https://go-review.googlesource.com/29130 Reviewed-by: Brad Fitzpatrick --- diff --git a/src/net/http/request.go b/src/net/http/request.go index 16e7009424..bebf55ccc4 100644 --- a/src/net/http/request.go +++ b/src/net/http/request.go @@ -153,7 +153,8 @@ type Request struct { // The value -1 indicates that the length is unknown. // Values >= 0 indicate that the given number of bytes may // be read from Body. - // For client requests, a value of 0 means unknown if Body is not nil. + // For client requests, a value of 0 with a non-nil Body is + // also treated as unknown. ContentLength int64 // TransferEncoding lists the transfer encodings from outermost to