Pierre Quentel added the comment:
Thank you Terry and Victor for your comments. I understand that you agree on
adding HTTP compression to http.server, but don't want it to be enabled by
default.
@terry.reedy
With the implementation proposed in the Pull Request, to disable compression by
default, all it takes is to set the attribute
SimpleHTTPRequestHandler.compressed_types to the empty list.
Users who want to enable compression for some types would create subclasses of
Simple... that set compressed_types. For instance :
import http.server
class CompressedHandler(http.server.SimpleHTTPRequestHandler):
compressed_types = ["text/html", "text/plain"]
http.server.test(HandlerClass=CompressedHandler)
Would that be ok ?
For a command line argument --gzip, compressed_types could be set to a list of
commonly compressed types - I don't think we want to pass a list of types on
the command line.
For CGI scripts, I may be missing something but for me it is up to the script
to determine the response headers and content, I don't think a mixin class in
http.server could help.
@haypo
I fully agree on your comment about content-length, the implementation in the
PR is not optimal.
The alternative would be to send the answer using chunked transfer encoding,
which is currently not used in http.server, and would also be relevant for
other use cases than gzipped files. It shouldn't be difficult to add, and I
volunteer to propose an implementation, but it's yet another feature to add to
the server. Do you think it's relevant ?
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue30576>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com