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

Oleg Kalnichevski updated HTTPCLIENT-1312:
------------------------------------------

         Priority: Minor  (was: Critical)
    Fix Version/s: 4.3 Alpha2
                   4.2.4

The server declares the response content to be GZIP coded while sending back a 
zero length response. I think the server's response is not valid or at the very 
least misleading. I'll make sure HttpClient can handle such protocol deviations.

Oleg 
---
[DEBUG] BasicClientConnectionManager - Get connection for route 
{}->http://www.linkedin.com
[DEBUG] DefaultClientConnectionOperator - Connecting to www.linkedin.com:80
[DEBUG] RequestAddCookies - CookieSpec selected: best-match
[DEBUG] RequestAuthCache - Auth cache not set in the context
[DEBUG] RequestTargetAuthentication - Target auth state: UNCHALLENGED
[DEBUG] RequestProxyAuthentication - Proxy auth state: UNCHALLENGED
[DEBUG] DefaultHttpClient - Attempt 1 to execute request
[DEBUG] DefaultClientConnection - Sending request: GET 
/companies/7099?dspporc=&trk=jobtocomp&goback=%2Efjs_*1_*1_*1_I_gb_*1_*1_1_DD_true_*1_*2_*2_3+2+1_*2_*2_*2_*2_*2
 HTTP/1.1
[DEBUG] headers - >> GET 
/companies/7099?dspporc=&trk=jobtocomp&goback=%2Efjs_*1_*1_*1_I_gb_*1_*1_1_DD_true_*1_*2_*2_3+2+1_*2_*2_*2_*2_*2
 HTTP/1.1
[DEBUG] headers - >> Accept-Encoding: gzip,deflate
[DEBUG] headers - >> Host: www.linkedin.com
[DEBUG] headers - >> Connection: Keep-Alive
[DEBUG] DefaultClientConnection - Receiving response: HTTP/1.1 301 Moved 
Permanently
[DEBUG] headers - << HTTP/1.1 301 Moved Permanently
[DEBUG] headers - << Server: Apache-Coyote/1.1
[DEBUG] headers - << P3P: CP="CAO DSP COR CUR ADMi DEVi TAIi PSAi PSDi IVAi 
IVDi CONi OUR DELi SAMi UNRi PUBi OTRi IND PHY ONL UNI PUR FIN COM NAV INT DEM 
CNT POL PRE"
[DEBUG] headers - << Expires: 0
[DEBUG] headers - << Pragma: no-cache
[DEBUG] headers - << Cache-control: no-cache, must-revalidate, max-age=0
[DEBUG] headers - << Location: 
http://www.linkedin.com/company/7099?goback=%2Efjs_*1_*1_*1_I_gb_*1_*1_1_DD_true_*1_*2_*2_3+2+1_*2_*2_*2_*2_*2&trk=jobtocomp
[DEBUG] headers - << Set-Cookie: 
leo_auth_token="GST:8Rw1Z58nq7UNaWy8kCwFy43aUjfcLwtxBQPuM0lhDjUTOw-ThdmQW7:1359563607:0e6648f880b50f2d33587373f74b66e170e5220a";
 Version=1; Max-Age=1799; Expires=Wed, 30-Jan-2013 17:03:26 GMT; Path=/
