svn commit: r1480220 - /tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
Author: markt Date: Wed May 8 10:29:33 2013 New Revision: 1480220 URL: http://svn.apache.org/r1480220 Log: Fix the last access time TODOs (we'll need the wrapper for the non-blocking changes anyway). Modified: tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java Modified: tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java?rev=1480220&r1=1480219&r2=1480220&view=diff == --- tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/InternalAprOutputBuffer.java Wed May 8 10:29:33 2013 @@ -76,6 +76,9 @@ public class InternalAprOutputBuffer ext private long socket; +private SocketWrapper wrapper; + + /** * Direct byte buffer used for writing. */ @@ -88,6 +91,7 @@ public class InternalAprOutputBuffer ext public void init(SocketWrapper socketWrapper, AbstractEndpoint endpoint) throws IOException { +wrapper = socketWrapper; socket = socketWrapper.getSocket().longValue(); Socket.setsbb(this.socket, bbuf); } @@ -103,6 +107,7 @@ public class InternalAprOutputBuffer ext super.recycle(); bbuf.clear(); +wrapper = null; } @@ -169,7 +174,7 @@ public class InternalAprOutputBuffer ext offset = offset + thisTime; } -// TODO: Review how to update the SocketWrapper's last accessed time +wrapper.access(); if (!isBlocking() && length>0) { // Buffer the remaining data @@ -196,7 +201,7 @@ public class InternalAprOutputBuffer ext @Override protected boolean flushBuffer(boolean block) throws IOException { -// TODO: Review how to update the SocketWrapper's last accessed time +wrapper.access(); boolean dataLeft = hasMoreDataToFlush(); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: svn commit: r1479953 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/http/parser/HttpParser.java test/org/apache/tomcat/util/http/parser/TestMediaType.java webapps/docs/changelog.xml
On 7 May 2013 16:54, wrote: > Author: markt > Date: Tue May 7 15:54:36 2013 > New Revision: 1479953 > > URL: http://svn.apache.org/r1479953 > Log: > Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=54703 > Be tolerant of applications that pass CR or LF in setHeader() values. > Fix some whitespace parsing issues idnetifed by the extended test cases in > readTokenOrQuotedString() > > Modified: > tomcat/tc7.0.x/trunk/ (props changed) > > tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java > > tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/parser/TestMediaType.java > tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml > > Propchange: tomcat/tc7.0.x/trunk/ > -- > Merged /tomcat/trunk:r1479248,1479951 > > Modified: > tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java > URL: > http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java?rev=1479953&r1=1479952&r2=1479953&view=diff > == > --- > tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java > (original) > +++ > tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java > Tue May 7 15:54:36 2013 > @@ -262,17 +262,34 @@ public class HttpParser { > } > } > > -private static SkipConstantResult skipConstant(StringReader input, > -String constant) throws IOException { > -int len = constant.length(); > +// Skip any LWS and return the next char > +private static int skipLws(StringReader input, boolean withReset) > +throws IOException { > > +if (withReset) { > +input.mark(1); > +} > int c = input.read(); > > -// Skip lws > -while (c == 32 || c == 9) { > +while (c == 32 || c == 9 || c == 10 || c == 13) { There are some other characters that could be considered as WS, e.g. FF and VT. Should those be allowed for? Also perhaps easier to read the comparisons as while (c == ' ' || c == '\t' || c == '\n' || c == '\r') { That also agrees with how the test case is written. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: svn commit: r1479953 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/http/parser/HttpParser.java test/org/apache/tomcat/util/http/parser/TestMediaType.java webapps/docs/changelog.xml
Mark, On 5/7/13 11:54 AM, ma...@apache.org wrote: > Author: markt > Date: Tue May 7 15:54:36 2013 > New Revision: 1479953 > > URL: http://svn.apache.org/r1479953 > Log: > Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=54703 > Be tolerant of applications that pass CR or LF in setHeader() values. > Fix some whitespace parsing issues idnetifed by the extended test cases in > readTokenOrQuotedString() How does this impact HTTP response-splitting exploits triggered by webapps that don't sanitize their response headers? Also: > +private static final String[] LWS_VALUES = new String[] { > +"", " ", "\t", "\r", "\n", "\r\n", " \r", " \n", " \r\n", > +"\r ", "\n ", "\r\n ", " \r ", " \n ", " \r\n " }; Is LWS_VALUES an empty string? Just a sanity check that headers without any leading whitespace don't cause any problems? Seems like many many other tests would verify that... -chris signature.asc Description: OpenPGP digital signature
Re: svn commit: r1479953 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/http/parser/HttpParser.java test/org/apache/tomcat/util/http/parser/TestMediaType.java webapps/docs/changelog.xml
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 08/05/2013 14:22, Christopher Schultz wrote: > Mark, > > On 5/7/13 11:54 AM, ma...@apache.org wrote: >> Author: markt Date: Tue May 7 15:54:36 2013 New Revision: >> 1479953 >> >> URL: http://svn.apache.org/r1479953 Log: Fix >> https://issues.apache.org/bugzilla/show_bug.cgi?id=54703 Be >> tolerant of applications that pass CR or LF in setHeader() >> values. Fix some whitespace parsing issues idnetifed by the >> extended test cases in readTokenOrQuotedString() > > How does this impact HTTP response-splitting exploits triggered by > webapps that don't sanitize their response headers? It does very little because only Content-Type headers are parsed. The likelihood any app vulnerable before this change is still vulenrable. > Also: > >> +private static final String[] LWS_VALUES = new String[] { + >> "", " ", "\t", "\r", "\n", "\r\n", " \r", " \n", " \r\n", + >> "\r ", "\n ", "\r\n ", " \r ", " \n ", " \r\n " }; > > Is LWS_VALUES an empty string? Just a sanity check that headers > without any leading whitespace don't cause any problems? Seems like > many many other tests would verify that... No, LWS_VALUES is an array of Strings one of which is the empty String. Each value in the array is used for a series of tests in turn. Mark -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBAgAGBQJRilxJAAoJEBDAHFovYFnnpFQP/1J8Z49BdozHxOPNsvq25+WV Mn9P53L/Dbhq3U/5dr+ZUlApCxsp+RVkFyoqKxdzc9ecOWjRGBrPGLoiBup57UQp +5jfR/p42iMsgVxD70uJx16oKjsyGM/HIrDWFDf6NkY+mYilMZQXMpRjPNRsGhyQ g7p/o22nQd+T88aa2IlOVvu9EZSW88DYGPwxKLVmQDI2uC0DygINr1mWqMhK7R7+ DDSVxK/dm30LSRJXTHAiHcbuhU3LbW5fkyOrFMYWCH8jT0vtkAkJhg/BRVoVSwt+ Aw9uK2eX+u+wQ41Z/39/Qx1s8/e/PWnfI+hpHIfCqCMCf5TiVHUxCgAyxA7Ytev1 FraaQm9O61cNQiMvoWEc9/E150LR7YZDNbkCvQ9uH5Ma2gdjkucPB+JP4TUjzhYb Z4Ff1hC9MOoZnaTjuU8ECrxv39EplTDnPOP9Lie5J+uaSNd3kIy5MZnN1paemZUw /FxH2L+sz5u+ckYlA/Q9NKnxMcx6srSOLo3jZe0wjT+e08DHl+pMuL8iF1pPBUlw ub4uil72T8qV6cR5H4Cl1YGsT1b89xsZ9/4y/WiODbeUwND8RYGTVD5fYmMSGJ10 ItmBPTXm86txlV67VbBN/QpQhZGsnvR/M5H5ErNBm+gA/kxACmqJxZHNCzuOo3Hq vRLtFouYZx3P5UcH/fw/ =JTZo -END PGP SIGNATURE- - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: svn commit: r1479953 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/http/parser/HttpParser.java test/org/apache/tomcat/util/http/parser/TestMediaType.java webapps/docs/changelog.xml
Mark, On 5/8/13 10:08 AM, Mark Thomas wrote: > On 08/05/2013 14:22, Christopher Schultz wrote: >> Mark, > >> On 5/7/13 11:54 AM, ma...@apache.org wrote: >>> Author: markt Date: Tue May 7 15:54:36 2013 New Revision: >>> 1479953 >>> >>> URL: http://svn.apache.org/r1479953 Log: Fix >>> https://issues.apache.org/bugzilla/show_bug.cgi?id=54703 Be >>> tolerant of applications that pass CR or LF in setHeader() >>> values. Fix some whitespace parsing issues idnetifed by the >>> extended test cases in readTokenOrQuotedString() > >> How does this impact HTTP response-splitting exploits triggered by >> webapps that don't sanitize their response headers? > > It does very little because only Content-Type headers are parsed. The > likelihood any app vulnerable before this change is still vulenrable. Aah, I didn't realize this was restricted to Content-Type headers -- I was only reading the diff itself. Thanks for the clarification. >> Also: > >>> +private static final String[] LWS_VALUES = new String[] { + >>> "", " ", "\t", "\r", "\n", "\r\n", " \r", " \n", " \r\n", + >>> "\r ", "\n ", "\r\n ", " \r ", " \n ", " \r\n " }; > >> Is LWS_VALUES an empty string? Just a sanity check that headers >> without any leading whitespace don't cause any problems? Seems like >> many many other tests would verify that... > > No, LWS_VALUES is an array of Strings one of which is the empty > String. Each value in the array is used for a series of tests in turn. Sorry, I attempted to say "Is LWS_VALUES[0] an empty string?". I see that you are running tests against each one... I was just wondering if the empty-string test was just for completeness rather than intending for it to be a certain type of whitespace (as opposed to none). Thanks, -chris signature.asc Description: OpenPGP digital signature
Re: Automatic deployment changes
Mark, On 5/7/13 5:05 PM, Mark Thomas wrote: > On 07/05/2013 21:13, Christopher Schultz wrote: >> Mark, > >> On 5/7/13 8:54 AM, Mark Thomas wrote: >>> In an attempt to improve the situation, I have tried to document >>> a proposed expected behaviour [4]. > >> Cool. Two question: > >> 1. What is the difference between "Y/N" and "-" in a column? Y/N >> seems to mean "does not matter". Does "-" mean "does not apply"? If >> both WAR=Y and DIR=Y (column headers, not row headers) which takes >> precedence? > > Y/N means the behaviour is the same regardless of how the option is > configured. > > The meaning of '-' varied a little between the tables. I've removed > them from the first table. > > In the second and third tables '-' means "unchanged from not present". > I could have used N but I wanted to make it clearer what was changing. > >> 2. Does the order of your table indicate precedence -- for example, >> we "prefer" XML to, say, WAR or DIR, right? If so, that indicates >> that we prefer "WAR" to "DIR" > > Yes. The order is always XML, WAR, DIR. > >> but above the table you say "If both a WAR and a DIR are available >> for a web application, Tomcat will serve content from the DIR." >> which indicates the opposite. > > That is strictly for performance reasons when serving content and > doesn't affect deployment. Perhaps I should clarify my question with an example: what happens when a WAR file is found and a DIR also exists with the same context name, but expandWars is false? Does the directory get updated with the contents of the WAR file, or does the WAR's descriptor control the deployment (subject to all the other behavior covered by your table(s)) and then (potentially old) content is served from the pre-existing DIR? Thanks, -chris signature.asc Description: OpenPGP digital signature
[Bug 54939] New: No useful logging when maxHeaderCount hit
https://issues.apache.org/bugzilla/show_bug.cgi?id=54939 Bug ID: 54939 Summary: No useful logging when maxHeaderCount hit Product: Tomcat 7 Version: 7.0.39 Hardware: All OS: All Status: NEW Severity: normal Priority: P2 Component: Connectors Assignee: dev@tomcat.apache.org Reporter: eric.dalqu...@doit.wisc.edu Classification: Unclassified Recent versions of tomcat 6 & 7 added the maxHeaderCount parameter to the connector configuration with a default value of 100. When this limit is hit Tomcat returns a HTTP 400 response with a blank page and in the default configuration nothing is logged by the server. The org.apache.coyote.ajp.AjpProcessor class logs the error at DEBUG level but that doesn't get written anywhere using the default configuration. The use case for more than 100 headers is the use of SSO systems that provide user attributes via HTTP headers. The Internet2 Shibboleth project is one good example, it is quite common to have well over 100 headers getting passed to Tomcat when using these systems. I'd like to propose one of the following fixes: - Write a message to the response explaining why the 400 response was returned. This would make it much easier for application deployers to determine the cause of the non-functional application. - Have a default logger setup for the AJP connector and change the log level to INFO. Perhaps this gets treated as a one time warning and the first request that hits this limit is logged as WARN and the subsequent requests are logged at DEBUG to avoid log clutter. - Increase the default value of maxHeaderCount to 1000 which would more easily accommodate the use of HTTP headers to pass user attributes. I'd be happy to provide a patch for any of these solutions or other proposed ideas. -- 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 54703] Nullpointer exception in HttpParser.parseMediaType
https://issues.apache.org/bugzilla/show_bug.cgi?id=54703 Jarek Gawor changed: What|Removed |Added CC||jga...@gmail.com --- Comment #7 from Jarek Gawor --- Thanks for reconsidering and changing the code. Things look better on our end now. Thanks again! -- 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 54939] No useful logging when maxHeaderCount hit
https://issues.apache.org/bugzilla/show_bug.cgi?id=54939 --- Comment #1 from Christopher Schultz --- An IllegalStateException should be thrown in this case. Are you not seeing that in any log? I would expect IllegalStateException to propagate back to the error page including a stack trace, etc. Is that not happening? -- 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 54939] No useful logging when maxHeaderCount hit
https://issues.apache.org/bugzilla/show_bug.cgi?id=54939 --- Comment #2 from Eric Dalquist --- The IllegalStateException is getting thrown but the try/catch that handles it sets the response to 400, logs the request and sets an error flag. No stack trace shows up in any log or on the rendered response. See: http://svn.apache.org/viewvc/tomcat/tc7.0.x/tags/TOMCAT_7_0_39/java/org/apache/coyote/ajp/AjpProcessor.java?revision=1459741&view=markup#l177 prepareRequest(); is the call that results in the IllegalStateException which is handled by the catch block starting at line 178. The exception is logged but at DEBUG level and to a logger that has no logging configuration in the default configuration. -- 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 54939] No useful logging when maxHeaderCount hit
https://issues.apache.org/bugzilla/show_bug.cgi?id=54939 Lyle Hanson changed: What|Removed |Added CC||issues.apache.org@lyle.33ma ||il.com -- 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 54939] No useful logging when maxHeaderCount hit
https://issues.apache.org/bugzilla/show_bug.cgi?id=54939 --- Comment #3 from Christopher Schultz --- Hmm. Sounds like using a new kind of exception type is appropriate: that could be logged specially. I wonder why Adapter.log() isn't actually logging anything... -- 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 54939] No useful logging when maxHeaderCount hit
https://issues.apache.org/bugzilla/show_bug.cgi?id=54939 --- Comment #4 from Eric Dalquist --- Adapter.log() logs the request so you see an entry in the localhost_access log that looks like: 128.104.17.46 - - [07/May/2013:15:50:44 -0500] "GET /portal/layout.json HTTP/1.1" 400 - That doesn't really give you any more information than what you see in the browser though. Is this something you'd be interested in seeing an external patch for? If you have some ideas on how you'd like to see it fixed I could take a pass at implementation. -- 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 53829] Timed out websocket hangs on send
https://issues.apache.org/bugzilla/show_bug.cgi?id=53829 jolangle.king changed: What|Removed |Added CC||gaochan...@126.com -- 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 54942] New: a design question of websocket
https://issues.apache.org/bugzilla/show_bug.cgi?id=54942 Bug ID: 54942 Summary: a design question of websocket Product: Tomcat 7 Version: 7.0.39 Hardware: PC OS: Windows XP Status: NEW Severity: normal Priority: P2 Component: Catalina Assignee: dev@tomcat.apache.org Reporter: gaochan...@126.com Classification: Unclassified hi,boys: there is a design question in the bound! for example: in my wesocketservlet, i write a loop in broadcast. eg. private void broadcast(String message) throws IOException{ String mmstr = ""; while(true) { for (ChatMessageInbound connection : connections) { String msg = "update:[" + mmstr +"] is over"; CharBuffer buffer = CharBuffer.wrap(msg); connection.getWsOutbound().writeTextMessage(buffer); } } } now,how did the servlet know it when the brower is closed? i hope you could add a boolean in the connection so that i can filter the connection,then change the condition of while (true).or just a empty while with a Thread.sleep(). -- 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 54942] a design question of websocket
https://issues.apache.org/bugzilla/show_bug.cgi?id=54942 Chuck Caldarale changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |INVALID --- Comment #1 from Chuck Caldarale --- Bugzilla is not a question and answer forum. Post your query on the Tomcat users' mailing list. -- 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: r1480531 - /tomcat/trunk/java/org/apache/catalina/storeconfig/StandardContextSF.java
Author: kfujino Date: Thu May 9 05:40:34 2013 New Revision: 1480531 URL: http://svn.apache.org/r1480531 Log: Add support for using non cluster manager in cluster environment. Modified: tomcat/trunk/java/org/apache/catalina/storeconfig/StandardContextSF.java Modified: tomcat/trunk/java/org/apache/catalina/storeconfig/StandardContextSF.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/storeconfig/StandardContextSF.java?rev=1480531&r1=1480530&r2=1480531&view=diff == --- tomcat/trunk/java/org/apache/catalina/storeconfig/StandardContextSF.java (original) +++ tomcat/trunk/java/org/apache/catalina/storeconfig/StandardContextSF.java Thu May 9 05:40:34 2013 @@ -254,7 +254,7 @@ public class StandardContextSF extends S storeElement(aWriter, indent, loader); // Store nested elements -if (context.getCluster() == null) { +if (context.getCluster() == null || !context.getManager().getDistributable()) { Manager manager = context.getManager(); storeElement(aWriter, indent, manager); } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1480533 - /tomcat/trunk/java/org/apache/catalina/mbeans/ContainerMBean.java
Author: kfujino Date: Thu May 9 05:55:55 2013 New Revision: 1480533 URL: http://svn.apache.org/r1480533 Log: Rename in order to prevent execution errors in via JMX. addLifeCycleListener -> addLifecycleListener removeLifeCycleListener -> removeLifecycleListener Modified: tomcat/trunk/java/org/apache/catalina/mbeans/ContainerMBean.java Modified: tomcat/trunk/java/org/apache/catalina/mbeans/ContainerMBean.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mbeans/ContainerMBean.java?rev=1480533&r1=1480532&r2=1480533&view=diff == --- tomcat/trunk/java/org/apache/catalina/mbeans/ContainerMBean.java (original) +++ tomcat/trunk/java/org/apache/catalina/mbeans/ContainerMBean.java Thu May 9 05:55:55 2013 @@ -223,7 +223,7 @@ public class ContainerMBean extends Base * * @param type ClassName of the listener to add */ -public void addLifeCycleListener(String type) throws MBeanException{ +public void addLifecycleListener(String type) throws MBeanException{ LifecycleListener listener = null; try { listener = (LifecycleListener)Class.forName(type).newInstance(); @@ -255,7 +255,7 @@ public class ContainerMBean extends Base * @param type The ClassName of the listeners to be removed. * Note that all the listeners having given ClassName will be removed. */ -public void removeLifeCycleListeners(String type) throws MBeanException{ +public void removeLifecycleListeners(String type) throws MBeanException{ Container container=null; try { container = (Container)getManagedResource(); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org