]> Cypherpunks.ru repositories - gostls13.git/commit
net/http: in Transport, don't error on non-chunked response with Trailer header
authorBigMikes <giulio.micheloni@gmail.com>
Mon, 29 Oct 2018 10:45:16 +0000 (11:45 +0100)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 30 Oct 2018 01:42:59 +0000 (01:42 +0000)
commit7b0fa529f33fc444e762af7e33d6c8deba5298b3
tree68574347673adf3446f5983b25e1f8fd646eacdd
parent5f5ea3fd4d40ba16a58a3c6678da2f3f6d2fb8eb
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>
src/net/http/request.go
src/net/http/response_test.go
src/net/http/transfer.go