Message295207
The server in http.server currently doesn't support HTTP compression.
I propose to implement it in the method send_head() of SimpleHTTPRequestHandler this way : for each GET request, if the request header "Accept-Encoding" is present and includes "gzip" among the possible compression schemes, and if the Content-Type determined by the file extension is in a list compressed_types, then the server sends the "Content-Encoding" response header to "gzip" and send_head() returns a file object with the gzipped value.
compressed_types is an attribute of the SimpleHTTPRequestHandler class and is set by default to ["text/plain", "text/html", "text/css", "text/xml", "text/javascript", "application/javascript", "application/json"].
The implementation is very simple (a few lines of code).
I also propose to modify mimetypes to add the mapping of extension ".json" to "application/json".
I will make a Pull Request on the CPython Github site with these changes. |
|
Date |
User |
Action |
Args |
2017-06-05 19:42:04 | quentel | set | recipients:
+ quentel |
2017-06-05 19:42:04 | quentel | set | messageid: <1496691724.59.0.955308322691.issue30576@psf.upfronthosting.co.za> |
2017-06-05 19:42:04 | quentel | link | issue30576 messages |
2017-06-05 19:42:04 | quentel | create | |
|