You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Oliver Zemann <ol...@gmail.com> on 2012/09/13 13:59:34 UTC

Not able to fetch an OCSP Response

Hi,

when i try to HttpGet the following URL http://ocsp.a-trust.at/ocsp
(which i can access in FF and get OK 200 with size -1 (no idea why)
its working as expexted) i get an
org.apache.http.ProtocolException: The server failed to respond with a
valid HTTP response

Can someone tell me whats wrong?

String uri = "http://ocsp.a-trust.at/ocsp";
HttpGet httpGet = new HttpGet(uri);
HttpResponse response = httpClient.execute(httpGet); -- here it will
throw the exception


HttpClient 4.2.1 and HttpCore 4.2.1

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


Re: Not able to fetch an OCSP Response

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Thu, 2012-09-13 at 14:16 +0200, Oliver Zemann wrote:
> Maybe thats the problem because the execute call will throw an
> exception. Is there any way to say "ignore the exception, everything
> is fine, please return only the inputstream" ?
> 

You can build a custom message parser and make it accept any garbage as
a valid message.

Oleg

> 2012/9/13 Alexey Panchenko <al...@gmail.com>:
> > The server doesn't return any headers, but some clients are fine with that:
> >
> > wget -d http://ocsp.a-trust.at/ocsp
> >
> > DEBUG output created by Wget 1.12 on linux-gnu.
> >
> > --2012-09-13 14:02:18--  http://ocsp.a-trust.at/ocsp
> > Resolving ocsp.a-trust.at... 217.13.182.78
> > Caching ocsp.a-trust.at => 217.13.182.78
> > Connecting to ocsp.a-trust.at|217.13.182.78|:80... connected.
> > Created socket 3.
> > Releasing 0x08473310 (new refcount 1).
> >
> > ---request begin---
> > GET /ocsp HTTP/1.0
> > User-Agent: Wget/1.12 (linux-gnu)
> > Accept: */*
> > Host: ocsp.a-trust.at
> > Connection: Keep-Alive
> >
> > ---request end---
> > HTTP request sent, awaiting response...
> > ---response begin---
> > ---response end---
> > 200 No headers, assuming HTTP/0.9
> > Length: unspecified
> > Saving to: `ocsp'
> >
> >     [ <=>
> >
> >                                                  ] 5           --.-K/s   in
> > 0s
> >
> > Closed fd 3
> > 2012-09-13 14:02:18 (387 KB/s) - `ocsp' saved [5]
> >
> > Regards,
> > Alex
> >
> > On Thu, Sep 13, 2012 at 1:59 PM, Oliver Zemann <ol...@gmail.com>wrote:
> >
> >> Hi,
> >>
> >> when i try to HttpGet the following URL http://ocsp.a-trust.at/ocsp
> >> (which i can access in FF and get OK 200 with size -1 (no idea why)
> >> its working as expexted) i get an
> >> org.apache.http.ProtocolException: The server failed to respond with a
> >> valid HTTP response
> >>
> >> Can someone tell me whats wrong?
> >>
> >> String uri = "http://ocsp.a-trust.at/ocsp";
> >> HttpGet httpGet = new HttpGet(uri);
> >> HttpResponse response = httpClient.execute(httpGet); -- here it will
> >> throw the exception
> >>
> >>
> >> HttpClient 4.2.1 and HttpCore 4.2.1
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> >> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> >>
> >>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 



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


Re: Not able to fetch an OCSP Response

Posted by Oliver Zemann <ol...@gmail.com>.
Maybe thats the problem because the execute call will throw an
exception. Is there any way to say "ignore the exception, everything
is fine, please return only the inputstream" ?

2012/9/13 Alexey Panchenko <al...@gmail.com>:
> The server doesn't return any headers, but some clients are fine with that:
>
> wget -d http://ocsp.a-trust.at/ocsp
>
> DEBUG output created by Wget 1.12 on linux-gnu.
>
> --2012-09-13 14:02:18--  http://ocsp.a-trust.at/ocsp
> Resolving ocsp.a-trust.at... 217.13.182.78
> Caching ocsp.a-trust.at => 217.13.182.78
> Connecting to ocsp.a-trust.at|217.13.182.78|:80... connected.
> Created socket 3.
> Releasing 0x08473310 (new refcount 1).
>
> ---request begin---
> GET /ocsp HTTP/1.0
> User-Agent: Wget/1.12 (linux-gnu)
> Accept: */*
> Host: ocsp.a-trust.at
> Connection: Keep-Alive
>
> ---request end---
> HTTP request sent, awaiting response...
> ---response begin---
> ---response end---
> 200 No headers, assuming HTTP/0.9
> Length: unspecified
> Saving to: `ocsp'
>
>     [ <=>
>
>                                                  ] 5           --.-K/s   in
> 0s
>
> Closed fd 3
> 2012-09-13 14:02:18 (387 KB/s) - `ocsp' saved [5]
>
> Regards,
> Alex
>
> On Thu, Sep 13, 2012 at 1:59 PM, Oliver Zemann <ol...@gmail.com>wrote:
>
>> Hi,
>>
>> when i try to HttpGet the following URL http://ocsp.a-trust.at/ocsp
>> (which i can access in FF and get OK 200 with size -1 (no idea why)
>> its working as expexted) i get an
>> org.apache.http.ProtocolException: The server failed to respond with a
>> valid HTTP response
>>
>> Can someone tell me whats wrong?
>>
>> String uri = "http://ocsp.a-trust.at/ocsp";
>> HttpGet httpGet = new HttpGet(uri);
>> HttpResponse response = httpClient.execute(httpGet); -- here it will
>> throw the exception
>>
>>
>> HttpClient 4.2.1 and HttpCore 4.2.1
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>>
>>

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


Re: Not able to fetch an OCSP Response

Posted by Alexey Panchenko <al...@gmail.com>.
The server doesn't return any headers, but some clients are fine with that:

wget -d http://ocsp.a-trust.at/ocsp

DEBUG output created by Wget 1.12 on linux-gnu.

--2012-09-13 14:02:18--  http://ocsp.a-trust.at/ocsp
Resolving ocsp.a-trust.at... 217.13.182.78
Caching ocsp.a-trust.at => 217.13.182.78
Connecting to ocsp.a-trust.at|217.13.182.78|:80... connected.
Created socket 3.
Releasing 0x08473310 (new refcount 1).

---request begin---
GET /ocsp HTTP/1.0
User-Agent: Wget/1.12 (linux-gnu)
Accept: */*
Host: ocsp.a-trust.at
Connection: Keep-Alive

---request end---
HTTP request sent, awaiting response...
---response begin---
---response end---
200 No headers, assuming HTTP/0.9
Length: unspecified
Saving to: `ocsp'

    [ <=>

                                                 ] 5           --.-K/s   in
0s

Closed fd 3
2012-09-13 14:02:18 (387 KB/s) - `ocsp' saved [5]

Regards,
Alex

On Thu, Sep 13, 2012 at 1:59 PM, Oliver Zemann <ol...@gmail.com>wrote:

> Hi,
>
> when i try to HttpGet the following URL http://ocsp.a-trust.at/ocsp
> (which i can access in FF and get OK 200 with size -1 (no idea why)
> its working as expexted) i get an
> org.apache.http.ProtocolException: The server failed to respond with a
> valid HTTP response
>
> Can someone tell me whats wrong?
>
> String uri = "http://ocsp.a-trust.at/ocsp";
> HttpGet httpGet = new HttpGet(uri);
> HttpResponse response = httpClient.execute(httpGet); -- here it will
> throw the exception
>
>
> HttpClient 4.2.1 and HttpCore 4.2.1
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>

Re: Not able to fetch an OCSP Response

Posted by Oliver Zemann <ol...@gmail.com>.
org.apache.http.client.ClientProtocolException
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:822)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:732)
...
Caused by: org.apache.http.ProtocolException: The server failed to
respond with a valid HTTP response
	at org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:109)
	at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:252)
	at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:281)
	at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:247)
	at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:219)
	at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:298)
	at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
	at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:645)
	at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:464)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
	... 16 more

2012/9/13 Jean-Marc Spaggiari <je...@spaggiari.org>:
> Can you past the complete exception here? Is there any causes in the exception?
>
> 2012/9/13, Oliver Zemann <ol...@gmail.com>:
>> Hi,
>>
>> when i try to HttpGet the following URL http://ocsp.a-trust.at/ocsp
>> (which i can access in FF and get OK 200 with size -1 (no idea why)
>> its working as expexted) i get an
>> org.apache.http.ProtocolException: The server failed to respond with a
>> valid HTTP response
>>
>> Can someone tell me whats wrong?
>>
>> String uri = "http://ocsp.a-trust.at/ocsp";
>> HttpGet httpGet = new HttpGet(uri);
>> HttpResponse response = httpClient.execute(httpGet); -- here it will
>> throw the exception
>>
>>
>> HttpClient 4.2.1 and HttpCore 4.2.1
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>

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


Re: Not able to fetch an OCSP Response

Posted by Jean-Marc Spaggiari <je...@spaggiari.org>.
Can you past the complete exception here? Is there any causes in the exception?

2012/9/13, Oliver Zemann <ol...@gmail.com>:
> Hi,
>
> when i try to HttpGet the following URL http://ocsp.a-trust.at/ocsp
> (which i can access in FF and get OK 200 with size -1 (no idea why)
> its working as expexted) i get an
> org.apache.http.ProtocolException: The server failed to respond with a
> valid HTTP response
>
> Can someone tell me whats wrong?
>
> String uri = "http://ocsp.a-trust.at/ocsp";
> HttpGet httpGet = new HttpGet(uri);
> HttpResponse response = httpClient.execute(httpGet); -- here it will
> throw the exception
>
>
> HttpClient 4.2.1 and HttpCore 4.2.1
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>

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