openinbrowser icon indicating copy to clipboard operation
openinbrowser copied to clipboard

Support for gzip-compressed responses

Open Lekensteyn opened this issue 9 years ago • 3 comments

It would be nice if there was an option to force decompression of gzipped responses.

Example URL and its response: http://ftp.nl.debian.org/debian/dists/jessie/contrib/Contents-amd64.gz

HTTP/1.1 200 OK
Date: Tue, 11 Aug 2015 14:50:59 GMT
Server: Apache/2.2.22 (Debian)
Last-Modified: Sat, 06 Jun 2015 10:42:04 GMT
ETag: "8b20181-15b30-517d70f339700"
Accept-Ranges: bytes
Content-Length: 88880
Content-Type: application/x-gzip

Forcing a Content-Encoding: gzip response header could help (in addition to setting Content-Type: text/plain).

This feature was also requested in a Review for Open in Browser by megabyte. Firefox issue that could affect a possible implementation: Bug 52282 - (ftp:// or file://) suffixes like (.gz) are Content-Encoding (not Content-Type) [decode and display .gz file]

Lekensteyn avatar Aug 11 '15 14:08 Lekensteyn

Content-Encoding can unfortunately not be overridden using setResponseHeader, see https://github.com/Lekensteyn/openinbrowser/commit/7c55f700cfbbc188ddc17c0c869722fccaa77fcc for an attempt. Other ideas?

Lekensteyn avatar Aug 11 '15 16:08 Lekensteyn

Hi Peter,

Yeah that looks like a bummer. No idea comes to mind, unless a totally different approach is used instead of hijacking the response headers.

spasche avatar Aug 17 '15 20:08 spasche

Would this only apply to the case where a single file is compressed using gzip?

It would also be nice to be able to open a compressed folder, and then select a file inside it to view, all within the browser.

HighCommander4 avatar Nov 28 '16 16:11 HighCommander4