hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vinay Patodia (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HTTPCLIENT-1647) HTTP Client reporting "Garbage in response" whereas response seems to be valid
Date Thu, 14 May 2015 05:39:59 GMT

    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1647?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14543227#comment-14543227
] 

Vinay Patodia commented on HTTPCLIENT-1647:
-------------------------------------------

Thanks Michael. Firstly would like to share my views on the 2 issues of CouchDB pointed by
you:

_1. The content type is simply wrong_
This is what CouchDB has to say at http://docs.couchdb.org/en/1.6.1/intro/api.html
bq. The Content-Type header tells you which MIME type the HTTP response body is and its encoding.
We already know CouchDB returns JSON strings. The appropriate Content-Type header is application/json.
Why do we see text/plain? This is where pragmatism wins over purity. Sending an application/json
Content-Type header will make a browser offer you the returned JSON for download instead of
just displaying it. Since it is extremely useful to be able to test CouchDB from a browser,
CouchDB sends a text/plain content type, so all browsers will display the JSON as text.....

_2. The date output in the JSON body is not ISO 8601_
For CouchDB this is normal string value, it is our application which parses as date. Thanks
for pointing out the anamoly, we are correcting it at our application.

Coming back to the request/response, it is indeed using 4.4.1, accept we set the custom user-agent
as in the code:
{code}
	final org.apache.http.client.methods.HttpGet get = new org.apache.http.client.methods.HttpGet(URL);
	get.setHeader(org.apache.http.protocol.HTTP.USER_AGENT, "Mozilla/5.0 HungamaHttpClient/2.0");
{code}

Let me know if you would like us to share you the logs after commenting the _setHeader_ line




> HTTP Client reporting "Garbage in response" whereas response seems to be valid
> ------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1647
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1647
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient
>    Affects Versions: 4.4.1
>            Reporter: Vinay Patodia
>            Priority: Critical
>
> While we are using httpclient to communicate couchDB. At lot of times we encounter: 
> {noformat}
> Caused by: org.apache.http.ProtocolException: The server failed to respond with a valid
HTTP response
> {noformat}
> On enabling the log we found the following:
> {noformat}
> 2015-05-12 02:54:55 DEBUG org.apache.http.wire : 72 - http-outgoing-2 >> "GET /bbc-metasea-artist-test/27655
HTTP/1.1[\r][\n]"
> 2015-05-12 02:54:55 DEBUG org.apache.http.wire : 72 - http-outgoing-2 >> "User-Agent:
Mozilla/5.0 HungamaHttpClient/2.0[\r][\n]"
> 2015-05-12 02:54:55 DEBUG org.apache.http.wire : 72 - http-outgoing-2 >> "Host:
107.20.145.158:5984[\r][\n]"
> 2015-05-12 02:54:55 DEBUG org.apache.http.wire : 72 - http-outgoing-2 >> "Connection:
Keep-Alive[\r][\n]"
> 2015-05-12 02:54:55 DEBUG org.apache.http.wire : 72 - http-outgoing-2 >> "Accept-Encoding:
gzip,deflate[\r][\n]"
> 2015-05-12 02:54:55 DEBUG org.apache.http.wire : 72 - http-outgoing-2 >> "[\r][\n]"
> 2015-05-12 02:54:55 DEBUG org.apache.http.wire : 72 - http-outgoing-2 << "HTTP/1.1
200 OK[\r][\n]"
> 2015-05-12 02:54:55 DEBUG org.apache.http.wire : 72 - http-outgoing-2 << "Server:
CouchDB/1.6.1 (Erlang OTP/R14B04)[\r][\n]"
> 2015-05-12 02:54:55 DEBUG org.apache.http.wire : 72 - http-outgoing-2 << "ETag:
"4-c76bb63a643c5fed36df0a059c94b94a"[\r][\n]"
> 2015-05-12 02:54:55 DEBUG org.apache.http.wire : 72 - http-outgoing-2 << "Date:
Mon, 11 May 2015 21:25:18 GMT[\r][\n]"
> 2015-05-12 02:54:55 DEBUG org.apache.http.wire : 72 - http-outgoing-2 << "Content-Type:
text/plain; charset=utf-8[\r][\n]"
> 2015-05-12 02:54:55 DEBUG org.apache.http.wire : 72 - http-outgoing-2 << "Content-Length:
281[\r][\n]"
> 2015-05-12 02:54:55 DEBUG org.apache.http.wire : 72 - http-outgoing-2 << "Cache-Control:
must-revalidate[\r][\n]"
> 2015-05-12 02:54:55 DEBUG org.apache.http.wire : 72 - http-outgoing-2 << "[\r][\n]"
> 2015-05-12 02:54:55 DEBUG org.apache.http.wire : 72 - http-outgoing-2 << "{"_id":"27655","_rev":"4-c76bb63a643c5fed36df0a059c94b94a","id":"ms2-Pramod
Chakraborty","title":"Pramod Chakraborty","roles":["producer","director"],"metaseaPublisherPulledAt":"2015-05-10T02:42:06.999+0000","metaseaInvalidatedOn":"2015-05-05T08:23:14.691+0000","metaseaId":27655}[\n]"
> 2015-05-12 02:54:55 DEBUG org.apache.http.impl.conn.DefaultHttpResponseParser : 155 -
Garbage in response: {"_id":"27655","_rev":"4-c76bb63a643c5fed36df0a059c94b94a","id":"ms2-Pramod
Chakraborty","title":"Pramod Chakraborty","roles":["producer","director"],"metaseaPublisherPulledAt":"2015-05-10T02:42:06.999+0000","metaseaInvalidatedOn":"2015-05-05T08:23:14.691+0000","metaseaId":27655}
> {noformat}
> On the face of it, couchdb seems to be giving a proper response. 
> Also we have encountered the thread blocks for reasonable amount not sure but it seems
it waits for timeout, though nothing found in the logs. Something similar behaviour as posted
in HTTPCLIENT-1616



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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


Mime
View raw message