Allow gzip compression in high-level server response interface#403
Allow gzip compression in high-level server response interface#403asvetlov merged 1 commit intoaio-libs:masterfrom danielnelson:add-encoding-to-enable-compression
Conversation
|
Please fix pep8 errors |
|
Maybe |
|
Enum with 3 values? |
|
@fafhrd91 I believe enum is the perfect solution but we still should support |
|
Let's drop py3.3 support |
+1 |
|
@fafhrd91 you are moving too fast from my perspective. Anyway, how |
|
I prefer to use enum. Is flufl.enum compatible with py3.4 enums? |
|
It's fully compatible and it is the base library for standard |
|
Lets then just use enum |
|
Okay so based on this discussion here is a rough draft of what the new documentation might look like: |
|
@danielnelson did you mean |
|
I'm not sure I understand. Are you saying you don't expect a |
|
I say |
|
I wouldn't worry about backward compatibility here. |
|
Sorry, but I do care about backward compatibility.
|
|
|
|
|
|
Anywhere I said transfer encoding above should definitely be content coding, and of course the header is Having backwards compatibility here wouldn't introduce too much cruft, and I also think we are not completely sure what we would need from a compress interface. So I would prefer to just add backwards compatibility for now. |
aiohttp/web_reqrep.py
Outdated
There was a problem hiding this comment.
Please use str values: deflate = 'deflate'
There was a problem hiding this comment.
Also would like to note that this list of encodings is not complete. Never saw compress in the wild, however, but identity is pretty common one.
There was a problem hiding this comment.
I believe this is the current list of registered codings. I'll add a comment about how this is enum only represents our supported coding types.
There was a problem hiding this comment.
Good finding! Please add a comment with this link
|
I have updated the pull request with the suggested changes. |
|
LGTM |
…ression Allow gzip compression in high-level server response interface
|
Merged. @danielnelson thanks for patience :) |
Add encoding kwarg to enable_compression to select gzip or deflate and
set Content-Encoding header.
This is for issue #396.
I have a few concerns about this code:
I think that when using a high level interface one would generally want to simply enable all types of compression that are supported by the library, with selection automatically made based on the Accept-Encoding header. Potentially one may want to optionally specify a subset of the available encoding types, such as if we had compress support, maybe one would want to allow gzip and compress but not deflate.
I considered changing the signature to accept a sequence of encodings, however if we do this it is no longer intuitive to me how the
forceargument behaves.Let me know how you think it would best to proceed.