Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I made two http calls to the same gzipped resource from two different machines - RHEL and OSX.

curl http://example.com/file.gz

The first call returned an expected binary output:

/�IQ���}

The second call returned the content:

Hello, world!

The same phenomenon happened with wget - binary response from the RHEL machine, plaintext from the OSX one.

Could OSX be auto-opening my resource implicitly? Can I override these settings?

share|improve this question
up vote 3 down vote accepted

According to the OSX curl man page, some versions have automatic decompression of lzip encoded archives:

-V, --version
          Displays information about curl and the libcurl version it uses.
[...]

      The  third  line  (starts  with "Features:") shows specific features 
      libcurl reports to offer. Available features include:

[...]
      libz   Automatic decompression of compressed files over HTTP is supported.

So, I guess that if your run curl -V | grep libz on your OSX machine, you will see that it has this feature while the RHEL one does not.

share|improve this answer
    
Thanks, that was it. Any idea how to disable? – Adam Matan Jun 13 '13 at 13:25
    
@AdamMatan not really, don't have a mac and my wget does not do this. You could try piping it through gzip: curl foo.gz | gzip > foo.gz. – terdon Jun 13 '13 at 13:30
1  
@AdamMatan: I cannot test either... although my curl -V indicates that zlib is active, I doesn't gunzip automatically. But perhaps the --raw switch will help you: When used, it disables all internal HTTP decoding of content or transfer encodings and instead makes them passed on unaltered, raw. (Added in 7.16.2) – mpy Jun 13 '13 at 13:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .