[Python-ideas] HTTP compression support for http.server
Chris Barker
chris.barker at noaa.gov
Mon Jul 24 12:20:47 EDT 2017
The opinion of some random guy on the list...
On Thu, Jul 20, 2017 at 12:15 AM, Pierre Quentel <pierre.quentel at gmail.com>
wrote:
> I have been suggested to require feedback from core devs :
> - should HTTP compression be supported ?
>
Yes. You are quite right, it's pretty standard stuff these days.
> - 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"
>
I'm pretty wary of compression happening by default -- i.e. someone runs
exactly the same code with a newer version of Python, and suddenly some
content is getting compressed.
- 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
>
sure -- though it would be nice for folks to be able to use compression
without going through that process.
The 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.
>
How about having it be an empty list by default and have one or more lists
of common types be pre-populated and available in the SimpleHTTPServer
namespace. that is:
SimpleHTTPServer.compressed_types =
SimpleHTTPServer.standard_compressed_types
Or may be a method to turn on the "standard" set -- though if it really is
simply a list, better to expose that so it's obvious that you can create
your own list or examine and edit the existing one(s).
Thanks for doing this -- nice feature!
-CHB
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170724/79559b5f/attachment.html>
More information about the Python-ideas
mailing list