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 Ittay Dror <it...@gmail.com> on 2011/01/04 15:48:06 UTC

getting NoHttpResponseException("The target server failed to respond")

Hello

I'm trying to send a POST request to "http://localhost:8090/my/path", 
and getting the exception in the subject.

The request goes to a the same process.
The servlet handling requests is jersey's ServletContainer.
Requests from an external tool (both to http://localhost:8090/my/path 
and http://localhost:8090) are fine.
Putting a breakpoint in the servlet shows it is not called

I create the request like:
       var httpClient = new DefaultHttpClient

       var httpPost = new HttpPost((new URL(base, requestUrl)).toString)
       httpPost.addHeader("Content-Type", "text/raw")
       httpPost.setEntity(new InputStreamEntity(warmupInput.openStream, -1))
       var response = httpClient.execute(httpPost)

What can be the problem?

Regards,
Ittay

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


Re: getting NoHttpResponseException("The target server failed to respond")

Posted by Ittay Dror <it...@gmail.com>.

Oleg Kalnichevski wrote:
> On Tue, 2011-01-04 at 19:32 +0100, Oleg Kalnichevski wrote:
>>>> In which case HttpClent would use chunk coding to signal the end of the message body. That means there would be at least a closing tag.
>>> I don't know HttpClient like you, but once I put some content in the
>>> file everything works.
>> Please produce wire log of the HTTP session that exhibits the problem.
>>
>> http://hc.apache.org/httpcomponents-client-ga/logging.html
>>
>> Oleg
>>
>>
> I tried to simulate the problem with HttpClient 4.0.3 and Tomcat 6.0.26
> by posting an empty file with 'expect: 100-continue' handshake. For me
> things work as advertised.
>
> [DEBUG] SingleClientConnManager - Get connection for route
> HttpRoute[{}->http://localhost:8080]
> [DEBUG] RequestAddCookies - CookieSpec selected: best-match
> [DEBUG] DefaultHttpClient - Attempt 1 to execute request
> [DEBUG] DefaultClientConnection - Sending request:
> POST /examples/servlets/servlet/RequestInfoExample HTTP/1.1
> [DEBUG] wire ->>  "POST /examples/servlets/servlet/RequestInfoExample
> HTTP/1.1[EOL]"
> [DEBUG] wire ->>  "Transfer-Encoding: chunked[EOL]"
> [DEBUG] wire ->>  "Content-Type: binary/octet-stream[EOL]"
> [DEBUG] wire ->>  "Host: localhost:8080[EOL]"
> [DEBUG] wire ->>  "Connection: Keep-Alive[EOL]"
> [DEBUG] wire ->>  "User-Agent: Apache-HttpClient/4.0.3 (java 1.5)[EOL]"
> [DEBUG] wire ->>  "Expect: 100-Continue[EOL]"
> [DEBUG] wire ->>  "[EOL]"
> [DEBUG] wire -<<  "HTTP/1.1 100 Continue[EOL]"
> [DEBUG] wire -<<  "[EOL]"
> [DEBUG] DefaultClientConnection - Receiving response: HTTP/1.1 100
> Continue
> [DEBUG] wire ->>  "0[EOL]"
> [DEBUG] wire ->>  "[EOL]"
> [DEBUG] wire -<<  "HTTP/1.1 200 OK[EOL]"
> [DEBUG] wire -<<  "Server: Apache-Coyote/1.1[EOL]"
> [DEBUG] wire -<<  "Content-Type: text/html[EOL]"
> [DEBUG] wire -<<  "Content-Length: 690[EOL]"
> [DEBUG] wire -<<  "Date: Tue, 04 Jan 2011 19:23:50 GMT[EOL]"
> [DEBUG] wire -<<  "[EOL]"
> [DEBUG] DefaultClientConnection - Receiving response: HTTP/1.1 200 OK
> [DEBUG] DefaultHttpClient - Connection can be kept alive indefinitely
> [DEBUG] wire -<<  "<html>[\r][\n]"
> [DEBUG] wire -<<  "<body>[\r][\n]"
> [DEBUG] wire -<<  "<head>[\r][\n]"
> [DEBUG] wire -<<  "<title>Request Information Example</title>[\r][\n]"
> [DEBUG] wire -<<  "</head>[\r][\n]"
> [DEBUG] wire -<<  "<body bgcolor="white">[\r][\n]"
> [DEBUG] wire -<<  "<a href="../reqinfo.html">[\r][\n]"
> [DEBUG] wire -<<  "<img src="../images/code.gif" height=24 width=24
> align=right border=0 alt="view code"></a>[\r][\n]"
> [DEBUG] wire -<<  "<a href="../index.html">[\r][\n]"
> [DEBUG] wire -<<  "<img src="../images/return.gif" height=24 width=24
> align=right border=0 alt="return"></a>[\r][\n]"
> [DEBUG] wire -<<  "<h3>Request Information Example</h3>[\r][\n]"
> [DEBUG] wire -<<  "<table border=0><tr><td>[\r][\n]"
> [DEBUG] wire -<<  "Method:[\r][\n]"
> [DEBUG] wire -<<  "</td><td>[\r][\n]"
> [DEBUG] wire -<<  "POST[\r][\n]"
> [DEBUG] wire -<<  "</td></tr><tr><td>[\r][\n]"
> [DEBUG] wire -<<  "Request URI:[\r][\n]"
> [DEBUG] wire -<<  "</td><td>[\r][\n]"
> [DEBUG] wire -<<
> "/examples/servlets/servlet/RequestInfoExample[\r][\n]"
> [DEBUG] wire -<<  "</td></tr><tr><td>[\r][\n]"
> [DEBUG] wire -<<  "Protocol:[\r][\n]"
> [DEBUG] wire -<<  "</td><td>[\r][\n]"
> [DEBUG] wire -<<  "HTTP/1.1[\r][\n]"
> [DEBUG] wire -<<  "</td></tr><tr><td>[\r][\n]"
> [DEBUG] wire -<<  "Path Info:[\r][\n]"
> [DEBUG] wire -<<  "</td><td>[\r][\n]"
> [DEBUG] wire -<<  "null[\r][\n]"
> [DEBUG] wire -<<  "</td></tr><tr><td>[\r][\n]"
> [DEBUG] wire -<<  "Remote Address:[\r][\n]"
> [DEBUG] wire -<<  "</td><td>[\r][\n]"
> [DEBUG] wire -<<  "127.0.0.1[\r][\n]"
> [DEBUG] wire -<<  "</table>[\r][\n]"
> [DEBUG] SingleClientConnManager - Releasing connection
> org.apache.http.impl.conn.SingleClientConnManager$ConnAdapter@a20892
> [DEBUG] DefaultClientConnection - Connection shut down
>
>
I'm working with Jetty (embedded)
>
> ---------------------------------------------------------------------
> 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: getting NoHttpResponseException("The target server failed to respond")

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2011-01-04 at 19:32 +0100, Oleg Kalnichevski wrote:
> > >>>
> > > In which case HttpClent would use chunk coding to signal the end of the message body. That means there would be at least a closing tag.
> > 
> > I don't know HttpClient like you, but once I put some content in the 
> > file everything works.
> > >
> 
> Please produce wire log of the HTTP session that exhibits the problem.
> 
> http://hc.apache.org/httpcomponents-client-ga/logging.html
> 
> Oleg
> 
> 

I tried to simulate the problem with HttpClient 4.0.3 and Tomcat 6.0.26
by posting an empty file with 'expect: 100-continue' handshake. For me
things work as advertised.

[DEBUG] SingleClientConnManager - Get connection for route
HttpRoute[{}->http://localhost:8080]
[DEBUG] RequestAddCookies - CookieSpec selected: best-match
[DEBUG] DefaultHttpClient - Attempt 1 to execute request
[DEBUG] DefaultClientConnection - Sending request:
POST /examples/servlets/servlet/RequestInfoExample HTTP/1.1
[DEBUG] wire - >> "POST /examples/servlets/servlet/RequestInfoExample
HTTP/1.1[EOL]"
[DEBUG] wire - >> "Transfer-Encoding: chunked[EOL]"
[DEBUG] wire - >> "Content-Type: binary/octet-stream[EOL]"
[DEBUG] wire - >> "Host: localhost:8080[EOL]"
[DEBUG] wire - >> "Connection: Keep-Alive[EOL]"
[DEBUG] wire - >> "User-Agent: Apache-HttpClient/4.0.3 (java 1.5)[EOL]"
[DEBUG] wire - >> "Expect: 100-Continue[EOL]"
[DEBUG] wire - >> "[EOL]"
[DEBUG] wire - << "HTTP/1.1 100 Continue[EOL]"
[DEBUG] wire - << "[EOL]"
[DEBUG] DefaultClientConnection - Receiving response: HTTP/1.1 100
Continue
[DEBUG] wire - >> "0[EOL]"
[DEBUG] wire - >> "[EOL]"
[DEBUG] wire - << "HTTP/1.1 200 OK[EOL]"
[DEBUG] wire - << "Server: Apache-Coyote/1.1[EOL]"
[DEBUG] wire - << "Content-Type: text/html[EOL]"
[DEBUG] wire - << "Content-Length: 690[EOL]"
[DEBUG] wire - << "Date: Tue, 04 Jan 2011 19:23:50 GMT[EOL]"
[DEBUG] wire - << "[EOL]"
[DEBUG] DefaultClientConnection - Receiving response: HTTP/1.1 200 OK
[DEBUG] DefaultHttpClient - Connection can be kept alive indefinitely
[DEBUG] wire - << "<html>[\r][\n]"
[DEBUG] wire - << "<body>[\r][\n]"
[DEBUG] wire - << "<head>[\r][\n]"
[DEBUG] wire - << "<title>Request Information Example</title>[\r][\n]"
[DEBUG] wire - << "</head>[\r][\n]"
[DEBUG] wire - << "<body bgcolor="white">[\r][\n]"
[DEBUG] wire - << "<a href="../reqinfo.html">[\r][\n]"
[DEBUG] wire - << "<img src="../images/code.gif" height=24 width=24
align=right border=0 alt="view code"></a>[\r][\n]"
[DEBUG] wire - << "<a href="../index.html">[\r][\n]"
[DEBUG] wire - << "<img src="../images/return.gif" height=24 width=24
align=right border=0 alt="return"></a>[\r][\n]"
[DEBUG] wire - << "<h3>Request Information Example</h3>[\r][\n]"
[DEBUG] wire - << "<table border=0><tr><td>[\r][\n]"
[DEBUG] wire - << "Method:[\r][\n]"
[DEBUG] wire - << "</td><td>[\r][\n]"
[DEBUG] wire - << "POST[\r][\n]"
[DEBUG] wire - << "</td></tr><tr><td>[\r][\n]"
[DEBUG] wire - << "Request URI:[\r][\n]"
[DEBUG] wire - << "</td><td>[\r][\n]"
[DEBUG] wire - <<
"/examples/servlets/servlet/RequestInfoExample[\r][\n]"
[DEBUG] wire - << "</td></tr><tr><td>[\r][\n]"
[DEBUG] wire - << "Protocol:[\r][\n]"
[DEBUG] wire - << "</td><td>[\r][\n]"
[DEBUG] wire - << "HTTP/1.1[\r][\n]"
[DEBUG] wire - << "</td></tr><tr><td>[\r][\n]"
[DEBUG] wire - << "Path Info:[\r][\n]"
[DEBUG] wire - << "</td><td>[\r][\n]"
[DEBUG] wire - << "null[\r][\n]"
[DEBUG] wire - << "</td></tr><tr><td>[\r][\n]"
[DEBUG] wire - << "Remote Address:[\r][\n]"
[DEBUG] wire - << "</td><td>[\r][\n]"
[DEBUG] wire - << "127.0.0.1[\r][\n]"
[DEBUG] wire - << "</table>[\r][\n]"
[DEBUG] SingleClientConnManager - Releasing connection
org.apache.http.impl.conn.SingleClientConnManager$ConnAdapter@a20892
[DEBUG] DefaultClientConnection - Connection shut down




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


Re: getting NoHttpResponseException("The target server failed to respond")

Posted by Oleg Kalnichevski <ol...@apache.org>.
> >>>
> > In which case HttpClent would use chunk coding to signal the end of the message body. That means there would be at least a closing tag.
> 
> I don't know HttpClient like you, but once I put some content in the 
> file everything works.
> >

Please produce wire log of the HTTP session that exhibits the problem.

http://hc.apache.org/httpcomponents-client-ga/logging.html

Oleg



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


Re: getting NoHttpResponseException("The target server failed to respond")

Posted by Ittay Dror <it...@gmail.com>.

Oleg Kalnichevski wrote:
> "Ittay Dror"<it...@gmail.com>  wrote:
>
>>
>> Oleg Kalnichevski wrote:
>>> "Ittay Dror"<it...@gmail.com>   wrote:
>>>
>>>> Oleg Kalnichevski wrote:
>>>>> On Tue, 2011-01-04 at 17:30 +0200, Ittay Dror wrote:
>>>>>> It turns out this is because my warmupInput file was empty. The
>>>> server
>>>>>> responded with 100 (continue), but because the file was empty
>>>> nothing
>>>>>> was written to the output stream, so after a while there was a
>>>> timeout.
>>>>>> IMHO, this is a bug. Either an empty input should be posted, or I
>>>> should
>>>>>> get a more accurate error ("nothing to post")
>>>>>>
>>>>>> Ittay
>>>>>>
>>>>> The protocol interceptor responsible for generating 'expect:
>>>>> 100-continue' header does not add the header to messages with empty
>>>>> request bodies [1]. Feel free to doubled-check.
>>>>>
>>>>>
>> http://hc.apache.org/httpcomponents-core-ga/httpcore/xref/org/apache/http/protocol/RequestExpectContinue.html
>>>> Then the error message should reflect that. I also think it should
>> come
>>>> before the timeout. The server says to continue, the client doesn't
>>>> continue, so obviously the server will not process anything.
>>>>
>>>> Ittay
>>>>
>>>>
>>>>> Oleg
>>>>>
>>>>>
>>>>>
>>>>>
>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>>>>> For additional commands, e-mail:
>> httpclient-users-help@hc.apache.org
>>> Reflect what exactly? HttpClient does not generate 'expect' header
>> for empty messages as required by the http spec, so the server was not
>> meant to send 100 response in the first place.
>>
>> *if*  (entity !=*null*&&   entity.getContentLength() != 0) {
>>
>> in my case, i created the entity with length -1, as i don't know the
>> actual length.
>>
>>
>>> If you are still convinced HttpClient is at fault here please post a
>> complete wire/context log of the session. I will have a look at it.
>>> Oleg
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>>> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>>>
> In which case HttpClent would use chunk coding to signal the end of the message body. That means there would be at least a closing tag.

I don't know HttpClient like you, but once I put some content in the 
file everything works.
> Oleg
>
> ---------------------------------------------------------------------
> 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: getting NoHttpResponseException("The target server failed to respond")

Posted by Oleg Kalnichevski <ol...@apache.org>.
"Ittay Dror" <it...@gmail.com> wrote:

>
>
>Oleg Kalnichevski wrote:
>> "Ittay Dror"<it...@gmail.com>  wrote:
>>
>>>
>>> Oleg Kalnichevski wrote:
>>>> On Tue, 2011-01-04 at 17:30 +0200, Ittay Dror wrote:
>>>>> It turns out this is because my warmupInput file was empty. The
>>> server
>>>>> responded with 100 (continue), but because the file was empty
>>> nothing
>>>>> was written to the output stream, so after a while there was a
>>> timeout.
>>>>> IMHO, this is a bug. Either an empty input should be posted, or I
>>> should
>>>>> get a more accurate error ("nothing to post")
>>>>>
>>>>> Ittay
>>>>>
>>>> The protocol interceptor responsible for generating 'expect:
>>>> 100-continue' header does not add the header to messages with empty
>>>> request bodies [1]. Feel free to doubled-check.
>>>>
>>>>
>>>
>http://hc.apache.org/httpcomponents-core-ga/httpcore/xref/org/apache/http/protocol/RequestExpectContinue.html
>>> Then the error message should reflect that. I also think it should
>come
>>>
>>> before the timeout. The server says to continue, the client doesn't
>>> continue, so obviously the server will not process anything.
>>>
>>> Ittay
>>>
>>>
>>>> Oleg
>>>>
>>>>
>>>>
>>>>
>---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>>>> For additional commands, e-mail:
>httpclient-users-help@hc.apache.org
>>>>
>> Reflect what exactly? HttpClient does not generate 'expect' header
>for empty messages as required by the http spec, so the server was not
>meant to send 100 response in the first place.
>
>*if*  (entity !=*null*  &&  entity.getContentLength() != 0) {
>
>in my case, i created the entity with length -1, as i don't know the
>actual length.
>
>
>> If you are still convinced HttpClient is at fault here please post a
>complete wire/context log of the session. I will have a look at it.
>>
>> Oleg
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>>

In which case HttpClent would use chunk coding to signal the end of the message body. That means there would be at least a closing tag.

Oleg

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


Re: getting NoHttpResponseException("The target server failed to respond")

Posted by Ittay Dror <it...@gmail.com>.

Oleg Kalnichevski wrote:
> "Ittay Dror"<it...@gmail.com>  wrote:
>
>>
>> Oleg Kalnichevski wrote:
>>> On Tue, 2011-01-04 at 17:30 +0200, Ittay Dror wrote:
>>>> It turns out this is because my warmupInput file was empty. The
>> server
>>>> responded with 100 (continue), but because the file was empty
>> nothing
>>>> was written to the output stream, so after a while there was a
>> timeout.
>>>> IMHO, this is a bug. Either an empty input should be posted, or I
>> should
>>>> get a more accurate error ("nothing to post")
>>>>
>>>> Ittay
>>>>
>>> The protocol interceptor responsible for generating 'expect:
>>> 100-continue' header does not add the header to messages with empty
>>> request bodies [1]. Feel free to doubled-check.
>>>
>>>
>> http://hc.apache.org/httpcomponents-core-ga/httpcore/xref/org/apache/http/protocol/RequestExpectContinue.html
>> Then the error message should reflect that. I also think it should come
>>
>> before the timeout. The server says to continue, the client doesn't
>> continue, so obviously the server will not process anything.
>>
>> Ittay
>>
>>
>>> Oleg
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>>> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>>>
> Reflect what exactly? HttpClient does not generate 'expect' header for empty messages as required by the http spec, so the server was not meant to send 100 response in the first place.

*if*  (entity !=*null*  &&  entity.getContentLength() != 0) {

in my case, i created the entity with length -1, as i don't know the actual length.


> If you are still convinced HttpClient is at fault here please post a complete wire/context log of the session. I will have a look at it.
>
> Oleg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>

Re: getting NoHttpResponseException("The target server failed to respond")

Posted by Oleg Kalnichevski <ol...@apache.org>.
"Ittay Dror" <it...@gmail.com> wrote:

>
>
>Oleg Kalnichevski wrote:
>> On Tue, 2011-01-04 at 17:30 +0200, Ittay Dror wrote:
>>> It turns out this is because my warmupInput file was empty. The
>server
>>> responded with 100 (continue), but because the file was empty
>nothing
>>> was written to the output stream, so after a while there was a
>timeout.
>>>
>>> IMHO, this is a bug. Either an empty input should be posted, or I
>should
>>> get a more accurate error ("nothing to post")
>>>
>>> Ittay
>>>
>> The protocol interceptor responsible for generating 'expect:
>> 100-continue' header does not add the header to messages with empty
>> request bodies [1]. Feel free to doubled-check.
>>
>>
>http://hc.apache.org/httpcomponents-core-ga/httpcore/xref/org/apache/http/protocol/RequestExpectContinue.html
>Then the error message should reflect that. I also think it should come
>
>before the timeout. The server says to continue, the client doesn't 
>continue, so obviously the server will not process anything.
>
>Ittay
>
>
>> Oleg
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>>

Reflect what exactly? HttpClient does not generate 'expect' header for empty messages as required by the http spec, so the server was not meant to send 100 response in the first place.

If you are still convinced HttpClient is at fault here please post a complete wire/context log of the session. I will have a look at it.

Oleg

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


Re: getting NoHttpResponseException("The target server failed to respond")

Posted by Ittay Dror <it...@gmail.com>.

Oleg Kalnichevski wrote:
> On Tue, 2011-01-04 at 17:30 +0200, Ittay Dror wrote:
>> It turns out this is because my warmupInput file was empty. The server
>> responded with 100 (continue), but because the file was empty nothing
>> was written to the output stream, so after a while there was a timeout.
>>
>> IMHO, this is a bug. Either an empty input should be posted, or I should
>> get a more accurate error ("nothing to post")
>>
>> Ittay
>>
> The protocol interceptor responsible for generating 'expect:
> 100-continue' header does not add the header to messages with empty
> request bodies [1]. Feel free to doubled-check.
>
> http://hc.apache.org/httpcomponents-core-ga/httpcore/xref/org/apache/http/protocol/RequestExpectContinue.html
Then the error message should reflect that. I also think it should come 
before the timeout. The server says to continue, the client doesn't 
continue, so obviously the server will not process anything.

Ittay


> Oleg
>
>
>
> ---------------------------------------------------------------------
> 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: getting NoHttpResponseException("The target server failed to respond")

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2011-01-04 at 17:30 +0200, Ittay Dror wrote:
> It turns out this is because my warmupInput file was empty. The server 
> responded with 100 (continue), but because the file was empty nothing 
> was written to the output stream, so after a while there was a timeout.
> 
> IMHO, this is a bug. Either an empty input should be posted, or I should 
> get a more accurate error ("nothing to post")
> 
> Ittay
> 

The protocol interceptor responsible for generating 'expect:
100-continue' header does not add the header to messages with empty
request bodies [1]. Feel free to doubled-check.

http://hc.apache.org/httpcomponents-core-ga/httpcore/xref/org/apache/http/protocol/RequestExpectContinue.html

Oleg



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


Re: getting NoHttpResponseException("The target server failed to respond")

Posted by Ittay Dror <it...@gmail.com>.
It turns out this is because my warmupInput file was empty. The server 
responded with 100 (continue), but because the file was empty nothing 
was written to the output stream, so after a while there was a timeout.

IMHO, this is a bug. Either an empty input should be posted, or I should 
get a more accurate error ("nothing to post")

Ittay

Ittay Dror wrote:
> Hello
>
> I'm trying to send a POST request to "http://localhost:8090/my/path", 
> and getting the exception in the subject.
>
> The request goes to a the same process.
> The servlet handling requests is jersey's ServletContainer.
> Requests from an external tool (both to http://localhost:8090/my/path 
> and http://localhost:8090) are fine.
> Putting a breakpoint in the servlet shows it is not called
>
> I create the request like:
>       var httpClient = new DefaultHttpClient
>
>       var httpPost = new HttpPost((new URL(base, requestUrl)).toString)
>       httpPost.addHeader("Content-Type", "text/raw")
>       httpPost.setEntity(new InputStreamEntity(warmupInput.openStream, 
> -1))
>       var response = httpClient.execute(httpPost)
>
> What can be the problem?
>
> Regards,
> Ittay

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