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 HTTPGzipProcessor #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

jasonkotenko
Copy link

Hi, we've been using mechanize and noticed that if a page was gzipped, mechanize just chokes by spitting out a stacktrace. I found the HTTPGzipProcessor, but it appeared to be bit-rotted and did not work correctly with HTTPEquivProcessor, so I fixed it up to correctly subclass addinfourl, and also discard the content-encoding:gzip header after the content has been decompressed (or else clients try to decompress something that is already decompressed).

The version I'm sending a pull request for works for gzip and non-gzip pages, if you include the HTTPGzipProcessor in your OpenerDirector (in our shop we have our own custom OD).

Let me know if you have any concerns about the changes, or suggestions for how to do it better. I'll be writing up a blog post about this in the next few days at http://jasonkotenko.com.

Thanks,
Jason Kotenko

 1. Discard gzip header after content has been decompressed
 2. Return addinfourl object so that HTTPEquivProcessor can use
    the result of HTTPGzipProcessor
@jamesbroadhead
Copy link

jamesbroadhead commented Mar 12, 2017

Thank you for your contribution to mechanize!

Following the process in #117, future work on mechanize will be occurring here:
https://github.com/python-mechanize/mechanize.

Please re-file your PR there (where it will get attention, and hopefully merged)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants