duckduckgo/duckduckgo — pull request #61 by jagtalon (2014-02-07 18:43:03+00:00)
Title: Rewrite: Add Accept-Encoding: ''

There is a bit of a problem when the upstream provider responds with content that's encoded with gzip and we wrap it in a JSONP callback function, i.e., the upstream having `Content-Encoding: gzip` as a response and we have `wrap_jsonp_callback` enabled.

What happens is that we end up with a response that the browser cannot understand because the callback function is not gzipped while the rest of it is.

```javascript
ddg_spice_bitcoin(Ŗ[??6ǿ??s.?ٲ?֗RJiZ??a1?,'?q,זw??%q.^e????G? ...);
```

So the plan for fixing this is to strip the request headers to the upstream provider for any `Accept-Encoding` parameters if we're going to wrap the JSON response ourselves. This effectively tells the upstream provider to respond with plain text so that we can concatenate the callback function with no problems.