[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-1877?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Oleg Kalnichevski resolved HTTPCLIENT-1877.
-------------------------------------------
    Resolution: Invalid

I did some more digging. Commons Compress also fails to decompress the content.

{noformat}
java.util.zip.ZipException: incorrect header check

        at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:164)
        at 
org.apache.commons.compress.compressors.deflate.DeflateCompressorInputStream.read(DeflateCompressorInputStream.java:77)
        at java.io.InputStream.read(InputStream.java:101)
        at 
org.apache.http.client.entity.TestDeflate.testStuffBin(TestDeflate.java:65)
{noformat}

It also fails to detect a format of the content

{noformat}
org.apache.commons.compress.compressors.CompressorException: No Compressor 
found for the stream signature.

        at 
org.apache.commons.compress.compressors.CompressorStreamFactory.detect(CompressorStreamFactory.java:482)
        at 
org.apache.http.client.entity.TestDeflate.testStuffBin(TestDeflate.java:66)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
        at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
        at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
        at 
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
        at 
com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
        at 
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
        at 
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
{noformat}

It turns out {{InflaterInputStream}} _can_ decompress the content of the file, 
at least partially, by using {{Inflater}} in {{nowrap}} mode. However based on 
the state of {{Inflater}} object the stream is expected to have more data. 

If you like to support such content in your code and silently ignore the EOF 
condition you can do so by extending {{DeflateInputStream}} and catching 
{{java.io.EOFException}} but it is not something HttpClient should be doing by 
default.

Oleg 

> java.io.EOFException: Unexpected end of ZLIB input stream
> ---------------------------------------------------------
>
>                 Key: HTTPCLIENT-1877
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1877
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient (classic)
>    Affects Versions: 4.5.3
>         Environment: Java HotSpot(TM) 64-Bit Server VM  1.8.0_144
> Windows 7 Enterprise
>            Reporter: Philippe Mouawad
>         Attachments: stuff.bin, wire.txt
>
>
> At JMeter project a user has reported an issue that generates this stacktrace 
> :
> {code:java}
> java.io.EOFException: Unexpected end of ZLIB input stream
>       at java.util.zip.InflaterInputStream.fill(Unknown Source)
>       at java.util.zip.InflaterInputStream.read(Unknown Source)
>       at 
> org.apache.http.client.entity.DeflateInputStream.read(DeflateInputStream.java:88)
>       at 
> org.apache.http.client.entity.LazyDecompressingInputStream.read(LazyDecompressingInputStream.java:70)
>       at 
> org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:135)
>       at 
> org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:148)
>       at 
> org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.readResponse(HTTPSamplerBase.java:1814)
>       at 
> org.apache.jmeter.protocol.http.sampler.HTTPAbstractImpl.readResponse(HTTPAbstractImpl.java:440)
>       at 
> org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:433)
>       at 
> org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
>       at 
> org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1189)
>       at 
> org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1178)
>       at 
> org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:491)
>       at 
> org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:425)
>       at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:254)
>       at java.lang.Thread.run(Unknown Source)
> {code}
> Although this issue has been reported in the past through 
> https://issues.apache.org/jira/browse/HTTPCLIENT-1699 , it is not yet fixed.
> I have previously reported it under 
> https://issues.apache.org/jira/browse/HTTPCLIENT-1869 and was requested to 
> provide more details
> In the attached log, the issue occurs on second request.
> Removing Deflate from Accept-Encoding is a workaround, so issue is located in 
> Deflate management, GZIP works fine.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to