EOFException using NetHttpTransport on HEAD request with gzip encoding #169
Labels
priority: p0
Highest priority. Critical issue. P0 implies highest priority.
🚨
This issue needs some love.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
From yan...@google.com on November 26, 2012 12:37:44
Version of google-http-java-client (e.g. 1.5.0-beta)? 1.12.0-beta Java environment (e.g. Java 6, Android 2.3, App Engine)? All Describe the problem. Make a HEAD request using NetHttpTransport to gzip-encoded content and it will result in an EOFException.
Here's the log output and stack trace in a sample I've written:
CONFIG: -------------- REQUEST --------------
HEAD https://www.googleapis.com/calendar/v3/users/me/calendarList Accept-Encoding: gzip
Authorization:
User-Agent: Google-CalendarSample/1.0 Google-HTTP-Java-Client/1.12.0-beta (gzip)
Nov 26, 2012 3:31:50 PM com.google.api.client.http.HttpRequest execute
CONFIG: curl -v --compressed -X HEAD -H 'Accept-Encoding: gzip' -H 'Authorization: ' -H 'User-Agent: Google-CalendarSample/1.0 Google-HTTP-Java-Client/1.12.0-beta (gzip)' -- https://www.googleapis.com/calendar/v3/users/me/calendarList Nov 26, 2012 3:31:52 PM com.google.api.client.http.HttpResponse
CONFIG: -------------- RESPONSE --------------
HTTP/1.1 200 OK
ETag: "NybCyMgjkLQM6Il-p8A5652MtaE/E86055QdXW578YkMcayX-pGgswY"
Content-Length: 1071
Expires: Fri, 01 Jan 1990 00:00:00 GMT
X-Google-Apiary-Auth-User: 866721763087
X-Google-GFE-Service-Trace: apiserving
X-XSS-Protection: 1; mode=block
Server: GSE
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Google-DOS-Service-Trace: apiserving
X-Google-GFE-Response-Code-Details-Trace: response_code_set_by_backend
Date: Mon, 26 Nov 2012 20:31:52 GMT
X-Google-GFE-Request-Trace: qekt19:443,/bns/yn/borg/yn/bns/apiserving/prod_api_frontend.server/4,qekt19:443
X-Google-Apiary-Auth-Expires: 1353962210000
X-Google-Apiary-Auth-Scopes: https://www.googleapis.com/auth/calendar X-Google-ServerType: apiserving
Content-Encoding: gzip
X-Google-Backends: yhia77:9854,/bns/yn/borg/yn/bns/apiserving/prod_api_frontend.server/4,qekt19:443
X-Google-Service: apiserving
Content-Type: application/json; charset=UTF-8
java.io.EOFException
at java.util.zip.GZIPInputStream.readUByte(GZIPInputStream.java:264)
at java.util.zip.GZIPInputStream.readUShort(GZIPInputStream.java:254)
at java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:163)
at java.util.zip.GZIPInputStream.(GZIPInputStream.java:78)
at java.util.zip.GZIPInputStream.(GZIPInputStream.java:90)
at com.google.api.client.http.HttpResponse.getContent(HttpResponse.java:370)
at com.google.api.client.http.HttpResponse.ignore(HttpResponse.java:432)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUsingHead(AbstractGoogleClientRequest.java:383)
at com.google.api.services.calendar.Calendar$CalendarList$List.executeUsingHead(Calendar.java:636)
at com.google.api.services.samples.calendar.cmdline.CalendarSample.showCalendars(CalendarSample.java:116)
at com.google.api.services.samples.calendar.cmdline.CalendarSample.main(CalendarSample.java:95) How would you expect it to be fixed? It should behave the same as for ApacheHttpTransport and not throw an EOFException and treat the content as empty.
Original issue: http://code.google.com/p/google-http-java-client/issues/detail?id=169
The text was updated successfully, but these errors were encountered: