Return-Path: X-Original-To: apmail-hc-httpclient-users-archive@www.apache.org Delivered-To: apmail-hc-httpclient-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 133C79EBA for ; Tue, 29 May 2012 13:35:11 +0000 (UTC) Received: (qmail 45673 invoked by uid 500); 29 May 2012 13:35:10 -0000 Delivered-To: apmail-hc-httpclient-users-archive@hc.apache.org Received: (qmail 45627 invoked by uid 500); 29 May 2012 13:35:10 -0000 Mailing-List: contact httpclient-users-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-users@hc.apache.org Received: (qmail 45616 invoked by uid 99); 29 May 2012 13:35:10 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 May 2012 13:35:10 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lists@nabble.com designates 216.139.236.26 as permitted sender) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 May 2012 13:35:04 +0000 Received: from telerig.nabble.com ([192.168.236.162]) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1SZMZQ-0002aq-06 for httpclient-users@hc.apache.org; Tue, 29 May 2012 06:34:44 -0700 Message-ID: <33925126.post@talk.nabble.com> Date: Tue, 29 May 2012 06:34:43 -0700 (PDT) From: rpinto To: httpclient-users@hc.apache.org Subject: Re: org.apache.http.ProtocolException: Invalid header: HTTP/1.1 200 OK In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Nabble-From: santospinto.rafael@gmail.com References: <33924984.post@talk.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org Hi Sam, thank you very much for your quick response. Is there any example/tutorial for how should hi implement createResponseParser? Thanks in advance, Best regards, RPinto Sam Crawford wrote: >=20 > The issue will be caused by the web server replying with two "HTTP/1.1 > 200 OK" headers. The web server you're connecting to is faulty. >=20 > As a workaround, I would suggest subclassing > DefaultHttpClientConnection and overriding createResponseParser. See > here for more details: > http://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/h= ttp/impl/AbstractHttpClientConnection.html#createResponseParser(org.apache.= http.io.SessionInputBuffer, > org.apache.http.HttpResponseFactory, > org.apache.http.params.HttpParams) >=20 > Hope this helps, >=20 > Sam >=20 >=20 >=20 > On 29 May 2012 14:10, rpinto wrote: >> >> Hi there, >> >> I'm using httpclient (4.1 and also 4.2) and it throws ProtocolException: >> Invalid header: HTTP/1.1 200 OK, and does not allow me to access de >> webcontent. >> >> Here is the stacktrace : >> >> Caused by: org.apache.http.ProtocolException: Invalid header: HTTP/1.1 >> 200 >> OK >> =C2=A0 =C2=A0 =C2=A0 =C2=A0at >> org.apache.http.impl.io.AbstractMessageParser.parseHeaders(AbstractMessa= geParser.java:226) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0at >> org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParse= r.java:261) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0at >> org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(= AbstractHttpClientConnection.java:289) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0at >> org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(= DefaultClientConnection.java:252) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0at >> org.apache.http.impl.conn.ManagedClientConnectionImpl.receiveResponseHea= der(ManagedClientConnectionImpl.java:191) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0at >> org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpReque= stExecutor.java:300) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0at >> org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor= .java:127) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0at >> org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultReq= uestDirector.java:713) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0at >> org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultReques= tDirector.java:518) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0at >> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClien= t.java:906) >> >> >> And here are the Headers from the GET request: >> >> HTTP/1.1 200 OK >> Date: Fri, 09 Jan 1970 00:12:58 GMT >> Server: Boa/0.94.14rc18-ipcam >> Accept-Ranges: bytes >> Connection: close >> HTTP/1.1 200 OK >> Content-Type: multipart/x-mixed-replace;boundary=3DIPCAMJPG >> >> The problem must be Bold line because it does not respect HTTP/1.1. >> >> Is there any workaround or any fix? >> >> Thanks in advance, >> >> Best regards, >> Rafael Pinto >> -- >> View this message in context: >> http://old.nabble.com/org.apache.http.ProtocolException%3A-Invalid-heade= r%3A-HTTP-1.1-200-OK-tp33924984p33924984.html >> Sent from the HttpClient-User mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org >> For additional commands, e-mail: httpclient-users-help@hc.apache.org >> >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org > For additional commands, e-mail: httpclient-users-help@hc.apache.org >=20 >=20 >=20 --=20 View this message in context: http://old.nabble.com/org.apache.http.Protoco= lException%3A-Invalid-header%3A-HTTP-1.1-200-OK-tp33924984p33925126.html Sent from the HttpClient-User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org For additional commands, e-mail: httpclient-users-help@hc.apache.org