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

Fix #126 #148

Closed
wants to merge 10 commits into from
Closed

Fix #126 #148

wants to merge 10 commits into from

Conversation

Xinkai
Copy link

@Xinkai Xinkai commented Sep 8, 2014

This pull request fixes mainly #126, and some other things along the way.

Tests added.

@asvetlov
Copy link
Member

asvetlov commented Sep 9, 2014

Sorry, code for process chunks looks too complex to me.
PR makes it even more complicated.

I would like to cleanup existing chunk processing first before adding new features.

Guys, thoughts?

@Xinkai
Copy link
Author

Xinkai commented Sep 9, 2014

Everything before 7d036de is cleanup. Currently aiohttp changes chunked 1) everywhere and 2) willy-nilly, also 3) tries to use chunked with Http 1.0. My modification makes aiohttp 1) only process chunked in update_transfer_encoding and 2) raise ValueError when necessary.

I do agree that there should be more cleaning-up, and I do agree the fix 7d036de and 6731131 is not beautiful.

Nonetheless, something came up in my life yesterday, and I can no longer work on this issue. Sorry.

def update_transfer_encoding(self):
"""Analyze transfer-encoding header."""
te = self.headers.get('TRANSFER-ENCODING', '').lower()

if self.compress:
if self.chunked is False:
raise ValueError("Compress is enabled while chunked is disabled.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, you're trying to forbid pretty valid case. Chunks and compression could be used together to represent two semantic principals: 1) stream chunks, join and decode on server 2) stream chunks and decode on server on fly.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a valid case. But aiohttp turned on chunked when compress is True -- even if chunked is explicitly set to False. This is not a correct behavious, but to keep the old quirks.

@kxepal
Copy link
Member

kxepal commented Oct 11, 2014

I agree with @asvetlov that this PR turns request generation on more higher complexity level.
I think better go by a bit more verbose, but clean way where will be separate request classes for making HTTP/1.0 and HTTP/1.1 requests. Or change ClientRequest class in the way of simplification to make requests in more clean and predictable way.
Also see comments.

@Xinkai
Copy link
Author

Xinkai commented Oct 11, 2014

@kxepal, This PR should've been closed.

My changes kept all the quirks that aiohttp had. I wanted to keep the changes to a minimal, meaning no structure modifications. And I added some other ugly shit to make the tests pass.

In retrospect, that was not a good idea, maybe somebody will come up with a proper clean way.

@Xinkai Xinkai closed this Oct 11, 2014
@lock
Copy link

lock bot commented Oct 30, 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 30, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants