New: Proxy with PEP 333-compliant chunked-response support (based on Paste's Proxy class) #124
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I tried to figure out some bug about partial responses using
HostProxy
. It occur on requests that works fine with Paste's Proxy middleware. Finally, I found the problem to be the HostProxy implementation of chunked responses.By some PEP 333 chapter, only the server MAY add chunked responses headers, but it usually does so only if Content-Length is not set. At least Gunicorn seems to do chunked very fine, if no Content-Length is set, AFAIK.
So, I copied over
paste.proxy.Proxy
code as a new starting point and adapted to use restkit client and to allow streaming of the client response.This works very good for me. I added no tests, but its working over my blog http://kombobreaker.com/blog
I dont know where the new class should be: wsgi_proxy.py or a new module?
Waiting for your feedback and/or merge.