Fix for bug #288772: Failure to connect does not set status to EXCEPTED.

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@823 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Simone Bordet 2009-09-07 18:55:43 +00:00
parent bab8d4d31a
commit d6bd35a773
3 changed files with 67 additions and 10 deletions

View File

@ -8,6 +8,7 @@ jetty-7.0.0.RC6-SNAPSHOT
+ JETTY-1093 Request.toString throws exception when size exceeds 4k
+ 288514 AbstractConnector does not handle InterruptedExceptions on shutdown
+ 288466 LocalConnector is not thread safe
+ 288772 Failure to connect does not set status to EXCEPTED
jetty-6.1.20 27 August 2009
+ JETTY-838 Don't log and throw
@ -27,7 +28,7 @@ jetty-6.1.20 27 August 2009
+ JETTY-1080 Ignore files that would be extracted outside the destination directory when unpacking WARs
+ JETTY-1081 Handle null content type in GzipFilter
+ JETTY-1084 Disable GzipFilter for HEAD requests
+ JETTY-1085 Allow url sessionID if cookie invalid
+ JETTY-1085 Allow url sessionID if cookie invalid
+ JETTY-1086 Added UncheckedPrintWriter to avoid ignored EOFs
+ JETTY-1087 Chunked SSL non blocking input
+ JETTY-1098 Upgrade jsp to SJSAS-9_1_1-B60F-07_Jan_2009
@ -80,7 +81,7 @@ jetty-6.1.19 1 July 2009
+ JETTY-1049 Improved transparent proxy usability
+ JETTY-1054 Avoid double deploys
+ JETTY-1055 Cookie quoting
+ JETTY-1057 Error page stack trace XSS
+ JETTY-1057 Error page stack trace XSS
+ JETTY-1058 Handle trailing / with aliases on
+ JETTY-1062 Don't filter cometd message without data

View File

@ -4,11 +4,11 @@
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
// The Eclipse Public License is available at
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
// You may elect to redistribute this code under either of these licenses.
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.eclipse.jetty.client;
@ -30,8 +30,8 @@ import org.eclipse.jetty.io.ByteArrayBuffer;
import org.eclipse.jetty.util.log.Log;
/**
*
*
*
*
*/
public class HttpDestination
{
@ -159,7 +159,7 @@ public class HttpDestination
starting = true;
}
}
if (!starting)
{
try
@ -192,7 +192,7 @@ public class HttpDestination
}
return connection;
}
/* ------------------------------------------------------------------------------- */
public HttpConnection reserveConnection(long timeout) throws IOException
{
@ -221,7 +221,7 @@ public class HttpDestination
if (_idle.size() > 0)
connection = _idle.remove(_idle.size()-1);
}
if (connection==null)
return null;
@ -267,6 +267,7 @@ public class HttpDestination
{
HttpExchange ex = _queue.removeFirst();
ex.getEventListener().onConnectionFailed(throwable);
ex.setStatus(HttpExchange.STATUS_EXCEPTED);
}
}
@ -342,7 +343,7 @@ public class HttpDestination
{
if (connection.isReserved())
connection.setReserved(false);
if (close)
{
try

View File

@ -0,0 +1,55 @@
package org.eclipse.jetty.client;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import junit.framework.TestCase;
/**
* @version $Revision$ $Date$
*/
public class ConnectionFailedTest extends TestCase
{
public void testConnectionFailed() throws Exception
{
HttpClient httpClient = new HttpClient();
httpClient.start();
CountDownLatch latch = new CountDownLatch(1);
HttpExchange exchange = new ConnectionFailedExchange(latch);
exchange.setAddress(new Address("localhost", 8080));
exchange.setURI("/");
httpClient.send(exchange);
boolean passed = latch.await(1000, TimeUnit.MILLISECONDS);
assertTrue(passed);
long wait = 100;
long maxWait = 10 * wait;
long curWait = wait;
while (curWait < maxWait && !exchange.isDone(exchange.getStatus()))
{
Thread.sleep(wait);
curWait += wait;
}
assertEquals(HttpExchange.STATUS_EXCEPTED, exchange.getStatus());
}
private class ConnectionFailedExchange extends HttpExchange
{
private final CountDownLatch latch;
private ConnectionFailedExchange(CountDownLatch latch)
{
this.latch = latch;
}
@Override
protected void onConnectionFailed(Throwable ex)
{
latch.countDown();
}
}
}