diff --git a/VERSION.txt b/VERSION.txt index 5e2cc0f8c16..94136d61bfb 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -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 diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java index ed0e1c2ae07..d0092542f48 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java @@ -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 diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/ConnectionFailedTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/ConnectionFailedTest.java new file mode 100644 index 00000000000..e5cf7cd0aaf --- /dev/null +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/ConnectionFailedTest.java @@ -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(); + } + } +}