vulcand / oxy

Go middlewares for HTTP servers & proxies
Apache License 2.0
2.02k stars 324 forks source link

Bump to go1.16 #214

Closed rtribotte closed 3 years ago

rtribotte commented 3 years ago

This PR bumps to go1.16.

It fixes the test TestChunkedResponseConversion of fwd.go.

The assertion to check the Content-Length header has been removed because it's not present in response with go1.16. By enforcing flushes in net/http/httputil/reverseproxy.go when proxying streamed responses with unknown body lengths, in go1.16, the call of flush() method of the net/http/server.go#chunkWriter happens before any call of its Write() method, which leads eventually to the removal of the Content-Length header.

Also as per RFC2616 (https://tools.ietf.org/html/rfc2616#section-4.4):

Messages MUST NOT include both a Content-Length header field and a non-identity transfer-coding. If the message does include a non-identity transfer-coding, the Content-Length MUST be ignored.

The test is now ensuring that Content-Length header is not present in the response only for go1.16+.