New submission from Pierre Quentel: 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. ---------- components: Library (Lib) messages: 295207 nosy: quentel priority: normal severity: normal status: open title: http.server should support HTTP compression (gzip) versions: Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30576> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com