svn commit: r1557053 - /tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
Author: markt Date: Fri Jan 10 08:39:52 2014 New Revision: 1557053 URL: http://svn.apache.org/r1557053 Log: Move fixes to correct section Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1557053&r1=1557052&r2=1557053&view=diff == --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Fri Jan 10 08:39:52 2014 @@ -56,13 +56,9 @@ issues to not "pop up" wrt. others). --> - + -Avoid possible NPE if a content type is specified without a character -set. (markt) - - 55937: When deploying applications, treat a context path of /ROOT as equivalent to /. (markt) @@ -80,6 +76,14 @@ + + + +Avoid possible NPE if a content type is specified without a character +set. (markt) + + + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 55976] Broken response from NIO connector in Tomcat 7.0.50
https://issues.apache.org/bugzilla/show_bug.cgi?id=55976 Mark Thomas changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #20 from Mark Thomas --- Fixed applied to 7.0.x for 7.0.51 onwards. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1557054 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/coyote/http11/Http11NioProcessor.java webapps/docs/changelog.xml
Author: markt Date: Fri Jan 10 08:42:05 2014 New Revision: 1557054 URL: http://svn.apache.org/r1557054 Log: Fix sendfile support on NIO Modified: tomcat/tc7.0.x/trunk/ (props changed) tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Propchange: tomcat/tc7.0.x/trunk/ -- Merged /tomcat/trunk:r1556957 Modified: tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java?rev=1557054&r1=1557053&r2=1557054&view=diff == --- tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java Fri Jan 10 08:42:05 2014 @@ -276,6 +276,7 @@ public class Http11NioProcessor extends @Override protected boolean breakKeepAliveLoop( SocketWrapper socketWrapper) { +openSocket = keepAlive; // Do sendfile as needed: add socket to sendfile and end if (sendfileData != null && !error) { ((KeyAttachment) socketWrapper).setSendfileData(sendfileData); @@ -283,8 +284,16 @@ public class Http11NioProcessor extends SelectionKey key = socketWrapper.getSocket().getIOChannel().keyFor( socketWrapper.getSocket().getPoller().getSelector()); //do the first write on this thread, might as well -openSocket = socketWrapper.getSocket().getPoller().processSendfile(key, -(KeyAttachment) socketWrapper, true); +if (socketWrapper.getSocket().getPoller().processSendfile(key, +(KeyAttachment) socketWrapper, true)) { +sendfileInProgress = true; +} else { +// Write failed +if (log.isDebugEnabled()) { +log.debug(sm.getString("http11processor.sendfile.error")); +} +error = true; +} return true; } return false; Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1557054&r1=1557053&r2=1557054&view=diff == --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Fri Jan 10 08:42:05 2014 @@ -82,6 +82,10 @@ Avoid possible NPE if a content type is specified without a character set. (markt) + +55976: Fix sendfile support for the HTTP NIO connector. +(markt) + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1557080 - /tomcat/trunk/test/org/apache/coyote/http11/upgrade/TestUpgrade.java
Author: markt Date: Fri Jan 10 11:03:01 2014 New Revision: 1557080 URL: http://svn.apache.org/r1557080 Log: Refactor to aid re-use Modified: tomcat/trunk/test/org/apache/coyote/http11/upgrade/TestUpgrade.java Modified: tomcat/trunk/test/org/apache/coyote/http11/upgrade/TestUpgrade.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http11/upgrade/TestUpgrade.java?rev=1557080&r1=1557079&r2=1557080&view=diff == --- tomcat/trunk/test/org/apache/coyote/http11/upgrade/TestUpgrade.java (original) +++ tomcat/trunk/test/org/apache/coyote/http11/upgrade/TestUpgrade.java Fri Jan 10 11:03:01 2014 @@ -218,7 +218,7 @@ public class TestUpgrade extends TomcatB } sis.setReadListener(new EchoReadListener()); -sos.setWriteListener(new EchoWriteListener()); +sos.setWriteListener(new NoOpWriteListener()); } @Override @@ -226,7 +226,7 @@ public class TestUpgrade extends TomcatB // NO-OP } -private class EchoReadListener implements ReadListener { +private class EchoReadListener extends NoOpReadListener { private byte[] buffer = new byte[8096]; @@ -248,29 +248,38 @@ public class TestUpgrade extends TomcatB throw new RuntimeException(ioe); } } +} +} -@Override -public void onAllDataRead() { -// NO-OP for HTTP Upgrade -} -@Override -public void onError(Throwable throwable) { -// NO-OP -} +private static class NoOpReadListener implements ReadListener { + +@Override +public void onDataAvailable() { +// NO-OP } -private class EchoWriteListener implements WriteListener { +@Override +public void onAllDataRead() { +// Always NO-OP for HTTP Upgrade +} -@Override -public void onWritePossible() { -// NO-OP -} +@Override +public void onError(Throwable throwable) { +// NO-OP +} +} -@Override -public void onError(Throwable throwable) { -// NO-OP -} +private static class NoOpWriteListener implements WriteListener { + +@Override +public void onWritePossible() { +// NO-OP +} + +@Override +public void onError(Throwable throwable) { +// NO-OP } } } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1557082 - in /tomcat/trunk/java/org/apache/coyote/http11/upgrade: AbstractServletInputStream.java AbstractServletOutputStream.java LocalStrings.properties
Author: markt Date: Fri Jan 10 11:04:08 2014 New Revision: 1557082 URL: http://svn.apache.org/r1557082 Log: Fix failures in newly added tests Modified: tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractServletInputStream.java tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractServletOutputStream.java tomcat/trunk/java/org/apache/coyote/http11/upgrade/LocalStrings.properties Modified: tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractServletInputStream.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractServletInputStream.java?rev=1557082&r1=1557081&r2=1557082&view=diff == --- tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractServletInputStream.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractServletInputStream.java Fri Jan 10 11:04:08 2014 @@ -81,6 +81,10 @@ public abstract class AbstractServletInp throw new IllegalArgumentException( sm.getString("upgrade.sis.readListener.null")); } +if (this.listener != null) { +throw new IllegalArgumentException( +sm.getString("upgrade.sis.readListener.set")); +} this.listener = listener; this.applicationLoader = Thread.currentThread().getContextClassLoader(); // Switching to non-blocking. Don't know if data is available. Modified: tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractServletOutputStream.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractServletOutputStream.java?rev=1557082&r1=1557081&r2=1557082&view=diff == --- tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractServletOutputStream.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractServletOutputStream.java Fri Jan 10 11:04:08 2014 @@ -61,6 +61,10 @@ public abstract class AbstractServletOut throw new IllegalArgumentException( sm.getString("upgrade.sos.writeListener.null")); } +if (this.listener != null) { +throw new IllegalArgumentException( +sm.getString("upgrade.sos.writeListener.set")); +} this.listener = listener; this.applicationLoader = Thread.currentThread().getContextClassLoader(); } Modified: tomcat/trunk/java/org/apache/coyote/http11/upgrade/LocalStrings.properties URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/LocalStrings.properties?rev=1557082&r1=1557081&r2=1557082&view=diff == --- tomcat/trunk/java/org/apache/coyote/http11/upgrade/LocalStrings.properties (original) +++ tomcat/trunk/java/org/apache/coyote/http11/upgrade/LocalStrings.properties Fri Jan 10 11:04:08 2014 @@ -19,9 +19,11 @@ abstractProcessor.osCloseFail=Failed to upgrade.sis.isFinished.ise=It is illegal to call isFinished() when the ServletInputStream is not in non-blocking mode (i.e. setReadListener() must be called first) upgrade.sis.isReady.ise=It is illegal to call isReady() when the ServletInputStream is not in non-blocking mode (i.e. setReadListener() must be called first) upgrade.sis.readListener.null=It is illegal to pass null to setReadListener() +upgrade.sis.readListener.set=It is illegal to call setReadListener() more than once for the same upgraded connection upgrade.sis.read.ise=It is illegal to call any of the read() methods in non-blocking mode without first checking that there is data available by calling isReady() upgrade.sos.canWrite.ise=It is illegal to call canWrite() when the ServletOutputStream is not in non-blocking mode (i.e. setWriteListener() must be called first) upgrade.sos.writeListener.null=It is illegal to pass null to setWriteListener() +upgrade.sos.writeListener.set=It is illegal to call setWriteListener() more than once for the same upgraded connection upgrade.sis.write.ise=It is illegal to call any of the write() methods in non-blocking mode without first checking that there is space available by calling isReady() apr.clientAbort=The client aborted the connection. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1557081 - /tomcat/trunk/test/org/apache/coyote/http11/upgrade/TestUpgrade.java
Author: markt Date: Fri Jan 10 11:03:33 2014 New Revision: 1557081 URL: http://svn.apache.org/r1557081 Log: Add tests for setting null and duplicate read and write listeners for non-blocking IO. Modified: tomcat/trunk/test/org/apache/coyote/http11/upgrade/TestUpgrade.java Modified: tomcat/trunk/test/org/apache/coyote/http11/upgrade/TestUpgrade.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http11/upgrade/TestUpgrade.java?rev=1557081&r1=1557080&r2=1557081&view=diff == --- tomcat/trunk/test/org/apache/coyote/http11/upgrade/TestUpgrade.java (original) +++ tomcat/trunk/test/org/apache/coyote/http11/upgrade/TestUpgrade.java Fri Jan 10 11:03:33 2014 @@ -23,6 +23,7 @@ import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; +import java.io.Reader; import java.io.Writer; import java.net.Socket; @@ -72,6 +73,37 @@ public class TestUpgrade extends TomcatB doTestMessages(EchoNonBlocking.class); } +@Test +public void testSetNullReadListener() throws Exception { +doTestCheckClosed(SetNullReadListener.class); +} + +@Test +public void testSetNullWriteListener() throws Exception { +doTestCheckClosed(SetNullWriteListener.class); +} + +@Test +public void testSetReadListenerTwice() throws Exception { +doTestCheckClosed(SetReadListenerTwice.class); +} + +@Test +public void testSetWriteListenerTwice() throws Exception { +doTestCheckClosed(SetWriteListenerTwice.class); +} + +private void doTestCheckClosed( +Class upgradeHandlerClass) +throws Exception { +UpgradeConnection conn = doUpgrade(upgradeHandlerClass); + +Reader r = conn.getReader(); +int c = r.read(); + +Assert.assertEquals(-1, c); +} + private void doTestMessages ( Class upgradeHandlerClass) throws Exception { @@ -116,7 +148,7 @@ public class TestUpgrade extends TomcatB Socket socket = SocketFactory.getDefault().createSocket("localhost", getPort()); -socket.setSoTimeout(1); +socket.setSoTimeout(5000); InputStream is = socket.getInputStream(); OutputStream os = socket.getOutputStream(); @@ -252,6 +284,96 @@ public class TestUpgrade extends TomcatB } +public static class SetNullReadListener implements HttpUpgradeHandler { + +@Override +public void init(WebConnection connection) { +ServletInputStream sis; +try { +sis = connection.getInputStream(); +} catch (IOException ioe) { +throw new IllegalStateException(ioe); +} +sis.setReadListener(null); +} + +@Override +public void destroy() { +// NO-OP +} +} + + +public static class SetNullWriteListener implements HttpUpgradeHandler { + +@Override +public void init(WebConnection connection) { +ServletOutputStream sos; +try { +sos = connection.getOutputStream(); +} catch (IOException ioe) { +throw new IllegalStateException(ioe); +} +sos.setWriteListener(null); +} + +@Override +public void destroy() { +// NO-OP +} +} + + +public static class SetReadListenerTwice implements HttpUpgradeHandler { + +@Override +public void init(WebConnection connection) { +ServletInputStream sis; +ServletOutputStream sos; +try { +sis = connection.getInputStream(); +sos = connection.getOutputStream(); +} catch (IOException ioe) { +throw new IllegalStateException(ioe); +} +sos.setWriteListener(new NoOpWriteListener()); +ReadListener rl = new NoOpReadListener(); +sis.setReadListener(rl); +sis.setReadListener(rl); +} + +@Override +public void destroy() { +// NO-OP +} +} + + +public static class SetWriteListenerTwice implements HttpUpgradeHandler { + +@Override +public void init(WebConnection connection) { +ServletInputStream sis; +ServletOutputStream sos; +try { +sis = connection.getInputStream(); +sos = connection.getOutputStream(); +} catch (IOException ioe) { +throw new IllegalStateException(ioe); +} +sis.setReadListener(new NoOpReadListener()); +WriteListener wl = new NoOpWriteListener(); +sos.setWriteListener(wl); +sos.setWriteListener(wl); +} + +@Override +publi
[Bug 55978] Initial call to onWritePossible() not made by container when using HTTP upgrade
https://issues.apache.org/bugzilla/show_bug.cgi?id=55978 Mark Thomas changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #1 from Mark Thomas --- This has been fixed in 8.0.x and will be included in 8.0.0 onwards. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1557092 - in /tomcat/trunk: java/org/apache/coyote/ java/org/apache/coyote/http11/upgrade/ test/org/apache/coyote/http11/upgrade/
Author: markt Date: Fri Jan 10 11:43:02 2014 New Revision: 1557092 URL: http://svn.apache.org/r1557092 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=55978 Ensure that container makes first call on onWritePossible when using non-blocking IO with an HTTP upgraded connection Modified: tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractProcessor.java tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractServletOutputStream.java tomcat/trunk/java/org/apache/coyote/http11/upgrade/AprServletOutputStream.java tomcat/trunk/java/org/apache/coyote/http11/upgrade/BioServletOutputStream.java tomcat/trunk/java/org/apache/coyote/http11/upgrade/NioServletOutputStream.java tomcat/trunk/test/org/apache/coyote/http11/upgrade/TestUpgrade.java Modified: tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java?rev=1557092&r1=1557091&r2=1557092&view=diff == --- tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java (original) +++ tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java Fri Jan 10 11:43:02 2014 @@ -628,8 +628,13 @@ public abstract class AbstractProtocolhttp://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractProcessor.java?rev=1557092&r1=1557091&r2=1557092&view=diff == --- tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractProcessor.java Fri Jan 10 11:43:02 2014 @@ -42,11 +42,11 @@ public abstract class AbstractProcessor< private final HttpUpgradeHandler httpUpgradeHandler; private final AbstractServletInputStream upgradeServletInputStream; -private final AbstractServletOutputStream upgradeServletOutputStream; +private final AbstractServletOutputStream upgradeServletOutputStream; protected AbstractProcessor (HttpUpgradeHandler httpUpgradeHandler, AbstractServletInputStream upgradeServletInputStream, -AbstractServletOutputStream upgradeServletOutputStream) { +AbstractServletOutputStream upgradeServletOutputStream) { this.httpUpgradeHandler = httpUpgradeHandler; this.upgradeServletInputStream = upgradeServletInputStream; this.upgradeServletOutputStream = upgradeServletOutputStream; Modified: tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractServletOutputStream.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractServletOutputStream.java?rev=1557092&r1=1557091&r2=1557092&view=diff == --- tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractServletOutputStream.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractServletOutputStream.java Fri Jan 10 11:43:02 2014 @@ -22,13 +22,17 @@ import javax.servlet.ServletOutputStream import javax.servlet.WriteListener; import org.apache.tomcat.util.ExceptionUtils; +import org.apache.tomcat.util.net.DispatchType; +import org.apache.tomcat.util.net.SocketWrapper; import org.apache.tomcat.util.res.StringManager; -public abstract class AbstractServletOutputStream extends ServletOutputStream { +public abstract class AbstractServletOutputStream extends ServletOutputStream { protected static final StringManager sm = StringManager.getManager(Constants.Package); +protected final SocketWrapper socketWrapper; + private final Object fireListenerLock = new Object(); private final Object writeLock = new Object(); @@ -39,6 +43,12 @@ public abstract class AbstractServletOut private volatile ClassLoader applicationLoader = null; private volatile byte[] buffer; + +public AbstractServletOutputStream(SocketWrapper socketWrapper) { +this.socketWrapper = socketWrapper; +} + + @Override public final boolean isReady() { if (listener == null) { @@ -55,6 +65,7 @@ public abstract class AbstractServletOut } } + @Override public final void setWriteListener(WriteListener listener) { if (listener == null) { @@ -65,14 +76,23 @@ public abstract class AbstractServletOut throw new IllegalArgumentException( sm.getString("upgrade.sos.writeListener.set")); } +// Container is responsible for first call to onWritePossible() but only +// need to do this if setting the listener for the first time rather +// than changing it. +synchronized (fireListenerLock) { +fireListener = true; +} +socketWrapper.addDispatch(DispatchType.NON_BLOCKING_WRITE);
[Bug 55893] Split AccessLogValve and extract the formatting logic in an AbstractAccessLogValve
https://issues.apache.org/bugzilla/show_bug.cgi?id=55893 --- Comment #1 from Mark Thomas --- The proposed patch does not contain the new AbstractAccessLogValve class. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 55893] Split AccessLogValve and extract the formatting logic in an AbstractAccessLogValve
https://issues.apache.org/bugzilla/show_bug.cgi?id=55893 Cyrille Le Clerc changed: What|Removed |Added Attachment #31120|0 |1 is obsolete|| CC||clecl...@apache.org --- Comment #2 from Cyrille Le Clerc --- Created attachment 31196 --> https://issues.apache.org/bugzilla/attachment.cgi?id=31196&action=edit Fixed patch with the forgotten AbstractAccessLogValve.java Sorry for the mistake -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1557113 [2/2] - in /tomcat/trunk/java/org/apache/catalina/valves: AbstractAccessLogValve.java AccessLogValve.java
Modified: tomcat/trunk/java/org/apache/catalina/valves/AccessLogValve.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/valves/AccessLogValve.java?rev=1557113&r1=1557112&r2=1557113&view=diff == --- tomcat/trunk/java/org/apache/catalina/valves/AccessLogValve.java (original) +++ tomcat/trunk/java/org/apache/catalina/valves/AccessLogValve.java Fri Jan 10 13:09:50 2014 @@ -25,104 +25,28 @@ import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; -import java.net.InetAddress; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.text.SimpleDateFormat; -import java.util.ArrayList; import java.util.Date; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; import java.util.Locale; import java.util.TimeZone; -import javax.servlet.ServletException; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpSession; - -import org.apache.catalina.AccessLog; -import org.apache.catalina.Globals; import org.apache.catalina.LifecycleException; -import org.apache.catalina.LifecycleState; -import org.apache.catalina.Session; -import org.apache.catalina.connector.Request; -import org.apache.catalina.connector.Response; -import org.apache.coyote.RequestInfo; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; import org.apache.tomcat.util.ExceptionUtils; import org.apache.tomcat.util.buf.B2CConverter; -import org.apache.tomcat.util.collections.SynchronizedStack; /** - * Implementation of the Valve interface that generates a web server - * access log with the detailed line contents matching a configurable pattern. - * The syntax of the available patterns is similar to that supported by the - * http://httpd.apache.org/";>Apache HTTP Server - * mod_log_config module. As an additional feature, - * automatic rollover of log files when the date changes is also supported. - * - * Patterns for the logged message may include constant text or any of the - * following replacement strings, for which the corresponding information - * from the specified Response is substituted: - * - * %a - Remote IP address - * %A - Local IP address - * %b - Bytes sent, excluding HTTP headers, or '-' if no bytes - * were sent - * %B - Bytes sent, excluding HTTP headers - * %h - Remote host name (or IP address if - * enableLookups for the connector is false) - * %H - Request protocol - * %l - Remote logical username from identd (always returns '-') - * %m - Request method - * %p - Local port - * %q - Query string (prepended with a '?' if it exists, otherwise - * an empty string - * %r - First line of the request - * %s - HTTP status code of the response - * %S - User session ID - * %t - Date and time, in Common Log Format format - * %t{format} - Date and time, in any format supported by SimpleDateFormat - * %u - Remote user that was authenticated - * %U - Requested URL path - * %v - Local server name - * %D - Time taken to process the request, in millis - * %T - Time taken to process the request, in seconds - * %I - current Request thread name (can compare later with stacktraces) - * - * In addition, the caller can specify one of the following aliases for - * commonly utilized patterns: - * - * common - %h %l %u %t "%r" %s %b - * combined - - * %h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i" - * - * - * - * There is also support to write information from the cookie, incoming - * header, the Session or something else in the ServletRequest. - * It is modeled after the - * http://httpd.apache.org/";>Apache HTTP Server log configuration - * syntax: + * This is a concrete implementation of {@link AbstractAccessLogValve} that + * outputs the access log to a file. The features of this implementation + * include: * - * %{xxx}i for incoming headers - * %{xxx}o for outgoing response headers - * %{xxx}c for a specific cookie - * %{xxx}r xxx is an attribute in the ServletRequest - * %{xxx}s xxx is an attribute in the HttpSession - * %{xxx}t xxx is an enhanced SimpleDateFormat pattern - * (see Configuration Reference document for details on supported time patterns) + * Automatic date-based rollover of log files + * Optional log file rotation * - * - * - * Log rotation can be on or off. This is dictated by the - * rotatable property. - * - * * * For UNIX users, another field called checkExists is also * available. If set to true, the log file's existence will be checked before @@ -135,40 +59,14 @@ import org.apache.tomcat.util.collection * been made available to allow you to tell this instance to move * the existing log file to somewhere else and start writing a new log file. * - * - * - * Conditional logging is also supported. This can be done with the - * conditionUnless and conditionIf properties
[Bug 55893] Split AccessLogValve and extract the formatting logic in an AbstractAccessLogValve
https://issues.apache.org/bugzilla/show_bug.cgi?id=55893 Mark Thomas changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #3 from Mark Thomas --- Thanks. Patch applied and will be included in 8.0.0 onwards. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1557113 [1/2] - in /tomcat/trunk/java/org/apache/catalina/valves: AbstractAccessLogValve.java AccessLogValve.java
Author: markt Date: Fri Jan 10 13:09:50 2014 New Revision: 1557113 URL: http://svn.apache.org/r1557113 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=55893 Split AccessLogValve and extract the formatting logic in an AbstractAccessLogValve to facilitate other implementations that output to destinations other than files. Patch provided by Cyrille Le Clerc Added: tomcat/trunk/java/org/apache/catalina/valves/AbstractAccessLogValve.java (with props) Modified: tomcat/trunk/java/org/apache/catalina/valves/AccessLogValve.java Added: tomcat/trunk/java/org/apache/catalina/valves/AbstractAccessLogValve.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/valves/AbstractAccessLogValve.java?rev=1557113&view=auto == --- tomcat/trunk/java/org/apache/catalina/valves/AbstractAccessLogValve.java (added) +++ tomcat/trunk/java/org/apache/catalina/valves/AbstractAccessLogValve.java Fri Jan 10 13:09:50 2014 @@ -0,0 +1,1565 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.catalina.valves; + + +import java.io.CharArrayWriter; +import java.io.IOException; +import java.net.InetAddress; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.TimeZone; + +import javax.servlet.ServletException; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpSession; + +import org.apache.catalina.AccessLog; +import org.apache.catalina.Globals; +import org.apache.catalina.LifecycleException; +import org.apache.catalina.LifecycleState; +import org.apache.catalina.Session; +import org.apache.catalina.connector.Request; +import org.apache.catalina.connector.Response; +import org.apache.coyote.RequestInfo; +import org.apache.juli.logging.Log; +import org.apache.juli.logging.LogFactory; +import org.apache.tomcat.util.ExceptionUtils; +import org.apache.tomcat.util.collections.SynchronizedStack; + + +/** + * Abstract implementation of the Valve interface that generates a web + * server access log with the detailed line contents matching a configurable + * pattern. The syntax of the available patterns is similar to that supported by + * the http://httpd.apache.org/";>Apache HTTP Server + * mod_log_config module. + * + * Patterns for the logged message may include constant text or any of the + * following replacement strings, for which the corresponding information + * from the specified Response is substituted: + * + * %a - Remote IP address + * %A - Local IP address + * %b - Bytes sent, excluding HTTP headers, or '-' if no bytes + * were sent + * %B - Bytes sent, excluding HTTP headers + * %h - Remote host name (or IP address if + * enableLookups for the connector is false) + * %H - Request protocol + * %l - Remote logical username from identd (always returns '-') + * %m - Request method + * %p - Local port + * %q - Query string (prepended with a '?' if it exists, otherwise + * an empty string + * %r - First line of the request + * %s - HTTP status code of the response + * %S - User session ID + * %t - Date and time, in Common Log Format format + * %t{format} - Date and time, in any format supported by SimpleDateFormat + * %u - Remote user that was authenticated + * %U - Requested URL path + * %v - Local server name + * %D - Time taken to process the request, in millis + * %T - Time taken to process the request, in seconds + * %I - current Request thread name (can compare later with stacktraces) + * + * In addition, the caller can specify one of the following aliases for + * commonly utilized patterns: + * + * common - %h %l %u %t "%r" %s %b + * combined - + * %h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i" + * + * + * + * There is also support to write information from the cookie, incoming + * header, the Session or something else in the ServletRequest. + * It is modeled after the + * http://httpd.apache.org/";>Apache HTTP Server log configuration + * syntax: + * + * %{xxx}i for incoming headers + * %{xxx}o for outgoing resp
[Bug 55893] Split AccessLogValve and extract the formatting logic in an AbstractAccessLogValve
https://issues.apache.org/bugzilla/show_bug.cgi?id=55893 --- Comment #4 from Cyrille Le Clerc --- Thanks. Can I propose the same patch for tomcat 7.X branch or are the changes of this 7.X branch limited to bug fixes? -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 55893] Split AccessLogValve and extract the formatting logic in an AbstractAccessLogValve
https://issues.apache.org/bugzilla/show_bug.cgi?id=55893 --- Comment #5 from Mark Thomas --- New features are being added to 7.0.x (e.g. JSR356 support). When deciding whether to back-port a number of factors are considered: - the size of the change - the impact on the existing API - the potential consequences if the patch introduces a regression Given the size of the change and the potential consequences, I'd suggest waiting for a 8.0.x release or two to make sure it hasn't broken anything and then request a back-port. The API impact should be zero so there should be no issue there. Feel free to re-open this issue and set the product to Tomcat 7. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1557127 - /tomcat/trunk/java/org/apache/catalina/servlets/DefaultServlet.java
Author: markt Date: Fri Jan 10 14:07:45 2014 New Revision: 1557127 URL: http://svn.apache.org/r1557127 Log: More graceful handling (a 403 rather than a 500 response) when file permissions allow Tomcat to know a resource exists but not to read it Modified: tomcat/trunk/java/org/apache/catalina/servlets/DefaultServlet.java Modified: tomcat/trunk/java/org/apache/catalina/servlets/DefaultServlet.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/servlets/DefaultServlet.java?rev=1557127&r1=1557126&r2=1557127&view=diff == --- tomcat/trunk/java/org/apache/catalina/servlets/DefaultServlet.java (original) +++ tomcat/trunk/java/org/apache/catalina/servlets/DefaultServlet.java Fri Jan 10 14:07:45 2014 @@ -724,6 +724,27 @@ public class DefaultServlet return; } +if (!resource.canRead()) { +// Check if we're included so we can return the appropriate +// missing resource name in the error +String requestUri = (String) request.getAttribute( +RequestDispatcher.INCLUDE_REQUEST_URI); +if (requestUri == null) { +requestUri = request.getRequestURI(); +} else { +// We're included +// Spec doesn't say what to do in this case but a FNFE seems +// reasonable +throw new FileNotFoundException( +sm.getString("defaultServlet.missingResource", +requestUri)); +} + +response.sendError(HttpServletResponse.SC_FORBIDDEN, + requestUri); +return; +} + // If the resource is not a collection, and the resource path // ends with "/" or "\", return NOT FOUND if (resource.isFile()) { - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1557146 - /tomcat/trunk/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java
Author: markt Date: Fri Jan 10 15:09:50 2014 New Revision: 1557146 URL: http://svn.apache.org/r1557146 Log: ResourceSets added via a context.xml file need a default internalPath Modified: tomcat/trunk/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java Modified: tomcat/trunk/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java?rev=1557146&r1=1557145&r2=1557146&view=diff == --- tomcat/trunk/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java (original) +++ tomcat/trunk/java/org/apache/catalina/webresources/AbstractArchiveResourceSet.java Fri Jan 10 15:09:50 2014 @@ -213,7 +213,7 @@ public abstract class AbstractArchiveRes String pathInJar = getInternalPath() + path.substring( webAppMount.length(), path.length()); // Always strip off the leading '/' to get the JAR path -if (pathInJar.charAt(0) == '/') { +if (pathInJar.length() > 0 && pathInJar.charAt(0) == '/') { pathInJar = pathInJar.substring(1); } if (pathInJar.equals("")) { - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1557147 - /tomcat/trunk/java/org/apache/catalina/webresources/AbstractResourceSet.java
Author: markt Date: Fri Jan 10 15:10:24 2014 New Revision: 1557147 URL: http://svn.apache.org/r1557147 Log: ResourceSets added via a context.xml file need a default internalPath Modified: tomcat/trunk/java/org/apache/catalina/webresources/AbstractResourceSet.java Modified: tomcat/trunk/java/org/apache/catalina/webresources/AbstractResourceSet.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/webresources/AbstractResourceSet.java?rev=1557147&r1=1557146&r2=1557147&view=diff == --- tomcat/trunk/java/org/apache/catalina/webresources/AbstractResourceSet.java (original) +++ tomcat/trunk/java/org/apache/catalina/webresources/AbstractResourceSet.java Fri Jan 10 15:10:24 2014 @@ -28,7 +28,7 @@ public abstract class AbstractResourceSe private WebResourceRoot root; private String base; -private String internalPath; +private String internalPath = ""; private String webAppMount; private boolean classLoaderOnly; - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1557148 - /tomcat/trunk/java/org/apache/catalina/servlets/DefaultServlet.java
Author: markt Date: Fri Jan 10 15:10:57 2014 New Revision: 1557148 URL: http://svn.apache.org/r1557148 Log: Ensure directory name is displayed as part of directory listings Modified: tomcat/trunk/java/org/apache/catalina/servlets/DefaultServlet.java Modified: tomcat/trunk/java/org/apache/catalina/servlets/DefaultServlet.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/servlets/DefaultServlet.java?rev=1557148&r1=1557147&r2=1557148&view=diff == --- tomcat/trunk/java/org/apache/catalina/servlets/DefaultServlet.java (original) +++ tomcat/trunk/java/org/apache/catalina/servlets/DefaultServlet.java Fri Jan 10 15:10:57 2014 @@ -1340,8 +1340,6 @@ public class DefaultServlet protected InputStream renderHtml(String contextPath, WebResource resource) throws IOException { -String name = resource.getName(); - // Prepare a writer to a buffered area ByteArrayOutputStream stream = new ByteArrayOutputStream(); OutputStreamWriter osWriter = new OutputStreamWriter(stream, "UTF8"); @@ -1359,7 +1357,7 @@ public class DefaultServlet sb.append("\r\n"); sb.append("\r\n"); sb.append(""); -sb.append(sm.getString("directory.title", name)); +sb.append(sm.getString("directory.title", directoryWebappPath)); sb.append("\r\n"); sb.append("
svn propchange: r1557146 - svn:log
Author: markt Revision: 1557146 Modified property: svn:log Modified: svn:log at Fri Jan 10 15:12:49 2014 -- --- svn:log (original) +++ svn:log Fri Jan 10 15:12:49 2014 @@ -1 +1 @@ -ResourceSets added via a context.xml file need a default internalPath +pathInJar may be zero length so avoid out of bounds error - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
buildbot failure in ASF Buildbot on tomcat-trunk
The Buildbot has detected a new failure on builder tomcat-trunk while building ASF Buildbot. Full details are available at: http://ci.apache.org/builders/tomcat-trunk/builds/5389 Buildbot URL: http://ci.apache.org/ Buildslave for this Build: bb-vm_ubuntu Build Reason: scheduler Build Source Stamp: [branch tomcat/trunk] 1557127 Blamelist: markt BUILD FAILED: failed compile_1 sincerely, -The Buildbot
svn commit: r1557180 - /tomcat/trunk/java/org/apache/catalina/security/SecurityClassLoad.java
Author: markt Date: Fri Jan 10 16:34:46 2014 New Revision: 1557180 URL: http://svn.apache.org/r1557180 Log: Follow up to r1557113 - fix failure when running under a security manager Modified: tomcat/trunk/java/org/apache/catalina/security/SecurityClassLoad.java Modified: tomcat/trunk/java/org/apache/catalina/security/SecurityClassLoad.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/security/SecurityClassLoad.java?rev=1557180&r1=1557179&r2=1557180&view=diff == --- tomcat/trunk/java/org/apache/catalina/security/SecurityClassLoad.java (original) +++ tomcat/trunk/java/org/apache/catalina/security/SecurityClassLoad.java Fri Jan 10 16:34:46 2014 @@ -153,7 +153,7 @@ public final class SecurityClassLoad { private static final void loadValvesPackage(ClassLoader loader) throws Exception { final String basePackage = "org.apache.catalina.valves."; -loader.loadClass(basePackage + "AccessLogValve$3"); +loader.loadClass(basePackage + "AbstractAccessLogValve$3"); } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
buildbot success in ASF Buildbot on tomcat-trunk
The Buildbot has detected a restored build on builder tomcat-trunk while building ASF Buildbot. Full details are available at: http://ci.apache.org/builders/tomcat-trunk/builds/5391 Buildbot URL: http://ci.apache.org/ Buildslave for this Build: bb-vm_ubuntu Build Reason: scheduler Build Source Stamp: [branch tomcat/trunk] 1557180 Blamelist: markt Build succeeded! sincerely, -The Buildbot
[Bug 55976] Broken response from NIO connector in Tomcat 7.0.50
https://issues.apache.org/bugzilla/show_bug.cgi?id=55976 Ognjen Blagojevic changed: What|Removed |Added Status|RESOLVED|CLOSED --- Comment #21 from Ognjen Blagojevic --- (In reply to Mark Thomas from comment #20) > Fixed applied to 7.0.x for 7.0.51 onwards. Tomcat 7.0.x trunk also works correctly. I'm closing this bug. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 43682] JULI: web-inf/classes/logging.properties to support ${context} tag
https://issues.apache.org/bugzilla/show_bug.cgi?id=43682 --- Comment #3 from Michael Osipov <1983-01...@gmx.net> --- For what it's worth, I have writted a Listener for exactly that problem. It works flawlessly with Logback or anything else which is capable of using JNDI. See: http://mo-tomcat-ext.sourceforge.net/user-guide.html#LogbackContextNameListener I did not write anything for JULI because that system is a dead end (imho). -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org