if you do so, it will be longer to download,
it also put more pressure on the server as it needs to
decompress the content as it serves it.
Other side effects occurs such as 
the longer it is to serve a request 
the busier the server will be
thus the more likely you are to hit the server capacity.

Now if that really is what you want/need to do, 
technically speaking you can, 
have fun with it!

On Saturday, January 14, 2017 at 7:55:33 PM UTC+1, 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:38 PM <mhh...@gmail.com <javascript:>> wrote:
>
>> Say you have this foo.tar.gz, 
>> served as /foo.tar.gz with a content-encoding: gzip,
>> the browser would in fact decode the gzip stream and serve a tar file.
>>
>> I guess, it is unexpected, 
>> the content-encoding should probably be application/octet-stream 
>> to instruct the browser to download the file,
>> for correctness the content-type should be application/x-gzip
>>
>> Now lets say you are serving pre-compressed some.css.gz, 
>> you d better serve it as some.css,
>> when the request comes in,
>> check the accept-encoding header of the request,
>> - if it says gzip, set the response header content-encoding to gz,
>> read the gz file straight.
>> - if the accept header of the request says to not handle gzip,
>> serve an uncompressed version of this gz (maybe you read it straight form 
>> the file system too?).
>>
>> in both case, set the response content-type appropriately for the file 
>> type (in that case text/css, and certainly not application/x-gzip)
>>
>>
>> On Saturday, January 14, 2017 at 7:08:55 PM UTC+1, Anmol Sethi wrote:
>>>
>>> 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...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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.

Reply via email to