Exception when accessing the content of a redirected URL
See original GitHub issueAm getting
Exception in thread "main" java.io.IOException: ID1ID2: actual 0x00003c68 != expected 0x00001f8b
at okio.GzipSource.checkEqual(GzipSource.java:205)
at okio.GzipSource.consumeHeader(GzipSource.java:120)
at okio.GzipSource.read(GzipSource.java:73)
at okio.Buffer.writeAll(Buffer.java:996)
at okio.RealBufferedSource.readByteArray(RealBufferedSource.java:106)
at okhttp3.ResponseBody.bytes(ResponseBody.java:135)
when fetching https://sgs.taleo.net/careersection/qam/jobdetail.ftl?job=026018
Here is some code to reproduce the issue
String url = args[0];
OkHttpClient client = new OkHttpClient.Builder().followRedirects(false)
.build();
Request request = new Request.Builder().url(url).build();
Response response = client.newCall(request).execute();
System.out.println("body length "+response.body().bytes().length);
System.out.println("code "+response.code());
I tried with Apache’s HTTPClient and it complains about java.util.zip.ZipException: Not in GZIP format
curl deals with it fine
Issue Analytics
- State:
- Created 6 years ago
- Comments:18 (8 by maintainers)
Top Results From Across the Web
How can I redirect URL in case of exception or invalid input ...
I want to redirect the URL in case of exception or invalid input and return (print to the client) the exception with addition...
Read more >How to Use JavaScript to Redirect a URL
Learn 3 of the most common ways to redirect a URL using JavaScript the location object: setting a new window.location.href property, ...
Read more >Prevent open redirect attacks in ASP.NET Core
Whenever your application logic redirects to a specified URL, you must verify that the redirection URL hasn't been tampered with. ASP.
Read more >How to Troubleshoot Browser Content Redirection
This could be due to the desired behavior as configured through BCR policies, or server fallback may have occurred unintentionally due to a...
Read more >Redirect to the Previous URL After Login with Spring Security
2. Common Practice · using HTTP Referer header · saving the original request in the session · appending original URL to the redirected...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I wasn’t able to reproduce this. If you want to disable transparent gzip do this:
Tried the snippet below with 3.8.0 and still getting
Exception in thread “main” java.io.IOException: ID1ID2: actual 0x00003c68 != expected 0x00001f8b at okio.GzipSource.checkEqual(GzipSource.java:205) at okio.GzipSource.consumeHeader(GzipSource.java:120) at okio.GzipSource.read(GzipSource.java:73) at okio.Buffer.writeAll(Buffer.java:1005) at okio.RealBufferedSource.readByteArray(RealBufferedSource.java:107) at okhttp3.ResponseBody.bytes(ResponseBody.java:136) at Test.main(Test.java:18)
with
https://sgs.taleo.net/careersection/qam/jobdetail.ftl?job=026018
Here is the code