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

Add parameter to iter_content to disable content decoding #958

Closed
wants to merge 1 commit into from
Closed

Add parameter to iter_content to disable content decoding #958

wants to merge 1 commit into from

Conversation

domoritz
Copy link

I wanted to use requests to transfer a file chunk by chunk. However, before I transferred the body, I copied a header from the original response to the new response. Since request decodes gzip and deflate, the header was wrong and my content couldn't be interpreted by the browser.

This patch adds an option to iter_content. to disable decoding of gzip or deflate content.

@piotr-dobrogost
Copy link

iter_content() is supposed to always decode thus adding parameter changing this is not the right thing to do and I guess it won't be accepted. I thing there was some discussion about adding similar method for raw data but the idea was rejected. You could find this discussion in closed issues and voice your concern there. Isn't raw what you need?

@domoritz
Copy link
Author

Okay, thanks for the input. I have a solution for myself but thought that other people might be interested in this as well. I'll close the issue then.

@domoritz domoritz closed this Nov 25, 2012
@piotr-dobrogost
Copy link

What's your solution?

@domoritz
Copy link
Author

1st: Copy the code from iter_content but without the call that deflates or unzips.
2nd (hack): Set the content-encoding to "" before calling iter_content.

@slingamn
Copy link
Contributor

Interesting. See #844 for a related issue (related to byte encodings of Unicode codepoints, rather than gzip).

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants