diff --git a/VERSION.txt b/VERSION.txt index 68ac2c18612..c6c5d639798 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -10,10 +10,11 @@ jetty-7.4.2-SNAPSHOT + 346179 o.e.j.util.ScannerTest fails on MacOS X platform + 346181 o.e.j.server.StressTest stalls on MacOS X platform + 346998 AbstractLifeCycle.isRunning() returns false if state changes from STARTING to STARTED during call - + JETTY-1342 Recreate selector if wakeup throws JVM bug + 346614 HttpConnection.handle() spins in case of SSL truncation attacks + 346764 OrderedGroupBinding deployment binding - + 347137 - Allow SSL renegotiations by default in HttpClient + + 347137 Allow SSL renegotiations by default in HttpClient + + JETTY-1146 Encode jsessionid in sendRedirect + + JETTY-1342 Recreate selector if wakeup throws JVM bug jetty-7.4.1.v20110513 + 288563 remove unsupported and deprecated --secure option diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java index b7cf949a807..9dd26fa0659 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java @@ -427,8 +427,9 @@ public class Response implements HttpServletResponse location=buf.toString(); } } + + location=encodeRedirectURL(location); resetBuffer(); - setHeader(HttpHeaders.LOCATION,location); setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY); complete(); diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ResponseTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ResponseTest.java index 74158133edf..9234a5e8081 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/ResponseTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ResponseTest.java @@ -34,6 +34,7 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSessionContext; import org.eclipse.jetty.http.HttpHeaders; +import org.eclipse.jetty.http.HttpURI; import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.io.ByteArrayEndPoint; import org.eclipse.jetty.server.bio.SocketConnector; @@ -347,6 +348,37 @@ public class ResponseTest assertEquals("http://myhost:8888/other/info;param?query=0&more=1#target",response.encodeURL("http://myhost:8888/other/info;param?query=0&more=1#target")); } + @Test + public void testSendRedirect() + throws Exception + { + ByteArrayEndPoint out=new ByteArrayEndPoint(new byte[]{},4096); + HttpConnection connection=new HttpConnection(connector,out, connector.getServer()); + Response response = new Response(connection); + Request request = connection.getRequest(); + request.setServerName("myhost"); + request.setServerPort(8888); + request.setUri(new HttpURI("/path/info;param;jsessionid=12345?query=0&more=1#target")); + request.setContextPath("/path"); + request.setRequestedSessionId("12345"); + request.setRequestedSessionIdFromCookie(false); + AbstractSessionManager manager=new HashSessionManager(); + manager.setIdManager(new HashSessionIdManager()); + request.setSessionManager(manager); + request.setSession(new TestSession(manager,"12345")); + manager.setCheckingRemoteSessionIdEncoding(false); + + response.sendRedirect("/other/location"); + + String location = out.getOut().toString(); + int l=location.indexOf("Location: "); + int e=location.indexOf('\n',l); + location=location.substring(l+10,e).trim(); + + assertEquals("http://myhost:8888/other/location;jsessionid=12345",location); + + } + @Test public void testSetBufferSize () throws Exception { diff --git a/test-jetty-webapp/src/main/java/com/acme/Dump.java b/test-jetty-webapp/src/main/java/com/acme/Dump.java index b02d375c202..7ef1abb6557 100644 --- a/test-jetty-webapp/src/main/java/com/acme/Dump.java +++ b/test-jetty-webapp/src/main/java/com/acme/Dump.java @@ -15,6 +15,7 @@ package com.acme; import java.io.BufferedWriter; import java.io.File; import java.io.IOException; +import java.io.InputStream; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; @@ -44,6 +45,7 @@ import org.eclipse.jetty.continuation.Continuation; import org.eclipse.jetty.continuation.ContinuationListener; import org.eclipse.jetty.continuation.ContinuationSupport; import org.eclipse.jetty.http.HttpHeaders; +import org.eclipse.jetty.util.IO; import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.log.Log; @@ -78,6 +80,25 @@ public class Dump extends HttpServlet doGet(request, response); } + /* ------------------------------------------------------------ */ + @Override + public void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException + { + byte[] buffer = new byte[8192]; + int len=request.getContentLength(); + int c=0; + InputStream in=request.getInputStream(); + while (c