You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Gerdes, Tom" <TG...@OldRepublicTitle.com> on 2006/08/23 18:39:43 UTC

Response Content Error

I am having a problem reading the response body text being sent back by
the server that I send a GET request to.   The response body appears to
me to not be uncompressed.  I am not sure if this an error in my java
application or an error by the server.   When I run a separate trace
tracing my Web Browser connecting to the same site, it is able to
uncompress the response text from the server.   When I do a wire trace
of my Httpclient 3.0 session the data is not returned as uncompressed.
I tried to receive the response in the Java application using the
getResponseBodyAsString() and then later tried
getResponseBodyAsStream().  Neither was able to provide the response as
a text value.  What can I do to get the response body text.  

 

Here is a snippet of the wire trace: 

 

Attempting to contact
host...https://miwebcombank.ebanking-services.com/Nubi/signin.aspx


The URI get1:
https://miwebcombank.ebanking-services.com/Nubi/signin.aspx


FINE >> "GET /Nubi/signin.aspx HTTP/1.1[\r][\n]"


FINE >> "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/x-shockwave-flash, application/vnd.ms-excel, ap

plication/vnd.ms-powerpoint, application/msword, */*[\r][\n]"


FINE >> "Accept-Language: en-us[\r][\n]"


FINE >> "Accept-Encoding: gzip, deflate[\r][\n]"


FINE >> "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;
SV1; .NET CLR 1.1.4322)[\r][\n]"                         

FINE >> "Connection: Keep-Alive[\r][\n]"


FINE >> "Host: miwebcombank.ebanking-services.com[\r][\n]"


FINE >> "[\r][\n]"


FINE << "HTTP/1.1 200 OK[\r][\n]"


FINE << "Date: Wed, 23 Aug 2006 14:35:14 GMT[\r][\n]"


FINE << "Server: Microsoft-IIS/6.0[\r][\n]"


FINE << "X-Powered-By: ASP.NET[\r][\n]"


FINE << "X-AspNet-Version: 2.0.50727[\r][\n]"


FINE << "Set-Cookie: ASP.NET_SessionId=hzao3h455kygyg55vvksaqzq; path=/;
HttpOnly[\r][\n]"

FINE << "Set-Cookie: NubiWebAuth=; expires=Tue, 12-Oct-1999 04:00:00
GMT; path=/; HttpOnly[\r][\n]"                              

FINE << "Cache-Control: no-cache[\r][\n]"


FINE << "Pragma: no-cache[\r][\n]"


FINE << "Expires: -1[\r][\n]"


FINE << "Content-Type: text/html; charset=utf-8[\r][\n]"


FINE << "Set-Cookie: NSC_0cb5ee5701bb=8efbb43b1518;path=/[\r][\n]"


FINE << "Cache-Control: private[\r][\n]"


FINE << "Content-Encoding: gzip[\r][\n]"


FINE << "Content-Length: 7075[\r][\n]"


HTTP/1.1 200 OK


FINE <<
"[0x1f][0x8b][0x8][0x0][0x0][0x0][0x0][0x0][0x0][0x3][0xed]|is[0xe2][0xc
8][0xb2][0xe8][0xe7][0x9e][0x88][0xf9][0xf][0x1a]

n[0xbc]c[0xfb][0xd0][0xb6][0x84][0xd8]m[0xd3]'[0x4][0x8]$6[0x1][0x12][0x
eb][0x89][0x9][0x87]6[0x84]@[0x1b]Z[0xd8][0xfa][0xce]  YZ

X[0xdc][0xb6][0xbb]{f[0xee]{[0xef][0xc6][0xbb][0xd5]3[0x96]TU[0x99][0x95
][0x99][0x95][0x95][0x95][0x99]*[0xf1][0xeb]/[0xbf][0xfe]

[0xf2][0xfc][[0x9d][0xab][0x9][0xb3]>[0x8d]1B[0xb7][0x83][0xf5]G[0xd5][0
xe][[0xc3]R[0xf7]8>[0xc9][0xd6]p[0xbc].[0xd4][0xa3][0x86]

[0xdc][0x3][0x81][0x9][0xae]hy[0xba][0xaf][0xdb][0x96]h[0xe0]8[0xdd]Ka_~
E([0x96][0xbe]i`{[0xd3][0xb0][0xbc]Jj[0xe9][0xfb][0xce]#[

0x8e][0xef]v[0xbb][0x87]][0xf6][0xc1]v5<S.[0x97][0xf1]=[0xea][0x13][0xf6
] ^[0xaa][0xa2][0x82][0xe9]J%[0xf5]"[0xfb][0x6][0xf1]b[0x

be][0xa0]&[0x6]*S_[0x9e]}[0xdd]7T[0xe8][0xf4][0xa9][0xab]OT[0x9][0xab][0
xd9][0xa6][0xa9][0xba][0xb2].[0x1a]XU[0xb4][0xd6][0x0][0x

 

                                        


Re: Response Content Error

Posted by Ortwin Glück <od...@odi.ch>.

Gerdes, Tom wrote:
> FINE >> "Accept-Encoding: gzip, deflate[\r][\n]"

Why are you sending this in the first place? Stock HttpClient does NOT 
handle any content encoding.

> FINE << "Content-Encoding: gzip[\r][\n]"

In your case this should do the trick:

InputStream in = method.getResponseAsStream();
Header enc = method.getResponseHeader("Content-Encoding");
if (enc != null && "gzip".equals(enc.getValue())) {
   InputStream in = new GZIPInputStream(in);
}


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Re: Response Content Error

Posted by Roland Weber <ht...@dubioso.net>.
Hello Tom,

> FINE >> "Accept-Encoding: gzip, deflate[\r][\n]"

HttpClient does not and will not support content compression.
If you decide to send an Accept-Encoding header, then your
application should be prepared to deal with compressed responses.
Otherwise, don't send that header.
See section 5.5 of the primer, last paragraph:
http://wiki.apache.org/jakarta-httpclient/ForAbsoluteBeginners#head-8ce973d0347a2eba238f594c47f478035c51ea66

cheers,
  Roland

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org