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 #90

Closed
mr-cloud opened this issue Sep 12, 2022 · 0 comments
Closed

Gzip-encoded HEAD responses throw EOFException #90

mr-cloud opened this issue Sep 12, 2022 · 0 comments

Comments

@mr-cloud
Copy link
Owner

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
)

ID: 37
Original Author: ryan-williams
link: Original Link

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

1 participant