svn commit: r1198640 - /tomcat/trunk/java/org/apache/tomcat/util/http/Parameters.java

2011-11-07 Thread kkolinko
Author: kkolinko
Date: Mon Nov  7 08:25:02 2011
New Revision: 1198640

URL: http://svn.apache.org/viewvc?rev=1198640&view=rev
Log:
Restore handleQueryParameters() call that was lost in r1189882
This is not covered by our tests.

Modified:
tomcat/trunk/java/org/apache/tomcat/util/http/Parameters.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/http/Parameters.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/Parameters.java?rev=1198640&r1=1198639&r2=1198640&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/http/Parameters.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/http/Parameters.java Mon Nov  7 
08:25:02 2011
@@ -116,8 +116,8 @@ public final class Parameters {
 return Collections.enumeration(paramHashValues.keySet());
 }
 
-// Shortcut.
 public String getParameter(String name ) {
+handleQueryParameters();
 ArrayList values = paramHashValues.get(name);
 if (values != null) {
 if(values.size() == 0) {



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1198641 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/http/Parameters.java

2011-11-07 Thread kkolinko
Author: kkolinko
Date: Mon Nov  7 08:26:42 2011
New Revision: 1198641

URL: http://svn.apache.org/viewvc?rev=1198641&view=rev
Log:
Merged revision 1198640 from tomcat/trunk:
Restore handleQueryParameters() call that was lost in r1189882

Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/Parameters.java

Propchange: tomcat/tc7.0.x/trunk/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Nov  7 08:26:42 2011
@@ -1 +1 @@
-/tomcat/trunk:1156115,1156171,1156276,1156304,1156519,1156530,1156602,1157015,1157018,1157151,1157198,1157204,1157810,1157832,1157834,1157847,1157908,1157939,1158155,1158160,1158176,1158195,1158198-1158199,1158227,1158331,1158334-1158335,1158426,1160347,1160592,1160611,1160619,1160626,1160639,1160652,1160720-1160721,1160772,1160774,1160776,1161303,1161310,1161322,1161339,1161486,1161540,1161549,1161584,1162082,1162149,1162169,1162721,1162769,1162836,1162932,1163630,1164419,1164438,1164469,1164480,1164567,1165234,1165247-1165248,1165253,1165273,1165282,1165309,1165331,1165338,1165347,1165360-1165361,1165367-1165368,1165602,1165608,1165677,1165693,1165721,1165723,1165728,1165730,1165738,1165746,1165765,1165777,1165918,1165921,1166077,1166150-1166151,1166290,1166366,1166620,1166686,1166693,1166752,1166757,1167368,1167394,1169447,1170647,1171692,1172233-1172234,1172236,1172269,1172278,1172282,1172556,1172610,1172664,1172689,1172711,1173020-1173021,1173082,1173088,1173090,1173096
 
,1173241,1173256,1173288,117,1173342,1173461,1173614,1173630,1173659,1173722,1174061,1174239,1174322,1174325,1174329-1174330,1174337-1174339,1174343,1174353,1174799,1174882,1174884,1174983,1175155,1175158,1175167,1175182,1175190,1175201,1175272,1175275,1175283,1175582,1175589-1175590,1175594,1175602,1175613,1175633,1175690,1175713,1175798,1175889,1175896,1175907,1176584,1176590,1176799,1177050,1177060,1177125,1177152,1177160,1177245,1177850,1177862,1177978,1178209,1178228,1178233,1178449,1178542,1178681,1178684,1178721,1179268,1179274,1180261,1180865,1180891,1180894,1180907,1181028,1181123,1181125,1181136,1181291,1181743,1182796,1183078,1183105,1183142,1183328,1183339-1183340,1183492-1183494,1183605,1184917,1184919,1185018,1185020,1185200,1185588,1185626,1185756,1185758,1186011,1186042-1186045,1186104,1186123,1186137,1186153,1186254,1186257,1186377-1186379,1186479-1186480,1186712,1186743,1186750,1186763,1186890-1186892,1186894,1186949,1187018,1187027-1187028,1187381,1187
 
755,1187775,1187806,1187827,1188301,1188303-1188305,1188399,1188822,1188930-1188931,1189116,1189129,1189183,1189240,1189256,1189386,1189413-1189414,1189477,1189685,1189805,1189857,1189864,1189882,1190034,1190185,1190279,1190339,1190371,1190388-1190389,1190474,1190481,1194915,1195222-1195223,1195531,1195899,1195905,1195943,1195949,1195953,1195955,1195965,1195968,1196175,1196212,1196223,1196304-1196305,1196735,1196825,1196827,1197158,1197261,1197263,1197299-1197300,1197305,1197339-1197340,1197343,1197382,1197386-1197387,1197480,1197578,1198497,1198528,1198552,1198602,1198604,1198607,1198622
+/tomcat/trunk:1156115,1156171,1156276,1156304,1156519,1156530,1156602,1157015,1157018,1157151,1157198,1157204,1157810,1157832,1157834,1157847,1157908,1157939,1158155,1158160,1158176,1158195,1158198-1158199,1158227,1158331,1158334-1158335,1158426,1160347,1160592,1160611,1160619,1160626,1160639,1160652,1160720-1160721,1160772,1160774,1160776,1161303,1161310,1161322,1161339,1161486,1161540,1161549,1161584,1162082,1162149,1162169,1162721,1162769,1162836,1162932,1163630,1164419,1164438,1164469,1164480,1164567,1165234,1165247-1165248,1165253,1165273,1165282,1165309,1165331,1165338,1165347,1165360-1165361,1165367-1165368,1165602,1165608,1165677,1165693,1165721,1165723,1165728,1165730,1165738,1165746,1165765,1165777,1165918,1165921,1166077,1166150-1166151,1166290,1166366,1166620,1166686,1166693,1166752,1166757,1167368,1167394,1169447,1170647,1171692,1172233-1172234,1172236,1172269,1172278,1172282,1172556,1172610,1172664,1172689,1172711,1173020-1173021,1173082,1173088,1173090,1173096
 
,1173241,1173256,1173288,117,1173342,1173461,1173614,1173630,1173659,1173722,1174061,1174239,1174322,1174325,1174329-1174330,1174337-1174339,1174343,1174353,1174799,1174882,1174884,1174983,1175155,1175158,1175167,1175182,1175190,1175201,1175272,1175275,1175283,1175582,1175589-1175590,1175594,1175602,1175613,1175633,1175690,1175713,1175798,1175889,1175896,1175907,1176584,1176590,1176799,1177050,1177060,1177125,1177152,1177160,1177245,1177850,1177862,1177978,1178209,1178228,1178233,1178449,1178542,1178681,1178684,1178721,1179268,1179274,1180261,1180865,1180891,1180894,1180907,1181028,1181123,1181125,1181136,1181291,1181743,1182796,1183078,1183105,1183142,1183328,1183339-1183340,1183492-1183494,1183605,1184917,1184919,1185018,1185020,1185200,1185588,1185626,1185756,1185758,1186011,1186042-1186045,1186104,1186123,1186137,1186153,1186254,1186257,1186

svn commit: r1198649 - /tomcat/tc6.0.x/trunk/STATUS.txt

2011-11-07 Thread kkolinko
Author: kkolinko
Date: Mon Nov  7 08:30:06 2011
New Revision: 1198649

URL: http://svn.apache.org/viewvc?rev=1198649&view=rev
Log:
Add note

Modified:
tomcat/tc6.0.x/trunk/STATUS.txt

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1198649&r1=1198648&r2=1198649&view=diff
==
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Mon Nov  7 08:30:06 2011
@@ -85,7 +85,7 @@ PATCHES PROPOSED TO BACKPORT:
   http://svn.apache.org/viewvc?rev=1195222&view=rev - performance tweaks
   +1: markt, jfclere
   -1:
-kkolinko: +r1195943 is needed, and maybe (r1195531+r1195905)
+kkolinko: +r1195943,r1198641 are needed, and maybe (r1195531+r1195905, 
r1195949)
 
 * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=52091
   Address performance issues related to log creation TagHandlerPool.



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: svn commit: r1198640 - /tomcat/trunk/java/org/apache/tomcat/util/http/Parameters.java

2011-11-07 Thread Konstantin Kolinko
2011/11/7  :
> Author: kkolinko
> Date: Mon Nov  7 08:25:02 2011
> New Revision: 1198640
>
> URL: http://svn.apache.org/viewvc?rev=1198640&view=rev
> Log:
> Restore handleQueryParameters() call that was lost in r1189882
> This is not covered by our tests.
>
> Modified:
>    tomcat/trunk/java/org/apache/tomcat/util/http/Parameters.java
>
> --- tomcat/trunk/java/org/apache/tomcat/util/http/Parameters.java (original)
> +++ tomcat/trunk/java/org/apache/tomcat/util/http/Parameters.java Mon Nov  7 
> 08:25:02 2011
> @@ -116,8 +116,8 @@ public final class Parameters {
>         return Collections.enumeration(paramHashValues.keySet());
>     }
>
> -    // Shortcut.
>     public String getParameter(String name ) {
> +        handleQueryParameters();
>         ArrayList values = paramHashValues.get(name);
>         if (values != null) {
>             if(values.size() == 0) {
>

Old implementation called getParameterValues() which called
handleQueryParameters().

What is odd is that there is above all this there is the following comment:
//  Data access 
// Access to the current name/values, no side effect ( processing ).
// You must explicitly call handleQueryParameters and the post methods.

Whatever needs handleQueryParameters() call there is not covered by
our testsuite.

I've already ported this commit to 7.0 - r1198641.

Best regards,
Konstantin Kolinko

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Unsubscribe From Mailing List

2011-11-07 Thread joshua . morris1
How do I unsubscribe



Re: Unsubscribe From Mailing List

2011-11-07 Thread Konstantin Kolinko
2011/11/7 joshua.morris1 :
> How do I unsubscribe
>
>

http://www.apache.org/foundation/mailinglists.html

Send a short plain text e-mail to the unsubscription address mentioned here:
http://tomcat.apache.org/lists.html

You will receive a confirmation e-mail. You should reply to it to
confirm unsubscription.

If nothing helps, send mail to "list owner" address so that he would
unsubscribe you manually.

Best regards,
Konstantin Kolinko

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1198677 - /tomcat/trunk/java/org/apache/catalina/Globals.java

2011-11-07 Thread kkolinko
Author: kkolinko
Date: Mon Nov  7 09:42:55 2011
New Revision: 1198677

URL: http://svn.apache.org/viewvc?rev=1198677&view=rev
Log:
Add constants for the request attribute names used by Comet and Sendfile 
support.

Modified:
tomcat/trunk/java/org/apache/catalina/Globals.java

Modified: tomcat/trunk/java/org/apache/catalina/Globals.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/Globals.java?rev=1198677&r1=1198676&r2=1198677&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/Globals.java (original)
+++ tomcat/trunk/java/org/apache/catalina/Globals.java Mon Nov  7 09:42:55 2011
@@ -156,6 +156,76 @@ public final class Globals {
 
 
 /**
+ * The request attribute that is set to the value of {@code Boolean.TRUE}
+ * if connector processing this request supports Comet API.
+ */
+public static final String COMET_SUPPORTED_ATTR =
+"org.apache.tomcat.comet.support";
+
+
+/**
+ * The request attribute that is set to the value of {@code Boolean.TRUE}
+ * if connector processing this request supports setting
+ * per-connection request timeout through Comet API.
+ *
+ * @see org.apache.catalina.comet.CometEvent#setTimeout(int)
+ */
+public static final String COMET_TIMEOUT_SUPPORTED_ATTR =
+"org.apache.tomcat.comet.timeout.support";
+
+
+/**
+ * The request attribute that can be set to a value of type
+ * {@code java.lang.Integer} to specify per-connection request
+ * timeout for Comet API. The value is in milliseconds.
+ *
+ * @see org.apache.catalina.comet.CometEvent#setTimeout(int)
+ */
+public static final String COMET_TIMEOUT_ATTR =
+"org.apache.tomcat.comet.timeout";
+
+
+/**
+ * The request attribute that is set to the value of {@code Boolean.TRUE}
+ * if connector processing this request supports use of sendfile.
+ */
+public static final String SENDFILE_SUPPORTED_ATTR =
+"org.apache.tomcat.sendfile.support";
+
+
+/**
+ * The request attribute that can be used by a servlet to pass
+ * to the connector the name of the file that is to be served
+ * by sendfile. The value should be {@code java.lang.String}
+ * that is {@code File.getCanonicalPath()} of the file to be served.
+ */
+public static final String SENDFILE_FILENAME_ATTR =
+"org.apache.tomcat.sendfile.filename";
+
+
+/**
+ * The request attribute that can be used by a servlet to pass
+ * to the connector the start offset of the part of a file
+ * that is to be served by sendfile. The value should be
+ * {@code java.lang.Long}. To serve complete file
+ * the value should be {@code Long.valueOf(0)}.
+ */
+public static final String SENDFILE_FILE_START_ATTR =
+"org.apache.tomcat.sendfile.start";
+
+
+/**
+ * The request attribute that can be used by a servlet to pass
+ * to the connector the end offset (not including) of the part
+ * of a file that is to be served by sendfile. The value should be
+ * {@code java.lang.Long}. To serve complete file
+ * the value should be equal to the length of the file.
+ */
+public static final String SENDFILE_FILE_END_ATTR =
+"org.apache.tomcat.sendfile.end";
+
+
+/**
  * The master flag which controls strict servlet specification
  * compliance.
  */



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1198696 - in /tomcat/trunk/java/org/apache: catalina/Globals.java catalina/connector/Request.java catalina/filters/FailedRequestFilter.java tomcat/util/http/Parameters.java

2011-11-07 Thread kkolinko
Author: kkolinko
Date: Mon Nov  7 10:46:14 2011
New Revision: 1198696

URL: http://svn.apache.org/viewvc?rev=1198696&view=rev
Log:
Introduce new request attribute to be used to mark request if there was a 
failure during parameter parsing,
and a Filter that triggers parameter parsing and rejects requests marked with 
that attribute.

Added:
tomcat/trunk/java/org/apache/catalina/filters/FailedRequestFilter.java   
(with props)
Modified:
tomcat/trunk/java/org/apache/catalina/Globals.java
tomcat/trunk/java/org/apache/catalina/connector/Request.java
tomcat/trunk/java/org/apache/tomcat/util/http/Parameters.java

Modified: tomcat/trunk/java/org/apache/catalina/Globals.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/Globals.java?rev=1198696&r1=1198695&r2=1198696&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/Globals.java (original)
+++ tomcat/trunk/java/org/apache/catalina/Globals.java Mon Nov  7 10:46:14 2011
@@ -226,6 +226,17 @@ public final class Globals {
 
 
 /**
+ * The request attribute that is set to {@code Boolean.TRUE} if some 
request
+ * parameters have been ignored during request parameters parsing. It can
+ * happen, for example, if there is a limit on the total count of parseable
+ * parameters, or if parameter cannot be decoded, or any other error
+ * happened during parameter parsing.
+ */
+public static final String PARAMETER_PARSE_FAILED_ATTR =
+"org.apache.catalina.parameter_parse_failed";
+
+
+/**
  * The master flag which controls strict servlet specification
  * compliance.
  */

Modified: tomcat/trunk/java/org/apache/catalina/connector/Request.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Request.java?rev=1198696&r1=1198695&r2=1198696&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/connector/Request.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/Request.java Mon Nov  7 
10:46:14 2011
@@ -2383,6 +2383,12 @@ public class Request
 }
 }
 
+private void checkParameterParseFailed() {
+if (getCoyoteRequest().getParameters().isParseFailed()) {
+setAttribute(Globals.PARAMETER_PARSE_FAILED_ATTR, Boolean.TRUE);
+}
+}
+
 public void cometClose() {
 coyoteRequest.action(ActionCode.COMET_CLOSE,getEvent());
 setComet(false);
@@ -2487,109 +2493,117 @@ public class Request
 
 Parameters parameters = coyoteRequest.getParameters();
 
-File location;
-String locationStr = mce.getLocation();
-if (locationStr == null || locationStr.length() == 0) {
-location = ((File) context.getServletContext().getAttribute(
-ServletContext.TEMPDIR));
-} else {
-location = new File(locationStr);
-}
-
-if (!location.isAbsolute() || !location.isDirectory()) {
-partsParseException = new IOException(
-sm.getString("coyoteRequest.uploadLocationInvalid",
-location));
-return;
-}
-
-// Create a new file upload handler
-DiskFileItemFactory factory = new DiskFileItemFactory();
+boolean success = false;
 try {
-factory.setRepository(location.getCanonicalFile());
-} catch (IOException ioe) {
-partsParseException = ioe;
-return;
-}
-factory.setSizeThreshold(mce.getFileSizeThreshold());
+File location;
+String locationStr = mce.getLocation();
+if (locationStr == null || locationStr.length() == 0) {
+location = ((File) context.getServletContext().getAttribute(
+ServletContext.TEMPDIR));
+} else {
+location = new File(locationStr);
+}
 
-ServletFileUpload upload = new ServletFileUpload();
-upload.setFileItemFactory(factory);
-upload.setFileSizeMax(mce.getMaxFileSize());
-upload.setSizeMax(mce.getMaxRequestSize());
+if (!location.isAbsolute() || !location.isDirectory()) {
+partsParseException = new IOException(
+sm.getString("coyoteRequest.uploadLocationInvalid",
+location));
+return;
+}
 
-parts = new ArrayList();
-try {
-List items = upload.parseRequest(this);
-int maxPostSize = getConnector().getMaxPostSize();
-int postSize = 0;
-String enc = getCharacterEncoding();
-Charset charset = null;
-if (enc != null) {
-try {
-charset = B2CConverter.getCharset(enc);
-} catch (UnsupportedEncodingEx

svn commit: r1198707 - in /tomcat/trunk/java/org/apache/catalina: connector/Request.java filters/FailedRequestFilter.java

2011-11-07 Thread kkolinko
Author: kkolinko
Date: Mon Nov  7 11:30:51 2011
New Revision: 1198707

URL: http://svn.apache.org/viewvc?rev=1198707&view=rev
Log:
Followup to r1198696:
- Fix bug in Request#parseParameters():
Forgot to flag the main use case of parsing POST parameters as successful.
- Update comment in FailedRequestFilter.

Modified:
tomcat/trunk/java/org/apache/catalina/connector/Request.java
tomcat/trunk/java/org/apache/catalina/filters/FailedRequestFilter.java

Modified: tomcat/trunk/java/org/apache/catalina/connector/Request.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Request.java?rev=1198707&r1=1198706&r2=1198707&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/connector/Request.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/Request.java Mon Nov  7 
11:30:51 2011
@@ -2897,6 +2897,7 @@ public class Request
 parameters.processParameters(formData, 0, formData.length);
 }
 }
+success = true;
 } finally {
 if (!success) {
 parameters.setParseFailed(true);

Modified: tomcat/trunk/java/org/apache/catalina/filters/FailedRequestFilter.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/filters/FailedRequestFilter.java?rev=1198707&r1=1198706&r2=1198707&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/filters/FailedRequestFilter.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/filters/FailedRequestFilter.java Mon 
Nov  7 11:30:51 2011
@@ -38,9 +38,10 @@ import org.apache.juli.logging.LogFactor
  *
  * 
  * Note that it has side effect that it triggers parameter parsing and thus
- * consumes the body for POST requests, so use it only with addresses that do 
not
- * use request.getInputStream() and
- * request.getReader().
+ * consumes the body for POST requests. Parameter parsing does check content
+ * type of the request, so there should not be problems with addresses that use
+ * request.getInputStream() and request.getReader(),
+ * if requests parsed by them do not use standard value for content mime-type.
  */
 public class FailedRequestFilter extends FilterBase implements CometFilter {
 



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



FailedRequestFilter

2011-11-07 Thread Konstantin Kolinko
Hi!

In trunk I committed a new feature: request attribute that is set if
there were problems during parameter parsing and FailedRequestFilter -
filter that rejects requests if that request attribute is set.

I would like this to be ported to TC7 and earlier versions up to 5.5,
but will wait a while for review and feedback.

To test it I recommend to add the following to the default conf/web.xml:

[[[

failedRequestFilter

  org.apache.catalina.filters.FailedRequestFilter

true


failedRequestFilter
/*

]]]

Revisions in trunk implementing this feature:
http://svn.apache.org/viewvc?rev=1198696&view=rev
http://svn.apache.org/viewvc?rev=1198707&view=rev

Best regards,
Konstantin Kolinko

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: Redeploy on context.xml changes (Was: Tagging 7.0.23)

2011-11-07 Thread Konstantin Kolinko
2011/11/6 Konstantin Kolinko :
> 2011/11/6 Mark Thomas :
>>
>> I'm in two minds whether to apply this patch before or after the 7.0.23
>> tag. There are clearly issues here that need fixing but the patch is
>> quite invasive. I'm leaning towards tagging after the patch is applied.
>> Thoughts?
>>
>
> In short: I think there are two issues
> a) what FailedContext solves
> b) touching context.xml causing redeploy instead of reload
>
> I think a) needs to be solved asap and likely to be backported.

I mean, handling deployment failures.

Being stumbled here I agree that looks like it is better to cut 7.0.x
as is and take several days after that to though of a better solution.

> b) can be postponed.
>
> Regarding b) - remember that order of entries in redeploy list used by
> autodeploy check is very important (because files ##(n+1)..last are
> deleted if file #n is touched).  I am not yet sure that the patch is
> safe adding context.xml there.

There is StandardContext#setDefaultContextXml() method.
Maybe implement something like that in FailedContext.

In those places where you are replacing addWatchedResource() with
addRedeployResource() - maybe do not do such replacement.

Instead of that in HostConfig#addWatchedResources() or elsewhere use
the value of StandardContext#getDefaultContextXml() and add that file
to redeploy resources explicitly. Thusly we will have more precise
control on their order.

Maybe in HostConfig$DeployedApplication.redeployResources do store
explicit flag whether the resource is supposed to be deleted on
undeploy. (Instead of checking file paths before deleting the resource
in HostConfig#checkResources()).
Maybe I am just afraid of those path checks in #checkResources() and
adding a comment there can resolve it.


> 
> Regarding RequestFilterValve:

Question is solved. Updated the valve implementation earlier today and
merged to TC7.

Best regards,
Konstantin Kolinko

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: FailedRequestFilter

2011-11-07 Thread Konstantin Kolinko
2011/11/7 Konstantin Kolinko :
> Hi!
>
> In trunk I committed a new feature: request attribute that is set if
> there were problems during parameter parsing and FailedRequestFilter -
> filter that rejects requests if that request attribute is set.
>
> I would like this to be ported to TC7 and earlier versions up to 5.5,
> but will wait a while for review and feedback.
>
> To test it I recommend to add the following to the default conf/web.xml:
>
> [[[
>    
>        failedRequestFilter
>        
>          org.apache.catalina.filters.FailedRequestFilter
>        
>        true
>    
>    
>        failedRequestFilter
>        /*
>    
> ]]]
>
> Revisions in trunk implementing this feature:
> http://svn.apache.org/viewvc?rev=1198696&view=rev
> http://svn.apache.org/viewvc?rev=1198707&view=rev
>

Current results with the above fragment added to the default conf/web.xml:
- Examples app OK
- Testsuite passes BIOxNIOxAPR,
 though I am not sure whether the tests use conf/web.xml or not.
- WAR upload in manager webapp:
file uploads successfully and the app is deployed,
but there are errors during deployment and undeployment.


I think this FailedRequestFilter is OK for further backport.

Remaining tasks are documenting it:  in config/filters.xml. Maybe add
mention of it to maxParameterCount attribute in config/http.xml and
config/ajp.xml and  to maxParameterCount feature description in
changelog.  I am not yet sure whether to add a commented-out example
of it in the default web.xml, but it seems useful.


Regarding the manager webapp I think the error is not related to this
feature. I will start separate thread with more details. The manager
webapp in trunk as of now is broken.

Best regards,
Konstantin Kolinko

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Problem deploying WAR with manager app in trunk

2011-11-07 Thread Konstantin Kolinko
Hi!

trunk@1198734, JDK 6u29, WinXP
Using a zipped copy of examples webapp, named "examples3.war"
Logs use org.apache.juli.OneLineFormatter

The FailedContext patch is not applied. (Deleted all /classes and all
jars and recompiled - problem reproducible).

Steps to reproduce:

1. Login to the manager webapp and upload the war.

The following is printed in catalina<..>.log::

[[[
07-Nov-2011 16:37:59.453 INFO [http-bio-8080-exec-2]
org.apache.catalina.startup.HostConfig.deployWAR Deploying web
application archive C:\(...)\build\webapps\examples3.war
07-Nov-2011 16:38:01.718 INFO [http-bio-8080-exec-2]
org.apache.catalina.startup.HostConfig.deployDirectory Deploying web
application directory C:\(...)\build\webapps\examples3
07-Nov-2011 16:38:01.718 SEVERE [http-bio-8080-exec-2]
org.apache.catalina.startup.HostConfig.deployDirectory Error deploying
web application directory C:\(...)\build\webapps\examples3
 java.lang.IllegalArgumentException: addChild:  Child name
'/examples3' is not unique
at 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:830)
at 
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:820)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:644)
at 
org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1060)
at 
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:516)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1387)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at 
org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
at 
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
at 
com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
at 
org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1407)
at 
org.apache.catalina.manager.HTMLManagerServlet.upload(HTMLManagerServlet.java:334)
at 
org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:211)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at 
org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:186)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at 
org.apache.catalina.filters.FailedRequestFilter.doFilter(FailedRequestFilter.java:63)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at 
org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:147)
at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:567)
at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:146)
at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:74)
at 
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:912)
at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:90)
at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at 
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:983)
at 
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
at 
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:304)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
]]]

The application thou

svn commit: r1198740 - /tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java

2011-11-07 Thread olamy
Author: olamy
Date: Mon Nov  7 14:06:26 2011
New Revision: 1198740

URL: http://svn.apache.org/viewvc?rev=1198740&view=rev
Log:
[MTOMCAT-100] support war overlay to add war external dependencies in tomcat run
avoid duplicate jars in the webappclassloader: can cause issues with struts2

Modified:

tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java

Modified: 
tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java
URL: 
http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java?rev=1198740&r1=1198739&r2=1198740&view=diff
==
--- 
tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java
 (original)
+++ 
tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java
 Mon Nov  7 14:06:26 2011
@@ -59,6 +59,8 @@ public class DefaultClassLoaderEntriesCa
 {
 Set classLoaderEntries = new LinkedHashSet();
 
+List fileInClassLoaderEntries = new ArrayList();
+
 List tmpDirectories = new ArrayList();
 
 // add classes directories to loader
@@ -113,7 +115,12 @@ public class DefaultClassLoaderEntriesCa
 + artifact.getVersion() + ":" + 
artifact.getScope() );
 if ( !isInProjectReferences( artifact, 
request.getMavenProject() ) )
 {
-classLoaderEntries.add( 
artifact.getFile().toURI().toString() );
+String fileName = artifact.getFile().getName();
+if ( !fileInClassLoaderEntries.contains( fileName ) )
+{
+classLoaderEntries.add( 
artifact.getFile().toURI().toString() );
+fileInClassLoaderEntries.add( fileName );
+}
 }
 else
 {
@@ -122,8 +129,6 @@ public class DefaultClassLoaderEntriesCa
 }
 }
 
-
-
 // in case of war dependency we must add /WEB-INF/lib/*.jar in 
entries and WEB-INF/classes
 if ( "war".equals( artifact.getType() ) && 
request.isAddWarDependenciesInClassloader() )
 {
@@ -143,7 +148,6 @@ public class DefaultClassLoaderEntriesCa
 unArchiver.setDestDirectory( tmpDir );
 unArchiver.extract();
 
-
 File libsDirectory = new File( tmpDir, "WEB-INF/lib" );
 if ( libsDirectory.exists() )
 {
@@ -156,7 +160,17 @@ public class DefaultClassLoaderEntriesCa
 } );
 for ( String jar : jars )
 {
-classLoaderEntries.add( new File( 
libsDirectory, jar ).toURI().toString() );
+File jarFile = new File( libsDirectory, jar );
+if ( !fileInClassLoaderEntries.contains( 
jarFile.getName() ) )
+{
+classLoaderEntries.add( 
jarFile.toURI().toString() );
+fileInClassLoaderEntries.add( 
jarFile.getName() );
+}
+else
+{
+request.getLog().debug( "skip adding file 
" + jarFile.getPath()
++ " as it's 
already in classloader entries" );
+}
 }
 }
 File classesDirectory = new File( tmpDir, 
"WEB-INF/classes" );



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[jira] [Commented] (MTOMCAT-100) support war overlay to add war external dependencies in tomcat run

2011-11-07 Thread Hudson (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/MTOMCAT-100?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13145512#comment-13145512
 ] 

Hudson commented on MTOMCAT-100:


Integrated in TomcatMavenPlugin #62 (See 
[https://builds.apache.org/job/TomcatMavenPlugin/62/])
[MTOMCAT-100] support war overlay to add war external dependencies in 
tomcat run
avoid duplicate jars in the webappclassloader: can cause issues with struts2

olamy : http://svn.apache.org/viewvc/?view=rev&rev=1198740
Files : 
* 
/tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java


> support war overlay to add war external dependencies in tomcat run 
> ---
>
> Key: MTOMCAT-100
> URL: https://issues.apache.org/jira/browse/MTOMCAT-100
> Project: Apache Tomcat Maven Plugin
>  Issue Type: Improvement
>  Components: tomcat6, tomcat7
>Reporter: Olivier Lamy
>Assignee: Olivier Lamy
> Fix For: 2.0
>
>
>  /WEB-INF/lib/*.jar and /WEB-INF/classes will added to web app classloader 
> when using tomcat*:run to do as war overlays does.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



DO NOT REPLY [Bug 52148] New: Missing jars in catalina-tasks.xml

2011-11-07 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=52148

 Bug #: 52148
   Summary: Missing jars in catalina-tasks.xml
   Product: Tomcat 7
   Version: 7.0.22
  Platform: PC
OS/Version: Linux
Status: NEW
  Severity: minor
  Priority: P2
 Component: Packaging
AssignedTo: dev@tomcat.apache.org
ReportedBy: volker.kr...@abas.de
Classification: Unclassified


When importing catalina-task.xml and running the list task I get an
java.lang.NoClassDefFoundError: org/apache/tomcat/util/buf/B2CConverter

tomcat-coyote.jar is missing in the classpath.

Solution:
Add

to taskdef classpath in catalina-task.xml

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- 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



DO NOT REPLY [Bug 52148] Missing jars in catalina-tasks.xml

2011-11-07 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=52148

--- Comment #1 from Volker Krebs  2011-11-07 15:10:58 UTC 
---
It's like Bug 51621

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- 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



Re: svn commit: r1198696 - in /tomcat/trunk/java/org/apache: catalina/Globals.java catalina/connector/Request.java catalina/filters/FailedRequestFilter.java tomcat/util/http/Parameters.java

2011-11-07 Thread Rainer Jung
Hi Konstantin,

On 07.11.2011 02:46, kkoli...@apache.org wrote:
> Author: kkolinko
> Date: Mon Nov  7 10:46:14 2011
> New Revision: 1198696
> 
> URL: http://svn.apache.org/viewvc?rev=1198696&view=rev
> Log:
> Introduce new request attribute to be used to mark request if there was a 
> failure during parameter parsing,
> and a Filter that triggers parameter parsing and rejects requests marked with 
> that attribute.
> 
> Added:
> tomcat/trunk/java/org/apache/catalina/filters/FailedRequestFilter.java   
> (with props)
> Modified:
> tomcat/trunk/java/org/apache/catalina/Globals.java
> tomcat/trunk/java/org/apache/catalina/connector/Request.java
> tomcat/trunk/java/org/apache/tomcat/util/http/Parameters.java
> 
> Modified: tomcat/trunk/java/org/apache/catalina/Globals.java
> URL: 
> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/Globals.java?rev=1198696&r1=1198695&r2=1198696&view=diff
> ==
> --- tomcat/trunk/java/org/apache/catalina/Globals.java (original)
> +++ tomcat/trunk/java/org/apache/catalina/Globals.java Mon Nov  7 10:46:14 
> 2011
> @@ -226,6 +226,17 @@ public final class Globals {
>  
>  
>  /**
> + * The request attribute that is set to {@code Boolean.TRUE} if some 
> request
> + * parameters have been ignored during request parameters parsing. It can
> + * happen, for example, if there is a limit on the total count of 
> parseable
> + * parameters, or if parameter cannot be decoded, or any other error
> + * happened during parameter parsing.
> + */
> +public static final String PARAMETER_PARSE_FAILED_ATTR =
> +"org.apache.catalina.parameter_parse_failed";

I don't now if we ever have to make the new request attribute available
in coyote request, but in o.a.c.connector.Request there is code that
only passes attributes down to the coyote request if the attribute name
starts with "org.apache.tomcat". See removeAttribute() and setAttribute():

1413 // Pass special attributes to the native layer
1414 if (name.startsWith("org.apache.tomcat.")) {
1415 coyoteRequest.getAttributes().remove(name);
1416 }
...
1520 // Pass special attributes to the native layer
1521 if (name.startsWith("org.apache.tomcat.")) {
1522 coyoteRequest.setAttribute(name, value);
1523 }

In fact this use of "org.apache.tomcat." could also another Global constant.

Regards,

Rainer

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



DO NOT REPLY [Bug 51653] ServletRequestListener.requestDestroyed is called before request leaves a webapp

2011-11-07 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=51653

--- Comment #8 from Eitan Suez  2011-11-07 17:31:41 UTC 
---
(In reply to comment #7)
> Did you just pick a bug at random and add your comments?
> 
no.

> Please join the Tomcat Users mailing list and ask for help there - Bugzilla is
> not a support forum.
ok; got it, thanks.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- 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



Re: svn commit: r1198696 - in /tomcat/trunk/java/org/apache: catalina/Globals.java catalina/connector/Request.java catalina/filters/FailedRequestFilter.java tomcat/util/http/Parameters.java

2011-11-07 Thread Konstantin Kolinko
2011/11/7 Rainer Jung :
> Hi Konstantin,
>
> On 07.11.2011 02:46, kkoli...@apache.org wrote:
>> Author: kkolinko
>> Date: Mon Nov  7 10:46:14 2011
>> New Revision: 1198696
>>
>> URL: http://svn.apache.org/viewvc?rev=1198696&view=rev
>> Log:
>> Introduce new request attribute to be used to mark request if there was a 
>> failure during parameter parsing,
>> and a Filter that triggers parameter parsing and rejects requests marked 
>> with that attribute.
>>
>> Added:
>>     tomcat/trunk/java/org/apache/catalina/filters/FailedRequestFilter.java   
>> (with props)
>> Modified:
>>     tomcat/trunk/java/org/apache/catalina/Globals.java
>>     tomcat/trunk/java/org/apache/catalina/connector/Request.java
>>     tomcat/trunk/java/org/apache/tomcat/util/http/Parameters.java
>>
>>
>>      /**
>> +     * The request attribute that is set to {@code Boolean.TRUE} if some 
>> request
>> +     * parameters have been ignored during request parameters parsing. It 
>> can
>> +     * happen, for example, if there is a limit on the total count of 
>> parseable
>> +     * parameters, or if parameter cannot be decoded, or any other error
>> +     * happened during parameter parsing.
>> +     */
>> +    public static final String PARAMETER_PARSE_FAILED_ATTR =
>> +        "org.apache.catalina.parameter_parse_failed";
>
> I don't now if we ever have to make the new request attribute available
> in coyote request, but in o.a.c.connector.Request there is code that
> only passes attributes down to the coyote request if the attribute name
> starts with "org.apache.tomcat". See removeAttribute() and setAttribute():
>
> 1413         // Pass special attributes to the native layer
> 1414         if (name.startsWith("org.apache.tomcat.")) {
> 1415             coyoteRequest.getAttributes().remove(name);
> 1416         }
> ...
> 1520         // Pass special attributes to the native layer
> 1521         if (name.startsWith("org.apache.tomcat.")) {
> 1522             coyoteRequest.setAttribute(name, value);
> 1523         }
>
> In fact this use of "org.apache.tomcat." could also another Global constant.
>

Thank you for the comment.

I agree "org.apache.tomcat." could be a constant.
Need to think of a good name like COYOTE_ATTR_PREFIX.
The "Pass ... to the native layer" comment is understandable,
but seems outdated with Nio implementation there besides Apr one.

If there isn't a constant, there could be a comment in Globals
mentioning the prefix.


Regarding PARAMETER_PARSE_FAILED_ATTR, its value is present
in the "native layer" as Parameters.isParseFailed(),
and the attribute is used only to pass this information up to Servlets.

I delegate the decision what to do to Valves/Filters/Servlets that
check the attribute. I do not see anything that can happen at the
"native layer".


Instead of Request#checkParameterParseFailed() there could be
alternative implementation as a new "if(name.equals(...))" branch in
Request#getAttribute().

Side effects are that the new attribute is listed in
Request.getAttributeNames() enumeration (unlike other special
attributes that are omitted there) and can be changed by
Request#setAttribute(), Request#removeAttribute().


Best regards,
Konstantin Kolinko

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1199122 - in /tomcat/tc6.0.x/trunk: STATUS.txt java/org/apache/catalina/filters/CsrfPreventionFilter.java java/org/apache/catalina/filters/FilterBase.java webapps/docs/changelog.xml

2011-11-07 Thread kkolinko
Author: kkolinko
Date: Tue Nov  8 06:37:57 2011
New Revision: 1199122

URL: http://svn.apache.org/viewvc?rev=1199122&view=rev
Log:
Make configuration issue for CsrfPreventionFilter result
in the failure of the filter rather than just a warning message.

Modified:
tomcat/tc6.0.x/trunk/STATUS.txt

tomcat/tc6.0.x/trunk/java/org/apache/catalina/filters/CsrfPreventionFilter.java
tomcat/tc6.0.x/trunk/java/org/apache/catalina/filters/FilterBase.java
tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1199122&r1=1199121&r2=1199122&view=diff
==
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Tue Nov  8 06:37:57 2011
@@ -73,13 +73,6 @@ PATCHES PROPOSED TO BACKPORT:
   +1: kkolinko, kfujino, markt
   -1:
 
-* Make configuration issue for CsrfPreventionFilter result
-  in the failure of the filter rather than just a warning message.
-  
http://people.apache.org/~kkolinko/patches/2011-10-26_tc6_CsrfPreventionFilter.patch
-  It is based on the filters part of r1189256 (r1189258 in TC7)
-  +1: kkolinko, kfujino, jfclere
-  -1:
-
 * Improve performance of parameter processing.
   http://people.apache.org/~markt/patches/2011-10-29-param-perf-tc6-v2.patch
   http://svn.apache.org/viewvc?rev=1195222&view=rev - performance tweaks

Modified: 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/filters/CsrfPreventionFilter.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/filters/CsrfPreventionFilter.java?rev=1199122&r1=1199121&r2=1199122&view=diff
==
--- 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/filters/CsrfPreventionFilter.java 
(original)
+++ 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/filters/CsrfPreventionFilter.java 
Tue Nov  8 06:37:57 2011
@@ -186,6 +186,13 @@ public class CsrfPreventionFilter extend
 chain.doFilter(request, wResponse);
 }
 
+
+@Override
+protected boolean isConfigProblemFatal() {
+return true;
+}
+
+
 /**
  * Generate a once time token (nonce) for authenticating subsequent
  * requests. This will also add the token to the session. The nonce

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/filters/FilterBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/filters/FilterBase.java?rev=1199122&r1=1199121&r2=1199122&view=diff
==
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/filters/FilterBase.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/filters/FilterBase.java Tue 
Nov  8 06:37:57 2011
@@ -49,8 +49,13 @@ public abstract class FilterBase impleme
 String paramName = (String) paramNames.nextElement();
 if (!IntrospectionUtils.setProperty(this, paramName,
 filterConfig.getInitParameter(paramName))) {
-getLogger().warn(sm.getString("filterbase.noSuchProperty",
-paramName, this.getClass().getName()));
+String msg = sm.getString("filterbase.noSuchProperty",
+paramName, this.getClass().getName());
+if (isConfigProblemFatal()) {
+throw new ServletException(msg);
+} else {
+getLogger().warn(msg);
+}
 }
 }
 }
@@ -59,4 +64,15 @@ public abstract class FilterBase impleme
 // NOOP
 }
 
+/**
+ * Determines if an exception when calling a setter or an unknown
+ * configuration attribute triggers the failure of the this filter which in
+ * turn will prevent the web application from starting.
+ *
+ * @return true if a problem should trigger the failure of 
this
+ * filter, else false
+ */
+protected boolean isConfigProblemFatal() {
+return false;
+}
 }

Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=1199122&r1=1199121&r2=1199122&view=diff
==
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Tue Nov  8 06:37:57 2011
@@ -98,6 +98,10 @@
 In GenericPrincipal, SerializablePrincipal: Do not sort lists of roles
 that have only one element. (kkolinko)
   
+  
+Make configuration issue for CsrfPreventionFilter result in the
+failure of the filter rather than just a warning message. (kkolinko)
+  
 
   
   



-
To unsubscribe, e-mail: dev-unsubscr...@to

svn commit: r1199139 - in /tomcat/tc6.0.x/trunk: STATUS.txt java/org/apache/catalina/valves/LocalStrings.properties java/org/apache/catalina/valves/RequestFilterValve.java webapps/docs/changelog.xml

2011-11-07 Thread kkolinko
Author: kkolinko
Date: Tue Nov  8 07:43:58 2011
New Revision: 1199139

URL: http://svn.apache.org/viewvc?rev=1199139&view=rev
Log:
Make configuration issue for RemoteAddrValve, RemoteHostValve result
in the failure of the valve rather than just a warning message.
Ensure changes to the configuration of these valves via JMX are thread-safe.

Modified:
tomcat/tc6.0.x/trunk/STATUS.txt
tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/LocalStrings.properties
tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/RequestFilterValve.java
tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1199139&r1=1199138&r2=1199139&view=diff
==
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Tue Nov  8 07:43:58 2011
@@ -64,15 +64,6 @@ PATCHES PROPOSED TO BACKPORT:
   - getStuckThreadIds() returns a list of ids. It might be useful to
 have a similar method that returns Thread.getName() names.
 
-* Make configuration issue for RemoteAddrValve, RemoteHostValve result
-  in the failure of the valve rather than just a warning message.
-  Ensure changes to the configuration of the RemoteHostValve and the
-  RemoteIpValve via JMX are thread-safe.
-  
http://people.apache.org/~kkolinko/patches/2011-10-26_tc6_RequestFilterValve_v3.patch
-  It is based on valves part of r1189256 and r1187027. (r1189258, r1187029 in 
TC7)
-  +1: kkolinko, kfujino, markt
-  -1:
-
 * Improve performance of parameter processing.
   http://people.apache.org/~markt/patches/2011-10-29-param-perf-tc6-v2.patch
   http://svn.apache.org/viewvc?rev=1195222&view=rev - performance tweaks

Modified: 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/LocalStrings.properties?rev=1199139&r1=1199138&r2=1199139&view=diff
==
--- 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/LocalStrings.properties 
(original)
+++ 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/LocalStrings.properties 
Tue Nov  8 07:43:58 2011
@@ -19,14 +19,17 @@ certificatesValve.alreadyStarted=Certifi
 certificatesValve.notStarted=Certificates Valve has not yet been started
 interceptorValve.alreadyStarted=Interceptor Valve has already been started
 interceptorValve.notStarted=Interceptor Valve has not yet been started
-requestFilterValve.next=No ''next'' valve has been configured
-requestFilterValve.syntax=Syntax error in request filter pattern {0}
 valveBase.noNext=Configuration error: No ''next'' valve configured
 jdbcAccessLogValve.exception=Exception performing insert access entry
 jdbcAccessLogValve.close=Exception closing database connection
 cometConnectionManagerValve.event=Exception processing event
 cometConnectionManagerValve.listenerEvent=Exception processing session 
listener event
 
+# Request filter valve - RemoteAddrValve, RemoteHostValve
+requestFilterValve.alreadyStarted=Valve has already been started
+requestFilterValve.syntax=Syntax error in request filter pattern {0}
+requestFilterValve.configInvalid=One or more invalid configuration settings 
were provided for the Remote[Addr|Host]Valve. The valve will deny all requests.
+
 # Access log valve
 accessLogValve.alreadyStarted=Access Logger has already been started
 accessLogValve.notStarted=Access Logger has not yet been started

Modified: 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/RequestFilterValve.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/RequestFilterValve.java?rev=1199139&r1=1199138&r2=1199139&view=diff
==
--- 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/RequestFilterValve.java 
(original)
+++ 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/RequestFilterValve.java 
Tue Nov  8 07:43:58 2011
@@ -27,8 +27,12 @@ import java.util.regex.PatternSyntaxExce
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.catalina.Lifecycle;
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.LifecycleListener;
 import org.apache.catalina.connector.Request;
 import org.apache.catalina.connector.Response;
+import org.apache.catalina.util.LifecycleSupport;
 import org.apache.catalina.util.StringManager;
 
 /**
@@ -66,7 +70,7 @@ import org.apache.catalina.util.StringMa
  */
 
 public abstract class RequestFilterValve
-extends ValveBase {
+extends ValveBase implements Lifecycle {
 
 
 // - Class Variables
@@ -92,26 +96,51 @@ public abstract class RequestFilterValve
 /**
  * The comma-delimited set of allow expre

svn commit: r1199142 - /tomcat/tc5.5.x/trunk/STATUS.txt

2011-11-07 Thread kkolinko
Author: kkolinko
Date: Tue Nov  8 07:51:38 2011
New Revision: 1199142

URL: http://svn.apache.org/viewvc?rev=1199142&view=rev
Log:
Remove veto because the patch was updated, add note

Modified:
tomcat/tc5.5.x/trunk/STATUS.txt

Modified: tomcat/tc5.5.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/STATUS.txt?rev=1199142&r1=1199141&r2=1199142&view=diff
==
--- tomcat/tc5.5.x/trunk/STATUS.txt (original)
+++ tomcat/tc5.5.x/trunk/STATUS.txt Tue Nov  8 07:51:38 2011
@@ -55,55 +55,5 @@ PATCHES PROPOSED TO BACKPORT:
   http://people.apache.org/~markt/patches/2011-10-29-param-perf-tc5-v2.patch
   http://svn.apache.org/viewvc?rev=1195222&view=rev - performance tweaks
   +1: markt
-  -1: kkolinko: because of ByteChunk#toStringInternal(), see below.
-markt - updated proposal above addresses all review comments
-detailed response on dev list
-
-  kkolinko: In B2CConverter.java
-lines 117-118: restore Javadoc comment to method void convert( ByteChunk 
bb, CharChunk cb, int limit) 
-line 125 - remove "// conv.ready() ) {" comment. It wasn't in 5.5. Do not 
see why to add it.
-   In ByteChunk.java:
-in toStringInternal():
-  "cb.array()" returns "character array that backs this CharBuffer".
-  I think it can contain extra characters beyond end of decoded string.
-  Thus "new String(cb.array());" is wrong.
-  Single-character charsets are simple, because the count of characters
-  is known from the count of bytes. Needs more testing with UTF-8.
-  - thus -1.
-   In Parameters.java:
-"private static org.apache.commons.logging.Log log"
-  - make "static final"
-"StringManager.getManager("org.apache.tomcat.util.http");"
-  - the LocalStrings.properties file from r1189882 is not included in this 
patch.
-(2011-10-27-param-perf-tc6-v1.patch does not have it as well)
-"private final Hashtable paramHashValues"
-  - Maybe a HashMap can be used instead. I do not expect much improvements
-from that though.
-in #addParameterValues(..)
-  - Replace "values = new ArrayList(1);"
-with"values = new ArrayList(newValues.length);"
-  - Maybe "if (paramHashValues.containsKey(key))" can be replaced
-with testing whether result of (paramHashValues.containsKey(key)) is 
null.
-  - Maybe add tests for this method. In trunk it is called by 
Request.parseParts(), though see below maybe that can be changed.
-in #getParameterValues(String name)
-  - Apply NPE fix from http://svn.apache.org/viewvc?rev=1190481&view=rev
-  - Maybe add test case in TestParameters.java for calling 
getParameterValues() for non-existing parameter.
-in #addParam(String, String)
-  - remove efficiency comment above the method?
-  - In trunk: maybe make this method public and call it instead of 
#addParameterValues(..)
- in Request.parseParts().
-  - Maybe "if (paramHashValues.containsKey(key))" can be replaced
-with testing whether result of (paramHashValues.containsKey(key)) is 
null.
-"public static final String DEFAULT_ENCODING"
-"public static final Charset DEFAULT_CHARSET"
-  - New fields. They can be made private.
-in #processParameters(..., Charset)
-  - It is a new method. Maybe make it private.
-  - If it remains public, maybe document that charset parameter is not 
null.
-All callers here call Parameters.getCharset(encoding) which returns 
DEFAULT_CHARSET by default.
-in #urlDecode(...)
-  - Maybe call "bc.setCharset(charset);" before calling 
"urlDec.convert(bc);"
-in #paramsAsString()
-  - Move sb.append("\n"); outside of loop that iterates on values. Those 
are separated by ','.
-In the old code the "\n" is used to separate different parameter names.
-  - Replace double quotes with single quotes where it is a single 
character ('=', ',', '\n')
+  -1:
+kkolinko: +r1195943,r1198641 are needed, and maybe (r1195531+r1195905, 
r1195949, r1198696)



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org