Re: [go-nuts] should every .gz file be served with content-encoding gzip?

2017-01-14 Thread Andy Balholm
1. It is unexpected. When I click a link that ends with .tar.gz, I expect to 
get a .tar.gz file.
2. It is a waste of disk space. Sure, as soon as they download the tarball, 
they will extract it. But they still need the space for both the tarball and 
the contents at the same time. So we might as well let them conserve space if 
they want to.
3. Some programs don’t accept uncompressed .tar files; they require .tar.gz.

> On Jan 14, 2017, at 10:57 AM, Anmol Sethi  wrote:
> 
> While it is unexpected, what is wrong with just serving a tar file and 
> redirecting a foo.gz request to a foo request? Why should a user want to have 
> a .gz file after downloading?
> 
> On Sat, Jan 14, 2017 at 1:31 PM Andy Balholm  > wrote:
> It all depends on what the user wants to have when they are done downloading. 
> In the case of HTML, CSS, and JS, they want an uncompressed file that is 
> ready for their browser to use. So you should use Content-Encoding: gzip and 
> Content-Type: text/html or whatever. In the case of a .tar.gz, they may be 
> expecting to find a tar.gz file in their downloads folder, so you should use 
> Content-Type: application/gzip (not just gzip).
> 
> But rather than trying to guess what the user wants, you can go by the 
> filename in the request. If the request specifies a filename ending in .gz, 
> use Content-Type: application/gzip; if your server is adding the .gz, use 
> Content-Encoding: gzip. (And check the Accept-Encoding header too.)
> 
> Andy

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] should every .gz file be served with content-encoding gzip?

2017-01-14 Thread Andy Balholm
It all depends on what the user wants to have when they are done downloading. 
In the case of HTML, CSS, and JS, they want an uncompressed file that is ready 
for their browser to use. So you should use Content-Encoding: gzip and 
Content-Type: text/html or whatever. In the case of a .tar.gz, they may be 
expecting to find a tar.gz file in their downloads folder, so you should use 
Content-Type: application/gzip (not just gzip).

But rather than trying to guess what the user wants, you can go by the filename 
in the request. If the request specifies a filename ending in .gz, use 
Content-Type: application/gzip; if your server is adding the .gz, use 
Content-Encoding: gzip. (And check the Accept-Encoding header too.)

Andy

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] should every .gz file be served with content-encoding gzip?

2017-01-14 Thread 'Anmol Sethi' via golang-nuts
Say in my http fileserver, I have /static/foo.tar.gz. Should my fileserver
be serving it as /static/foo.tarwith content-encoding: gzip always or
should it be served as /static/foo.tar.gz with content-type: gzip?

Change foo.tar.gz with any file that ends in .gz. My question boils down to
whether or not every .gz file should be served with content-encoding: gzip?
I know it's fine for html/css/js but I'm wondering if there are some files,
where i should be serving them with content-type: gzip? As in, why not just
always use content-encoding: gzip and strip off the extension?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.