[issue30576] http.server should support HTTP compression (gzip)

2018-09-22 Thread Pierre Quentel
Pierre Quentel added the comment: I have released the module as httpcompressionserver on PyPI : https://pypi.org/project/httpcompressionserver/ -- ___ Python tracker ___

[issue30576] http.server should support HTTP compression (gzip)

2018-09-15 Thread Brett Cannon
Brett Cannon added the comment: Thanks for the understanding, Pierre (and thanks for the work on Brython!). On Sat., Sep. 15, 2018, 08:25 Pierre Quentel, wrote: > > Pierre Quentel added the comment: > > Brett, > > Thanks for taking the time, you and other core devs, to review the PR and >

[issue30576] http.server should support HTTP compression (gzip)

2018-09-15 Thread Pierre Quentel
Pierre Quentel added the comment: Brett, Thanks for taking the time, you and other core devs, to review the PR and to explain why you took this decision. I am disappointed by the result, but I understand the reasons, having to face the same maintenance issues, on a much smaller scale, with

[issue30576] http.server should support HTTP compression (gzip)

2018-09-11 Thread Brett Cannon
Brett Cannon added the comment: I'm agreeing with all the other core devs (other than Victor ;) that I don't quite think this should go in. While I appreciate the work Pierre put into the PR, I just can't find myself to want to deal with future bug reports for this while http.server is

[issue30576] http.server should support HTTP compression (gzip)

2017-11-23 Thread Pierre Quentel
Pierre Quentel added the comment: On the Github site Raymond Hettinger is mentioned as the reviewer. I don't know how to contact him, can anyone ask him if he can review the PR on time for inclusion in Python 3.7 ? I understand that it's difficult to find time for

[issue30576] http.server should support HTTP compression (gzip)

2017-11-11 Thread Pierre Quentel
Pierre Quentel added the comment: I think I have made all the changes requested in the code review (many thanks to the reviewer !). I see that the Pull Request has been flagged "awaiting core review". With the deadline for Python 3.7 coming soon (11 weeks), is there

[issue30576] http.server should support HTTP compression (gzip)

2017-10-02 Thread STINNER Victor
Change by STINNER Victor : -- nosy: -haypo ___ Python tracker ___ ___

[issue30576] http.server should support HTTP compression (gzip)

2017-09-29 Thread Martin Panter
Martin Panter added the comment: Regarding the compressed data generator, it would be better if there were no restrictions on the generator yielding empty chunks. This would match how the upload “body” parameter for HTTPConnection.request can be an iterator without

[issue30576] http.server should support HTTP compression (gzip)

2017-09-27 Thread Stefan Behnel
Change by Stefan Behnel : -- nosy: -scoder ___ Python tracker ___ ___ Python-bugs-list

[issue30576] http.server should support HTTP compression (gzip)

2017-09-27 Thread Stefan Behnel
Stefan Behnel added the comment: FWIW, both the feature and the PR look ok to me. Code formatting is a little funny at times, but the implementation looks good. -- nosy: +scoder ___ Python tracker

[issue30576] http.server should support HTTP compression (gzip)

