From a3fe88cf1f1cbeec40fd694b1adc8376ade7c99b Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Mon, 20 Aug 2018 14:23:17 -0500 Subject: [PATCH] Removing invalid (and ignored) test from Issue #1175 Signed-off-by: Joakim Erdfelt --- .../org/eclipse/jetty/server/RequestTest.java | 76 ------------------- 1 file changed, 76 deletions(-) diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java index 7e8cef5ebb9..1699df190b7 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java @@ -32,7 +32,6 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.io.BufferedReader; -import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileReader; import java.io.IOException; @@ -48,7 +47,6 @@ import java.util.Locale; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -import javax.servlet.DispatcherType; import javax.servlet.MultipartConfigElement; import javax.servlet.ServletException; import javax.servlet.ServletInputStream; @@ -67,8 +65,6 @@ import org.eclipse.jetty.server.handler.AbstractHandler; import org.eclipse.jetty.server.handler.ContextHandler; import org.eclipse.jetty.server.handler.ErrorHandler; import org.eclipse.jetty.toolchain.test.AdvancedRunner; -import org.eclipse.jetty.toolchain.test.FS; -import org.eclipse.jetty.toolchain.test.MavenTestingUtils; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.IO; import org.eclipse.jetty.util.log.Log; @@ -1065,78 +1061,6 @@ public class RequestTest assertThat(response, containsString(" 200 OK")); } - - @Test - @Ignore("See issue #1175") - public void testMultiPartFormDataReadInputThenParams() throws Exception - { - final File tmpdir = MavenTestingUtils.getTargetTestingDir("multipart"); - FS.ensureEmpty(tmpdir); - - Handler handler = new AbstractHandler() - { - @Override - public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, - ServletException - { - if (baseRequest.getDispatcherType() != DispatcherType.REQUEST) - return; - - // Fake a @MultiPartConfig'd servlet endpoint - MultipartConfigElement multipartConfig = new MultipartConfigElement(tmpdir.getAbsolutePath()); - request.setAttribute(Request.__MULTIPART_CONFIG_ELEMENT, multipartConfig); - - // Normal processing - baseRequest.setHandled(true); - - // Fake the commons-fileupload behavior - int length = request.getContentLength(); - InputStream in = request.getInputStream(); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - IO.copy(in, out, length); // KEY STEP (Don't Change!) commons-fileupload does not read to EOF - - // Record what happened as servlet response headers - response.setIntHeader("x-request-content-length", request.getContentLength()); - response.setIntHeader("x-request-content-read", out.size()); - String foo = request.getParameter("foo"); // uri query parameter - String bar = request.getParameter("bar"); // form-data content parameter - response.setHeader("x-foo", foo == null ? "null" : foo); - response.setHeader("x-bar", bar == null ? "null" : bar); - } - }; - - _server.stop(); - _server.setHandler(handler); - _server.start(); - - String multipart = "--AaBbCc\r\n"+ - "content-disposition: form-data; name=\"bar\"\r\n"+ - "\r\n"+ - "BarContent\r\n"+ - "--AaBbCc\r\n"+ - "content-disposition: form-data; name=\"stuff\"\r\n"+ - "Content-Type: text/plain;charset=ISO-8859-1\r\n"+ - "\r\n"+ - "000000000000000000000000000000000000000000000000000\r\n"+ - "--AaBbCc--\r\n"; - - String request="POST /?foo=FooUri HTTP/1.1\r\n"+ - "Host: whatever\r\n"+ - "Content-Type: multipart/form-data; boundary=\"AaBbCc\"\r\n"+ - "Content-Length: "+multipart.getBytes().length+"\r\n"+ - "Connection: close\r\n"+ - "\r\n"+ - multipart; - - - HttpTester.Response response = HttpTester.parseResponse(_connector.getResponse(request)); - - // It should always be possible to read query string - assertThat("response.x-foo", response.get("x-foo"), is("FooUri")); - // Not possible to read request content parameters? - assertThat("response.x-bar", response.get("x-bar"), is("null")); // TODO: should this work? - } - @Test public void testPartialRead() throws Exception {