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 Guy With Question <gu...@yahoo.com> on 2005/11/03 20:47:44 UTC

Http timeout and 100 Continue

Hello,
 
Background:
I am using HttpClient 3.0 rc4. I am trying to connect to an IIS server using SSL. I need to POST data to that server. My connection timeout is set to 10 seconds. When execute method runs, the first response I get is 100 Continue which is almost immediate, but the HTTP content comes back much after 10 seconds.
 
Question:
I am not sure if HttpClient is using a second connection in the execute method for sending the actual POST data.
1. If the client uses the same connection to POST data, then will the timeout value NOT matter anymore since the client has already recieved 100 Continue immediately?
2. If it uses another connection, then will that connection also have a connection timeout of 10 seconds. If yes, then why is it taking longer than 10 seconds to get my response?
3. If I want to set the connection timeout = 10 seconds from the time the first request is made to the time I get a final response, what do I have to do?
 
Code:

HttpClient httpClient = new HttpClient(new SimpleHttpConnectionManager());

Integer timeout = new Integer(10*1000);



httpClient.getHttpConnectionManager().getParams().setParameter("http.connection.timeout", timeout);

httpPostMethod.setRequestBody(data);

int statusCode = httpClient.executeMethod(httpPostMethod);

 

Thanks in advance!




		
---------------------------------
 Yahoo! FareChase - Search multiple travel sites in one click.  

Re: Http timeout and 100 Continue

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Thu, 2005-11-03 at 11:47 -0800, Guy With Question wrote:
> Hello,
>  
> Background:
> I am using HttpClient 3.0 rc4. I am trying to connect to an IIS server using SSL. I need to POST data to that server. My connection timeout is set to 10 seconds. When execute method runs, the first response I get is 100 Continue which is almost immediate, but the HTTP content comes back much after 10 seconds.
>  
> Question:
> I am not sure if HttpClient is using a second connection in the execute method for sending the actual POST data.

HttpClient does not use a second connection to execute POST requests

> 1. If the client uses the same connection to POST data, then will the timeout value NOT matter anymore since the client has already recieved 100 Continue immediately?

The socket timeout defines the maximum period of inactivity between two
consecutive incoming IP packets, or in other words the maximum period of
time the socket can be blocked in a read operation

The connection timeout defines how long the socket can be blocked
waiting until the socket is ready to send and receive data. It has no
effect on read / write operations

> 2. If it uses another connection, then will that connection also have a connection timeout of 10 seconds. If yes, then why is it taking longer than 10 seconds to get my response?

See above

> 3. If I want to set the connection timeout = 10 seconds from the time the first request is made to the time I get a final response, what do I have to do?

It all depends what you mean by the connection timeout. The maximum time
until the response is received in its entirety?

Hope this helps

Oleg

>  
> Code:
> 
> HttpClient httpClient = new HttpClient(new SimpleHttpConnectionManager());
> 
> Integer timeout = new Integer(10*1000);
> 
> 
> 
> httpClient.getHttpConnectionManager().getParams().setParameter("http.connection.timeout", timeout);
> 
> httpPostMethod.setRequestBody(data);
> 
> int statusCode = httpClient.executeMethod(httpPostMethod);
> 
>  
> 
> Thanks in advance!
> 
> 
> 
> 
> 		
> ---------------------------------
>  Yahoo! FareChase - Search multiple travel sites in one click.  


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