-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Massively broken with gzip encoded streams #36
Comments
@mutantmonkey FYI |
Related bug: #27 |
There are a few different possible approaches to fix this:
I will see if I can come up with a pull request that takes the third approach. I was not aware that requests even supported gzip encoding. |
Approach no. 3 sounds good. Shouldn't it just work(tm) if we use the high-level
|
The documentation makes it sound like it should, but that's not the case unfortunately. If you trace things back through urllib3's underlying |
@mutantmonkey What was the problem with a chunk_size of 1? |
Using a chunk size of one causes unnecessarily high CPU usage because each time a byte is received, it has to be processed by the Python code instead of just being added to a buffer and processed all at once. This library used to do that, but 6820dc8 changed that behavior. In any case, I believe I may have a fix that will work, but I need an endpoint with gzip enabled to test on. If you happen to have one handy, please share it, otherwise I can try to set something up but it will take another couple of days. |
Due to the changes made for the short read functionality using streams which are gzip encoded is massively broken. Accessing the raw response content bypasses gzip decoding and thus the event stream cannot be read.
This happens for Wikimedia event streams sometimes (gzip encoding is not used in all cases, not sure in which cases it is used).
See https://requests.readthedocs.io/en/latest/user/quickstart/#raw-response-content
The text was updated successfully, but these errors were encountered: