[Bug] Streaming proxy response breaks clients by `Content-Length` and `Transfer-Encoding: chunked` headers together
sergey124 opened this issue · comments
Streaming proxy response has both Content-Length
and Transfer-Encoding: chunked
headers, which breaks some clients, and is not compliant with RFC.
Steps to reproduce
- Make streaming request to proxy with PTU endpoint
Expected behavior
- Send response with
Transfer-Encoding: chunked
withoutContent-Length
Actual behavior
- Response contains both
Transfer-Encoding: chunked
andContent-Length
, causing error in API client:
Error invoking remote method 'send-http-request': Error: Parse Error: Content-Length can't be present with Transfer-Encoding
Justificaiton
Standard requires us to not send Content-Length in case of non-identity Transfer-Encoding, like "chunked", "compress", "deflate", or "gzip":
"Messages MUST NOT include both a Content-Length header field and a non-identity transfer-coding." (RFC 2616, Section 4.4, point 3)
New RFC, Section 3.3.2 is not instructing to ignore this violation, so it would be great to remove the Content-Length, otherwise clients might break.