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

Gzip-encoded HEAD responses throw EOFException #37

Closed
ryan-williams opened this issue Apr 26, 2019 · 0 comments · Fixed by #95
Closed

Gzip-encoded HEAD responses throw EOFException #37

ryan-williams opened this issue Apr 26, 2019 · 0 comments · Fixed by #95

Comments

@ryan-williams
Copy link

requests.head("http://httpbin.org/get", headers = Map("Accept-Encoding" -> "gzip"))
java.io.EOFException
  java.util.zip.GZIPInputStream.readUByte(GZIPInputStream.java:268)
  java.util.zip.GZIPInputStream.readUShort(GZIPInputStream.java:258)
  java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:164)
  java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:79)
  java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:91)
  requests.Requester.stream(Requester.scala:333)
  requests.Requester.apply(Requester.scala:110)
  ammonite.$sess.cmd0$Helper.<init>(cmd0.sc:2)
  ammonite.$sess.cmd0$.<init>(cmd0.sc:7)
  ammonite.$sess.cmd0$.<clinit>(cmd0.sc:-1)

I hit this in the wild while poking at the GitHub API:

requests.head("https://api.github.com/users/ryan-williams")

A work-around is to ask for a non-gzipped response:

requests.head(
  "https://api.github.com/users/ryan-williams", 
  headers = Map("Accept-Encoding" -> "identity")  // ✅ works
)
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

Successfully merging a pull request may close this issue.

1 participant