[DEBUG] headers - << Set-Cookie: sl="delete me"; Version=1; Max-Age=0; 
Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/
[DEBUG] headers - << Set-Cookie: s_leo_auth_token="delete me"; Version=1; 
Max-Age=0; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/
[DEBUG] headers - << Set-Cookie: JSESSIONID="ajax:8966720506477647157"; 
Version=1; Path=/
[DEBUG] headers - << Set-Cookie: visit="v=1&G"; Version=1; Max-Age=63072000; 
Expires=Fri, 30-Jan-2015 16:33:27 GMT; Path=/
[DEBUG] headers - << Set-Cookie: lang="v=2&lang=en-us&c="; Version=1; 
Domain=linkedin.com; Path=/
[DEBUG] headers - << Content-Encoding: gzip
[DEBUG] headers - << Vary: Accept-Encoding
[DEBUG] headers - << Date: Wed, 30 Jan 2013 16:33:27 GMT
[DEBUG] headers - << Set-Cookie: L1l=6661b8d9; path=/
[DEBUG] headers - << X-FS-UUID: 85dddf814128a843b5253783de2b0cb9
[DEBUG] headers - << X-LI-UUID: hd3fgUEoqEO1JTeD3isMuQ==
[DEBUG] headers - << Age: 0
[DEBUG] headers - << Content-Length: 0
[DEBUG] headers - << Connection: keep-alive
[DEBUG] headers - << Set-Cookie: X-LI-IDC=C1
[DEBUG] headers - << Set-Cookie: 
NSC_MC_QH_MFP=ffffffffaf19b90845525d5f4f58455e445a4a4219de;expires=Wed, 
30-Jan-2013 17:03:27 GMT;path=/;httponly
---
                
> Decompressing on redirects with redirection support off doesn't work properly
> -----------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1312
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1312
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient
>    Affects Versions: 4.2.2
>            Reporter: Nikola Petrov
>            Priority: Minor
>              Labels: gzip, redirect
>             Fix For: 4.2.4, 4.3 Alpha2
>
>
> We are a having a problem with the httpclient implementation on redirecting 
> websites that support gzip encoding. The problem occurs only if the automatic 
> redirect facilities are disabled. Here is a resulting code that fails - note 
> that if you set the HANDLE_REDIRECTS to true it works
> {code:language:java}
>         private static final String PROBLEMATIC_URL = 
> "http://www.linkedin.com/companies/7099?dspporc=&trk=jobtocomp&goback=%2Efjs_*1_*1_*1_I_gb_*1_*1_1_DD_true_*1_*2_*2_3+2+1_*2_*2_*2_*2_*2";;
>         public static void main(String[] args) throws ClientProtocolException,
>                         IOException {
>                 HttpParams httpParams = new BasicHttpParams();
>                 httpParams.setBooleanParameter(ClientPNames.HANDLE_REDIRECTS, 
> Boolean.FALSE);
>                 HttpClient httpclient = new DecompressingHttpClient(new 
> DefaultHttpClient(httpParams));
>                 ResponseHandler<Void> responseHandler = new 
> ResponseHandler<Void>() {
>                         public Void handleResponse(HttpResponse response)
>                                         throws ClientProtocolException, 
> IOException {
>                                 response.getEntity().getContent();
>                                 return null;
>                         }
>                 };
>                 httpclient.execute(new HttpGet(URI.create(PROBLEMATIC_URL)),
>                                 responseHandler);
>         }
> {code}
> The exception I am getting from this is the following on version 4.2.2
> Exception in thread "main" java.io.IOException: Attempted read from closed 
> stream.
> at 
> org.apache.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:138)
> at 
> org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:121)
> at java.util.zip.CheckedInputStream.read(CheckedInputStream.java:42)
> at java.util.zip.GZIPInputStream.readUByte(GZIPInputStream.java:247)
> at java.util.zip.GZIPInputStream.readUShort(GZIPInputStream.java:239)
> at java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:142)
> at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:58)
> at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:67)
> at 
> org.apache.http.client.entity.GzipDecompressingEntity.getDecompressingInputStream(GzipDecompressingEntity.java:56)
> at 
> org.apache.http.client.entity.DecompressingEntity.getContent(DecompressingEntity.java:72)
> at org.apache.http.util.EntityUtils.consume(EntityUtils.java:83)
> at 
> org.apache.http.impl.client.DecompressingHttpClient.execute(DecompressingHttpClient.java:176)
> at 
> org.apache.http.impl.client.DecompressingHttpClient.execute(DecompressingHttpClient.java:165)
> at 
> org.apache.http.impl.client.DecompressingHttpClient.execute(DecompressingHttpClient.java:153)
> at com.ontotext.test.App.main(App.java:42) 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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

Reply via email to