Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with using compression on the remote side #11

Open
Licenser opened this issue Mar 21, 2015 · 1 comment
Open

Issue with using compression on the remote side #11

Licenser opened this issue Mar 21, 2015 · 1 comment

Comments

@Licenser
Copy link

It seems that when enabling compression to the remote side ring-proxy has a problem. From what I can tell the following happens:

  1. the http request is send offering gzip and dflate compression
GET /api/0.2.0/vms? HTTP/1.1
Connection: close
cache-control: no-cache
accept-encoding: gzip, deflate
authorization: Bearer iH89VF89i04IfPYucIpbOrLRLzvIqZQb
accept-language: en-US,en;q=0.8,de;q=0.6
accept: application/json
pragma: no-cache
connection: keep-alive
referer: http://localhost:8888/
user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36
Host: 192.168.221.201:8080
  1. the response is returned (with gzip)
HTTP/1.1 200 OK
connection: close
server: Cowboy
date: Sat, 21 Mar 2015 22:17:57 GMT
content-encoding: gzip
content-length: 296
access-control-allow-origin: *
access-control-allow-headers: Authorization, content-type, x-snarl-token, x-full-list, x-full-list-fields
access-control-expose-headers: x-snarl-token, x-full-list, x-full-list-fields
access-control-allow-credentials: true
content-type: application/json
vary: accept

<296 byte of gzip encoded binary data>
  1. The Java HTTP client reports a content-length header of 296 as is correct but already decodes the body.

  2. https://github.com/tailrecursion/ring-proxy/blob/master/src/tailrecursion/ring_proxy.clj#L42 Copies the amount of bytes in content-length

  3. given the decompressed data is larger the compressed one part of the data is cut of when resending.

@npetryk
Copy link

npetryk commented Jan 25, 2017

If anyone is still interested in this issue, it can be fixed by adding :decompress-body false to the clj-http.client/request map

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants