]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: clarify Request.ContentLength behavior on the client.
authorAaron Jacobs <jacobsa@google.com>
Wed, 14 Sep 2016 02:57:15 +0000 (12:57 +1000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 14 Sep 2016 03:00:58 +0000 (03:00 +0000)
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 <bradfitz@golang.org>
src/net/http/request.go

index 16e70094248a08cd3e28505ddb7f7d49e82fc08b..bebf55ccc4faf89c4801ae69e43e216e7fa4b3ea 100644 (file)
@@ -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