aiohttp.Client can't parse Trailer headers and throws exception #1619
Description
Long story short
I work with some storage service via http. It sends me chunked response and several trailing headers after the body. All of this trailers are specified in a Trailer header according to https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Trailer
First problem: the client completely ignores this headers and doesn't parse them. Such behaviour violates HTTP 1.1
However, there is a bigger problem. If you use a single session the parsers would start the next parsing from the previous (!) response - beginning from these trailing headers. So the parser thinks it's the first line of new response and throws exception because it didn't find HTTP verb in it.
Therefore I can't reuse session in my app which leads to performance problems :(
Expected behaviour
- The client has to parse trailing headers in chunked response
- The next response should not be affected by any data from previous
Actual behaviour
- Client ignores trailer headers.
- The next response is affected by trailer headers from previous. The parser throws BadStatusLine exception.
Steps to reproduce
- Create server which respond which send chunked response with trailing headers after the body. A special Trailer header should be placed before the body and contains all trailing headers names.
- Create a new ClientSession. All next responses do via this session
- Send the first request to your server. You won't find any trailer headers in the response
- Send the second request. The client session will throw exception BadStatusLine
Checked on macOs 10.12.3 and Ubuntu Trusty 14.04