From ee0c63aa0a4ab730ee18c425aabb9bd5372499c0 Mon Sep 17 00:00:00 2001 From: markt Date: Fri, 19 Jun 2009 12:16:25 +0000 Subject: [PATCH] Undo accidental commit of files that should not have been included in r786471. These will follow separately with the correct comments. Sorry for the noise. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@786473 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/catalina/valves/AccessLogValve.java | 10 ++--- .../apache/jasper/compiler/JspRuntimeContext.java | 11 ++--- .../org/apache/catalina/connector/TestRequest.java | 49 +++++++--------------- 3 files changed, 24 insertions(+), 46 deletions(-) diff --git a/java/org/apache/catalina/valves/AccessLogValve.java b/java/org/apache/catalina/valves/AccessLogValve.java index 2c688f731..7df274046 100644 --- a/java/org/apache/catalina/valves/AccessLogValve.java +++ b/java/org/apache/catalina/valves/AccessLogValve.java @@ -690,12 +690,10 @@ public class AccessLogValve } // Log this message - synchronized(this) { - if (writer != null) { - writer.println(message); - if (!buffered) { - writer.flush(); - } + if (writer != null) { + writer.println(message); + if (!buffered) { + writer.flush(); } } diff --git a/java/org/apache/jasper/compiler/JspRuntimeContext.java b/java/org/apache/jasper/compiler/JspRuntimeContext.java index af728b785..aac6c55e8 100644 --- a/java/org/apache/jasper/compiler/JspRuntimeContext.java +++ b/java/org/apache/jasper/compiler/JspRuntimeContext.java @@ -394,19 +394,16 @@ public final class JspRuntimeContext { docBase = docBase + "-"; permissionCollection.add(new FilePermission(docBase,"read")); - // Spec says apps should have read/write for their temp - // directory. This is fine, as no security sensitive files, at - // least any that the app doesn't have full control of anyway, - // will be written here. + // Create a file read permission for web app tempdir (work) + // directory String workDir = options.getScratchDir().toString(); if (!workDir.endsWith(File.separator)){ permissionCollection.add - (new FilePermission(workDir,"read,write")); + (new FilePermission(workDir,"read")); workDir = workDir + File.separator; } workDir = workDir + "-"; - permissionCollection.add(new FilePermission( - workDir,"read,write,delete")); + permissionCollection.add(new FilePermission(workDir,"read")); // Allow the JSP to access org.apache.jasper.runtime.HttpJspBase permissionCollection.add( new RuntimePermission( diff --git a/test/org/apache/catalina/connector/TestRequest.java b/test/org/apache/catalina/connector/TestRequest.java index 7166c7877..e7094a2ec 100644 --- a/test/org/apache/catalina/connector/TestRequest.java +++ b/test/org/apache/catalina/connector/TestRequest.java @@ -56,41 +56,35 @@ public class TestRequest extends TestCase { Bug37794Client client = new Bug37794Client(); // Edge cases around zero - client.doRequest(-1, false); // Unlimited + client.doRequest(-1); // Unlimited assertTrue(client.isResponse200()); assertTrue(client.isResponseBodyOK()); client.reset(); - client.doRequest(0, false); // Unlimited + client.doRequest(0); // Unlimited assertTrue(client.isResponse200()); assertTrue(client.isResponseBodyOK()); client.reset(); - client.doRequest(1, false); // 1 byte - too small should fail + client.doRequest(1); // 1 byte - too small should fail assertTrue(client.isResponse500()); client.reset(); // Edge cases around actual content length client.reset(); - client.doRequest(6, false); // Too small should fail + client.doRequest(6); // Too small should fail assertTrue(client.isResponse500()); client.reset(); - client.doRequest(7, false); // Just enough should pass + client.doRequest(7); // Just enough should pass assertTrue(client.isResponse200()); assertTrue(client.isResponseBodyOK()); client.reset(); - client.doRequest(8, false); // 1 extra - should pass + client.doRequest(8); // 1 extra - should pass assertTrue(client.isResponse200()); assertTrue(client.isResponseBodyOK()); // Much larger client.reset(); - client.doRequest(8096, false); // Plenty of space - should pass - assertTrue(client.isResponse200()); - assertTrue(client.isResponseBodyOK()); - - // Check for case insensitivity - client.reset(); - client.doRequest(8096, true); // Plenty of space - should pass + client.doRequest(8096); // Plenty of space - should pass assertTrue(client.isResponse200()); assertTrue(client.isResponseBodyOK()); } @@ -121,7 +115,7 @@ public class TestRequest extends TestCase { * Bug 37794 test client. */ private static class Bug37794Client extends SimpleHttpClient { - private Exception doRequest(int postLimit, boolean ucChunkedHead) { + private Exception doRequest(int postLimit) { Tomcat tomcat = new Tomcat(); try { StandardContext root = tomcat.addContext("", TEMP_DIR); @@ -135,25 +129,14 @@ public class TestRequest extends TestCase { // Send request in two parts String[] request = new String[2]; - if (ucChunkedHead) { - request[0] = - "POST http://localhost:8080/test HTTP/1.1" + CRLF + - "content-type: application/x-www-form-urlencoded" + CRLF + - "Transfer-Encoding: CHUNKED" + CRLF + - "Connection: close" + CRLF + - CRLF + - "3" + CRLF + - "a=1" + CRLF; - } else { - request[0] = - "POST http://localhost:8080/test HTTP/1.1" + CRLF + - "content-type: application/x-www-form-urlencoded" + CRLF + - "Transfer-Encoding: chunked" + CRLF + - "Connection: close" + CRLF + - CRLF + - "3" + CRLF + - "a=1" + CRLF; - } + request[0] = + "POST http://localhost:8080/test HTTP/1.1" + CRLF + + "content-type: application/x-www-form-urlencoded" + CRLF + + "Transfer-Encoding: chunked" + CRLF + + "Connection: close" + CRLF + + CRLF + + "3" + CRLF + + "a=1" + CRLF; request[1] = "4" + CRLF + "&b=2" + CRLF + -- 2.11.0