0

Not exactly sure how or why, but many times when I try and preview some URL, I get garbage. This has happened on several JSON preview websites as well as on my browser. Strangely this isn't all the time.

Here's an example in Notepad (downloaded minus the type=jsontext parameter) and Firefox

alt text

This can also be seen in some of the JSON viewer sites I've used before, either timing out or displaying the same garbage.

What on earth could be causing this? I'm really confused here.

EDIT: BTW, here are the HTTP headers that acompany the request:

<!--Ignore this, Turning off syntax highlighting...-->

http://api.stackapps.com/1.0/search?intitle=closed&sort=activity&order=desc&type=jsontext

GET /1.0/search?intitle=closed&sort=activity&order=desc&type=jsontext HTTP/1.1
Host: api.stackapps.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.11) Gecko/20101012 Firefox/3.6.11 ( .NET CLR 3.5.30729; .NET4.0E)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Cookie: *snip*

HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/plain; charset=utf-8
Content-Encoding: gzip
X-AspNetMvc-Version: 2.0
X-RateLimit-Max: 10000
X-RateLimit-Current: 9996
X-AspNet-Version: 4.0.30319
Date: Thu, 28 Oct 2010 00:37:25 GMT
Content-Length: 910
3
  • Are you behind a proxy? Some proxies strip out Accept/Content-Encoding headers, which would cause your browser to not decompress the API responses. If you're not sure, you can test the theory by running what you get back from the API through gzip. Oct 28, 2010 at 0:16
  • @Kevin No, this is at my house. I updated the post with the HTTP headers
    – TheLQ
    Oct 28, 2010 at 0:40
  • I can't repro, have you tried decompressing the payload with gzip? Is it valid? Oct 28, 2010 at 0:57

1 Answer 1

3

Sorry about that, I had completely forgot I disabled Gzip compression in Firefox due to a misbehaving site a few months ago.

This does explain why some JSON preview apps show garbage instead of actual JSON: They don't handle Gzip compression.

You must log in to answer this question.

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