Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HttpResponse doesn't parse response body without Content-Length header and Connection: close #14

Closed
tumb1er opened this issue Feb 24, 2014 · 7 comments
Labels

Comments

@tumb1er
Copy link
Contributor

tumb1er commented Feb 24, 2014

Steps to reproduce:

  1. create server that replies on request with response:
HTTP/1.1 200 OK
Server: nginx/1.4.3
Date: Mon, 24 Feb 2014 13:38:02 GMT
Content-Type: text/plain
Connection: close
Expires: Mon, 24 Feb 2014 13:38:01 GMT
Cache-Control: no-cache

MESSAGE_BODY
  1. run curl example:
python examples/curl.py http://video-1-1.rutube.ru/api/tx_bytes
  1. GET empty response body in stdout.

That's because in HttpResponse.start method HttpPayloadParser is constructed with only message argument.
So, in HttpPayloadParser.__init__ field self.readall defaults to False and next code in HttpPayloadParser.__call__ is never called:

    if self.readall:
         yield from self.parse_eof_payload(out, buf)
tumb1er added a commit to tumb1er/aiohttp that referenced this issue Feb 24, 2014
@ghost
Copy link

ghost commented Feb 24, 2014

Just ran into this and the above commit: tumb1er@235a6e4 seems to work fine.

@fafhrd91
Copy link
Member

i cannot accept this because HttpPayloadParser implementation is used for server as well.
it probably not a bad idea to support responses without content-length for client code because of bad servers, but i think this is against http spec.

@fafhrd91
Copy link
Member

added parameter for request() method @76ab7f76ef4e4ab83a35b787baf80fe7fae74454

@tumb1er
Copy link
Contributor Author

tumb1er commented Feb 24, 2014

Thanks! What version will it be?

@fafhrd91
Copy link
Member

0.6.3, i'll try to release it later today or tomorrow.

@fafhrd91
Copy link
Member

new version is released

@lock
Copy link

lock bot commented Oct 29, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants