Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimone Bordet2009-11-18 04:42:47 -0500
committerSimone Bordet2009-11-18 04:42:47 -0500
commit0c6f8e63bc4fb50c27e824d1a3bbcf0cd342236d (patch)
tree52d3278a5485a79636ae5f19f0456a565245963b
parentd8f44e67acb95ebe2dc82530486aaf788d2d059d (diff)
downloadorg.eclipse.jetty.project-0c6f8e63bc4fb50c27e824d1a3bbcf0cd342236d.tar.gz
org.eclipse.jetty.project-0c6f8e63bc4fb50c27e824d1a3bbcf0cd342236d.tar.xz
org.eclipse.jetty.project-0c6f8e63bc4fb50c27e824d1a3bbcf0cd342236d.zip
Fix for #295421: Cannot reset() a newly created HttpExchange: IllegalStateException 0 => 0.
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1063 7e9141cc-0065-0410-87d8-b60c137991c4
-rw-r--r--VERSION.txt1
-rw-r--r--jetty-client/src/main/java/org/eclipse/jetty/client/HttpExchange.java1
-rw-r--r--jetty-client/src/test/java/org/eclipse/jetty/client/HttpExchangeTest.java37
3 files changed, 21 insertions, 18 deletions
diff --git a/VERSION.txt b/VERSION.txt
index ce26020b87..033aebed65 100644
--- a/VERSION.txt
+++ b/VERSION.txt
@@ -40,6 +40,7 @@ jetty-7.0.1.v20091116 16 November 2009
+ Moved centralized logging and verifier back to sandbox
+ 294345 Support for HTTP/301 + HTTP/302 response codes
+ CVE-2009-3555 Prevent SSL renegotiate for SSL vulnerability
+ + 295421 Cannot reset() a newly created HttpExchange: IllegalStateException 0 => 0
jetty-7.0.0.v20091005 5 October 2009
291340 Race condition in onException() notifications
diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpExchange.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpExchange.java
index b269337f1e..80fc93a15e 100644
--- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpExchange.java
+++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpExchange.java
@@ -167,6 +167,7 @@ public class HttpExchange
case STATUS_START:
switch (newStatus)
{
+ case STATUS_START:
case STATUS_WAITING_FOR_CONNECTION:
case STATUS_WAITING_FOR_COMMIT:
case STATUS_CANCELLING:
diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpExchangeTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpExchangeTest.java
index d42d048b99..26da2ecc5f 100644
--- a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpExchangeTest.java
+++ b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpExchangeTest.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;
@@ -19,13 +19,11 @@ import java.io.OutputStream;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
-
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import junit.framework.TestCase;
-
import org.eclipse.jetty.client.security.ProxyAuthorization;
import org.eclipse.jetty.http.HttpHeaders;
import org.eclipse.jetty.http.HttpMethods;
@@ -41,9 +39,6 @@ import org.eclipse.jetty.server.nio.SelectChannelConnector;
/**
* Functional testing for HttpExchange.
- *
- *
- *
*/
public class HttpExchangeTest extends TestCase
{
@@ -74,6 +69,12 @@ public class HttpExchangeTest extends TestCase
stopServer();
}
+ public void testResetNewExchange() throws Exception
+ {
+ HttpExchange exchange = new HttpExchange();
+ exchange.reset();
+ }
+
public void testPerf() throws Exception
{
if (_stress)
@@ -211,12 +212,12 @@ public class HttpExchangeTest extends TestCase
}
assertTrue(complete.await(45,TimeUnit.SECONDS));
-
+
long elapsed=System.currentTimeMillis()-start;
- // make windows-friendly ... System.currentTimeMillis() on windows is dope!
+ // make windows-friendly ... System.currentTimeMillis() on windows is dope!
if(elapsed>0)
System.err.println(nb+"/"+_count+" c="+close+" rate="+(nb*1000/elapsed));
-
+
assertEquals("nb="+nb+" close="+close,0,latch.getCount());
}
@@ -267,7 +268,7 @@ public class HttpExchangeTest extends TestCase
assertTrue(result.indexOf("<title>Sun Microsystems</title>")>0);
assertEquals(HttpExchange.STATUS_COMPLETED, status);
assertEquals(HttpStatus.OK_200,httpExchange.getResponseStatus());
-
+
}
public void testProxy() throws Exception
@@ -298,7 +299,7 @@ public class HttpExchangeTest extends TestCase
}
}
-
+
public void testReserveConnections () throws Exception
{
final HttpDestination destination = _httpClient.getDestination (new Address("localhost", _port), _scheme.equalsIgnoreCase("https://"));
@@ -312,20 +313,20 @@ public class HttpExchangeTest extends TestCase
ex.setMethod(HttpMethods.GET);
connections[i].send(ex);
}
-
+
//try to get a connection, and only wait 500ms, as we have
//already reserved the max, should return null
org.eclipse.jetty.client.HttpConnection c = destination.reserveConnection(500);
assertNull(c);
-
+
//unreserve first connection
destination.returnConnection(connections[0], false);
-
+
//reserving one should now work
c = destination.reserveConnection(500);
assertNotNull(c);
-
-
+
+
}
public static void copyStream(InputStream in, OutputStream out)
{
@@ -371,7 +372,7 @@ public class HttpExchangeTest extends TestCase
baseRequest.setHandled(true);
response.setStatus(200);
_count.incrementAndGet();
-
+
if (request.getServerName().equals("jetty.eclipse.org"))
{
// System.err.println("HANDLING Proxy");

Back to the top