Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I tell if Heroku is sending gzipped responses?

I'm making an iPhone application that requests JSON from Heroku.

  1. Am I getting a gzipped response? And, does the iPhone automatically unzip gzipped responses, or do you have to program that in? I'm using NSURLConnection asynchronously (with the delegate protocol) as described in the Xcode docs.

    When I do:

    curl -I http://acani.heroku.com/users/4c96ee4f1467281352000049/1234/50/50
    

    I get:

    HTTP/1.1 200 OK
    Server: nginx/0.7.67
    Date: Sun, 17 Oct 2010 16:27:25 GMT
    Content-Type: application/json
    Connection: keep-alive
    Content-Length: 11532
    X-Varnish: 2314841869
    Age: 0
    Via: 1.1 varnish
    
  2. I'm also using the Zimt WebSocket code with AsyncSocket for chat. The chat server is Node.js. Should I be gzipping each chat message? Or is that done automatically?

  3. I wonder, to reduce bandwidth, does Twitter gzip your tweets (with JavaScript on the web, or Objective-C on the iPhone) before they are sent to Twitter?

Thanks!

Matt

like image 904
ma11hew28 Avatar asked Oct 17 '10 16:10

ma11hew28


People also ask

How do I know if a response is Gzipped?

You can tell using Developer Tools (F12). Go to the Network tab, select the file you want to examine and then look at the Headers tab on the right. If you are gzipped, then you will see that in the Content-Encoding.

What is Gzipped data?

Gzip (GNU zip) is a free and open source algorithm for file compression. The software is overseen by the GNU project. In this context, compression is the deliberate reduction in size of data to save storage space or increase the data transfer rate.

Can fonts be Gzipped?

Turns out yes - you can and should gzip the custom font files you use with @font-face .


1 Answers

To detect if a response is compressed or not, you need to look for a Content-Encoding header. It can be set to either gzip, compress, or deflate. See RFC 2616 Section 3.5 for more details.

like image 169
Remy Lebeau Avatar answered Oct 12 '22 23:10

Remy Lebeau