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.

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/http/impl/AbstractHttpClientConnection.html#createResponseParser(org.apache.http.io.SessionInputBuffer,
org.apache.http.HttpResponseFactory,
org.apache.http.params.HttpParams)

Hope this helps,

Sam



On 29 May 2012 14:10, rpinto <santospinto.raf...@gmail.com> 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
>        at
> org.apache.http.impl.io.AbstractMessageParser.parseHeaders(AbstractMessageParser.java:226)
>        at
> org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:261)
>        at
> org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:289)
>        at
> org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:252)
>        at
> org.apache.http.impl.conn.ManagedClientConnectionImpl.receiveResponseHeader(ManagedClientConnectionImpl.java:191)
>        at
> org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:300)
>        at
> org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:127)
>        at
> org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:713)
>        at
> org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:518)
>        at
> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.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=IPCAMJPG
>
> 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-header%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-unsubscr...@hc.apache.org
> For additional commands, e-mail: httpclient-users-h...@hc.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org

Reply via email to