I am using GZIPInInterceptor (cxf-bundle-jaxrs-2.7.3.jar) on my service for
decompressing gzip requests coming in from clients.
If a client sends a GET request with a 'Content-Encoding: gzip' header, the
interceptor throws an EOFException ( at
org.apache.cxf.transport.common.gzip.GZIPInInterceptor.handleMessage(GZIPInInterceptor.java:85)[151:org.apache.cxf.cxf-rt-core:2.7.3]
) while trying to decompress a non-existent body in the GET request.
Looking at the code, the problem seems to be that
org.apache.cxf.transport.common.gzip.Message.getContent(InputStream.class)
returns a non-null response for a request with no body.
Granted that it does not make sense to be sending a Content-Encoding header
in a GET request, I would expect the interceptor to tolerate this when
there is no "content" in the incoming request. Is this a defect ?
I ran into this while doing some manual testing with SOAP UI, because the
compression setting is at the project level. When I send a GET request (with
compression enabled in Preferences), SOAPUI includes the Content-Encoding
header in the request.
Complete Stacktrace:
org.apache.cxf.interceptor.Fault: Could not unzip compressed message.
at
org.apache.cxf.transport.common.gzip.GZIPInInterceptor.handleMessage(GZIPInInterceptor.java:103)[151:org.apache.cxf.cxf-rt-core:2.7.3]
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)[150:org.apache.cxf.cxf-api:2.7.3]
at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)[150:org.apache.cxf.cxf-api:2.7.3]
at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:355)[167:org.apache.cxf.cxf-rt-transports-http-jetty:2.7.3]
at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:319)[167:org.apache.cxf.cxf-rt-transports-http-jetty:2.7.3]
at
org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:72)[167:org.apache.cxf.cxf-rt-transports-http-jetty:2.7.3]
at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1040)[73:org.eclipse.jetty.server:7.6.8.v20121106]
at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:976)[73:org.eclipse.jetty.server:7.6.8.v20121106]
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)[73:org.eclipse.jetty.server:7.6.8.v20121106]
at
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)[73:org.eclipse.jetty.server:7.6.8.v20121106]
at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)[73:org.eclipse.jetty.server:7.6.8.v20121106]
at
org.eclipse.jetty.server.Server.handle(Server.java:363)[73:org.eclipse.jetty.server:7.6.8.v20121106]
at
org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:483)[73:org.eclipse.jetty.server:7.6.8.v20121106]
at
org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:920)[73:org.eclipse.jetty.server:7.6.8.v20121106]
at
org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:982)[73:org.eclipse.jetty.server:7.6.8.v20121106]
at
org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:635)[69:org.eclipse.jetty.http:7.6.8.v20121106]
at
org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)[69:org.eclipse.jetty.http:7.6.8.v20121106]
at
org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)[73:org.eclipse.jetty.server:7.6.8.v20121106]
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)[68:org.eclipse.jetty.io:7.6.8.v20121106]
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)[68:org.eclipse.jetty.io:7.6.8.v20121106]
at
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)[67:org.eclipse.jetty.util:7.6.8.v20121106]
at
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)[67:org.eclipse.jetty.util:7.6.8.v20121106]
at java.lang.Thread.run(Thread.java:724)[:1.7.0_25]
Caused by: java.io.EOFException
at
java.util.zip.GZIPInputStream.readUByte(GZIPInputStream.java:264)[:1.7.0_25]
at
java.util.zip.GZIPInputStream.readUShort(GZIPInputStream.java:254)[:1.7.0_25]
at
java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:163)[:1.7.0_25]
at
java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:78)[:1.7.0_25]
at
java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:90)[:1.7.0_25]
at
org.apache.cxf.transport.common.gzip.GZIPInInterceptor.handleMessage(GZIPInInterceptor.java:85)[151:org.apache.cxf.cxf-rt-core:2.7.3]
... 22 more
Sample Request:
--
View this message in context:
http://cxf.547215.n5.nabble.com/GZIPInInterceptor-throws-EOFException-for-a-GET-Request-tp5743882.html
Sent from the cxf-user mailing list archive at Nabble.com.