2017-08-15 Thread Pierre Quentel
Pierre Quentel added the comment: On Python-ideas someone asked if other compressions could be supported besides gzip. The latest version of the PR adds a mechanism for that : SimpleHTTPRequestHandler has a new attribute "compressions", a dictionary that maps compression encodings (eg

[issue30576] http.server should support HTTP compression (gzip)

2017-08-02 Thread Pierre Quentel
Pierre Quentel added the comment: In the latest version of the PR, following Martin's comments : - apply Chunk Transfer for HTTP/1.1 only, change implementation of compression for previous protocols (send gzipped data without Content-Length) - use http.cookiejar to parse the Accept-Encoding

[issue30576] http.server should support HTTP compression (gzip)

2017-07-28 Thread Pierre Quentel
Pierre Quentel added the comment: @martin.panter Please forget my previous message. There is a 3rd solution, and you gave it : no Content-Length and close the connection when all (compressed) data has been sent. -- ___ Python tracker

[issue30576] http.server should support HTTP compression (gzip)

2017-07-26 Thread Pierre Quentel
Pierre Quentel added the comment: @martin.panter For HTTP/1.0, since chunked transfer is not supported, and storage in a temporary file is also not an option, I see 2 possible solutions : - give up compressing big files - it would be a pity, compression is actually made for them... - compress

[issue30576] http.server should support HTTP compression (gzip)

2017-07-25 Thread Martin Panter
Martin Panter added the comment: I think chunked encoding is only meant to be used for HTTP 1.1. For HTTP 1.0, you have to either send Content-Length, or shut down the connection after sending the body. See also Issue 21224 about improving HTTP 1.1 support. Maybe you should add a “Vary:

[issue30576] http.server should support HTTP compression (gzip)

2017-07-25 Thread Pierre Quentel
Pierre Quentel added the comment: In the latest version of the Pull Request (https://github.com/python/cpython/pull/2078/commits/6466c93555bec521860c57e832b691fe7f0c6c20) : - compression is disabled by default (compressed_types is set to []) - as suggested by Chris Barker in the discussion on

[issue30576] http.server should support HTTP compression (gzip)

2017-07-22 Thread Christian Heimes
Christian Heimes added the comment: I share RDM's sentiment and I'm not keen to add more complexity. The http.server module in Python's stdlib is a useful example implementation of a simple HTTP server. I'd rather keep it simple and see a full featured HTTP server on PyPI. These days we don't

[issue30576] http.server should support HTTP compression (gzip)

2017-07-22 Thread Pierre Quentel
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

[issue30576] http.server should support HTTP compression (gzip)

2017-07-21 Thread STINNER Victor
STINNER Victor added the comment: I used a lot http.server in the past to transfer files between two computers. I like transparent compression on the file. The implementation doesn't seem so complex, gzip is now standard and client HTTP headers are used to decide if gzip is wanted or not.

[issue30576] http.server should support HTTP compression (gzip)

2017-07-20 Thread Terry J. Reedy
Terry J. Reedy added the comment: I saw the python-ideas post. I have no experience with http.server, but I just read the doc, and know something of our general enhancement policies. I hope these comments help. There are two questions: Should compression support be added to http.server?

[issue30576] http.server should support HTTP compression (gzip)

2017-07-19 Thread R. David Murray
R. David Murray added the comment: Getting input from python ideas is a great idea :) -- ___ Python tracker ___

[issue30576] http.server should support HTTP compression (gzip)

2017-07-19 Thread Pierre Quentel
Pierre Quentel added the comment: Is Python-ideas the appropriate place to get input from other core devs ? -- ___ Python tracker ___

[issue30576] http.server should support HTTP compression (gzip)

2017-07-17 Thread R. David Murray
R. David Murray added the comment: I do not have a strong opinion on this issue, but I share Martin's doubts that it should be added. It certainly should not be on by default if it is added. We should get input from other core devs. -- nosy: +r.david.murray

[issue30576] http.server should support HTTP compression (gzip)

2017-06-25 Thread Glenn Linderman
Glenn Linderman added the comment: "veery" should be "veering" in above comment, sorry. -- ___ Python tracker ___

[issue30576] http.server should support HTTP compression (gzip)

2017-06-25 Thread Glenn Linderman
Glenn Linderman added the comment: Martin, I understood what you meant, but sadly, doing that least to confusion. Follow your link, it displays fine, and then save the file. At least in Firefox, the default name to save as is "nGzip — A File Compressor.html". This looks appropriate, but the

[issue30576] http.server should support HTTP compression (gzip)

2017-06-24 Thread Martin Panter
Martin Panter added the comment: For existing “.gz” files, I wasn’t suggesting to compress them a second time, just for the server report that they are already compressed, like how it reports the Content-Type value based on the file name. Including Content-Encoding would help browsers display

[issue30576] http.server should support HTTP compression (gzip)

2017-06-20 Thread Pierre Quentel
Pierre Quentel added the comment: Thanks for the comments. I agree with some of them, and have improved the PR accordingly, but I don't agree on the opinion that HTTP compression is beyond the scope of http.server : like browser cache (which also implies a negociation between client and

[issue30576] http.server should support HTTP compression (gzip)

2017-06-19 Thread Glenn Linderman
Glenn Linderman added the comment: @martin sez: It may be reasonable to serve the Content-Encoding field based on the stored file though. If the client requests file “xyz”, there should be no encoding, but if the request was explicitly for “xyz.gz”, the server could add Content-Encoding. But

[issue30576] http.server should support HTTP compression (gzip)

2017-06-17 Thread Martin Panter
Martin Panter added the comment: I think neither Pierre’s nor Glenn’s implementations should be added to SimpleHTTPRequestHandler. In fact I think most forms of content negotiation are only appropriate for a higher-level server. It seems too far removed from the intention of the class,

[issue30576] http.server should support HTTP compression (gzip)

2017-06-10 Thread Pierre Quentel
Changes by Pierre Quentel : -- pull_requests: +2142 ___ Python tracker ___ ___

[issue30576] http.server should support HTTP compression (gzip)

2017-06-10 Thread Pierre Quentel
Pierre Quentel added the comment: The compression is done on the fly : if compression criteria are satisfied, the original content is gzipped, either in memory or on a temporary file on disk, depending on the file size. The gzipped content is not cached, but since the server now supports

[issue30576] http.server should support HTTP compression (gzip)

2017-06-09 Thread Glenn Linderman
Glenn Linderman added the comment: I don't understand fully what you are planning here: to pre-compress the files, or to compress on the fly as mentioned by another commenter? I've implemented, in a CGI behind http.server, both .gz and .br (gzip and brotli) compression, following these rules:

[issue30576] http.server should support HTTP compression (gzip)

2017-06-06 Thread Pierre Quentel
Pierre Quentel added the comment: I propose this as a minor improvement to the built-in server, like the support of browser cache that will be included in Python 3.7 (issue #29654, PR #298). I understand that the server is not supposed to be full-featured, but HTTP compression is widespread,

[issue30576] http.server should support HTTP compression (gzip)

2017-06-05 Thread Martin Panter
Martin Panter added the comment: Why do you want to this? Encoding files on the fly seems out of scope of the SimpleHTTPRequestHandler class to me, but perhaps a more flexible API that could be plugged in by the user could be beneficial. See

[issue30576] http.server should support HTTP compression (gzip)

2017-06-05 Thread Pierre Quentel
Changes by Pierre Quentel : -- type: -> enhancement ___ Python tracker ___ ___

[issue30576] http.server should support HTTP compression (gzip)

2017-06-05 Thread Pierre Quentel
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"