Better might be to move the readResponse(...) call done in processRequest(...) into the retry mechanism used for the writeRequest(...) call instead of adding a retry on another (in this case higher) level, which was my first suggestion. Currently it looks like the HttpClient is supposed to handle a closed socket - a HttpRecoverableException is thrown in the readStatusLine(...) method - but since no retry is done for the reading it will never handle that problem automatically.
So, modified version might look like: private void processRequest(HttpState state, HttpConnection connection) throws HttpException, IOException { log.trace( "enter HttpMethodBase.processRequest(HttpState, HttpConnection)"); //try to do the request int retryCount = 0; do { retryCount++; if (log.isTraceEnabled()) { log.trace("Attempt number " + retryCount + " to write request"); } try { if (!connection.isOpen()) { log.debug("Opening the connection."); connection.open(); } writeRequest(state, connection); readResponse(state, connection); used = true; //request worked, mark this method as used break; //all done } catch (HttpRecoverableException httpre) { log.info("Recoverable exception caught when doing request"); if (log.isDebugEnabled()) { log.debug("Closing the connection."); } connection.close(); if (retryCount == maxRetries) { log.warn( "Attempt to do request has reached max retries: " + maxRetries); throw httpre; } } } while (retryCount <= maxRetries); //everything should be OK at this point } ... or similar... Ortwin, not sure if I understand why a retry only should be done for 1.1. Would you mind elaborating on the reasons for that? The current retry logic is valid for both 1.0 and 1.1, as far as I can tell. Thanks a lot! Regards, /M Ortwin Glück wrote: > But only for HTTP/1.1 > > Jeff Dever wrote: > > This seems reasonable to me. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>