aboutsummaryrefslogtreecommitdiff
path: root/src/net/http/request.go
diff options
context:
space:
mode:
authorBigMikes <giulio.micheloni@gmail.com>2018-10-29 11:45:16 +0100
committerBrad Fitzpatrick <bradfitz@golang.org>2018-10-30 01:42:59 +0000
commit7b0fa529f33fc444e762af7e33d6c8deba5298b3 (patch)
tree68574347673adf3446f5983b25e1f8fd646eacdd /src/net/http/request.go
parent5f5ea3fd4d40ba16a58a3c6678da2f3f6d2fb8eb (diff)
downloadgo-7b0fa529f33fc444e762af7e33d6c8deba5298b3.tar.gz
go-7b0fa529f33fc444e762af7e33d6c8deba5298b3.zip
net/http: in Transport, don't error on non-chunked response with Trailer header
There are cases where HTTP message specifies the Trailer header but not the Transfer-Encoding = chunked. The existing implementation would return an error in those cases, without returning also the message itself. Instead, it would be preferable to let the library user decide when the message is valid or not. This change makes the fixTrailer() function not to return an error and to keep the Trailer value in the Response.Header map but not populate Response.Trailer. Fixes #27197 Change-Id: Ic1e96791fde97f31dc5ecb8de05c8e4f49465c2c Reviewed-on: https://go-review.googlesource.com/c/145398 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/net/http/request.go')
-rw-r--r--src/net/http/request.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/net/http/request.go b/src/net/http/request.go
index 3669f17f66..0bcdeae0df 100644
--- a/src/net/http/request.go
+++ b/src/net/http/request.go
@@ -53,8 +53,9 @@ var (
// available.
ErrNotSupported = &ProtocolError{"feature not supported"}
- // ErrUnexpectedTrailer is returned by the Transport when a server
- // replies with a Trailer header, but without a chunked reply.
+ // Deprecated: ErrUnexpectedTrailer is no longer returned by
+ // anything in the net/http package. Callers should not
+ // compare errors against this variable.
ErrUnexpectedTrailer = &ProtocolError{"trailer header without chunked transfer encoding"}
// ErrMissingBoundary is returned by Request.MultipartReader when the