[Python-ideas] HTTP compression support for http.server
pierre.quentel at gmail.com
Thu Jul 20 03:15:05 EDT 2017
I have reported an issue in the tracker (https://bugs.python.org/issue30576)
and proposed a Pull Request on the Github CPython repository (
https://github.com/python/cpython/pull/2078) to make http.server in the
standard library support HTTP compression (gzip).
I have been suggested to require feedback from core devs :
- should HTTP compression be supported ?
- if so, should it be supported by default ? It is the case in the PR,
where a number of content types, eg text/html, are compressed if the user
agent accepts the gzip "encoding"
- if not, should the implementation of http.server be adapted so that
subclasses could implement it ? For the moment the only way to add it is to
modify method send_head() of SimpleHTTPRequestHandler
My opinion is that it should be supported : http.server is not meant to be
a full-featured HTTP server, but compression it is a basic and normalized
feature of HTTP servers, it is supported by most browsers including on
smartphones, it reduces network load, and it's very easy to implement (cf.
the Pull Request). For the same reason, I recently added browser cache to
http.server (PR #298 <https://github.com/python/cpython/pull/298>).
I also think that it should be supported by default for the most common
implementation is based on a list of types to compress
(SimpleHTTPServer.compressed_types) that can be modified at will, eg set to
the empty list to disable compression.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas