Re: svn commit: r1359342 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/catalina/connector/Response.java test/org/apache/catalina/connector/TestResponse.java webapps/docs/changelog.xml

2012-07-10 Thread Konstantin Kolinko
2012/7/9  :
> Author: markt
> Date: Mon Jul  9 19:11:54 2012
> New Revision: 1359342
>
> URL: http://svn.apache.org/viewvc?rev=1359342&view=rev
> Log:
> Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53062
> Correctly handle case where redirect URL includes a query string (with test 
> cases)
>
> Modified:
> tomcat/tc7.0.x/trunk/   (props changed)
> tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/Response.java
> tomcat/tc7.0.x/trunk/test/org/apache/catalina/connector/TestResponse.java
> tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
>
> Propchange: tomcat/tc7.0.x/trunk/
> --
>   Merged /tomcat/trunk:r1359340
>
> Modified: 
> tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/Response.java
> URL: 
> http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/Response.java?rev=1359342&r1=1359341&r2=1359342&view=diff
> ==
> --- tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/Response.java 
> (original)
> +++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/Response.java Mon 
> Jul  9 19:11:54 2012
> @@ -1752,6 +1752,18 @@ public class Response
>   * Code borrowed heavily from CoyoteAdapter.normalize()
>   */
>  private void normalize(CharChunk cc) {
> +// Strip query string first (doing it this way makes the logic a lot
> +// simpler)
> +int query = cc.indexOf('?');

Maybe it needs process anchors if query is absent. Something like this:
if (query < 0) {
query = cc.indexOf('#');
}

> +char[] queryCC = null;
> +if (query > -1) {
> +queryCC = new char[cc.getEnd() - query];

java.util.Arrays.copyOfRange(char[],int from,int to) ?

> +for (int i = query; i < cc.getEnd(); i++) {
> +queryCC[i - query] = cc.charAt(i);
> +}
> +cc.setEnd(query);
> +}
> +
>  if (cc.endsWith("/.") || cc.endsWith("/..")) {
>  try {
>  cc.append('/');
> @@ -1810,6 +1822,15 @@ public class Response
>  cc.setEnd(end);
>  index = index2;
>  }
> +
> +// Add the query string (if present) back in
> +if (queryCC != null) {
> +try {
> +cc.append(queryCC, 0, queryCC.length);
> +} catch (IOException ioe) {
> +throw new IllegalArgumentException(ioe);
> +}
> +}
>  }
>
>  private void copyChars(char[] c, int dest, int src, int len) {
>

Best regards,
Konstantin Kolinko

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



[Bug 53529] New: Call interrupt() after InterruptedException instead interrupted()

2012-07-10 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=53529

  Priority: P2
Bug ID: 53529
  Assignee: dev@tomcat.apache.org
   Summary: Call interrupt() after InterruptedException instead
interrupted()
  Severity: normal
Classification: Unclassified
  Reporter: frederic.arn...@gmail.com
  Hardware: PC
Status: NEW
   Version: unspecified
 Component: Catalina
   Product: Tomcat 7

In class:

org\apache\catalina\tribes\group\GroupChannel.java
line 692
org\apache\catalina\tribes\group\interceptors\NonBlockingCoordinator.java
line 228
org\apache\catalina\tribes\group\interceptors\TcpPingInterceptor.java
line 173
org\apache\catalina\tribes\membership\McastServiceImpl.java
line 542
org\apache\juli\AsyncFileHandler.java
line 124
line 146
org\apache\tomcat\util\net\AprEndpoint.java
line 640
org\apache\tomcat\util\net\NioBlockingSelector.java
line 112
line 177
org\apache\tomcat\util\threads\ThreadPoolExecutor.java
line 187


Affect 7.0.29 (and previous release) but affect also Tomcat 6.

-- 
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 53529] Call interrupt() after InterruptedException instead interrupted()

2012-07-10 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=53529

F.Arnoud  changed:

   What|Removed |Added

 CC||frederic.arn...@gmail.com
 OS||All

-- 
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: r1359693 - /tomcat/maven-plugin/trunk/src/site/site.xml

2012-07-10 Thread olamy
Author: olamy
Date: Tue Jul 10 14:16:12 2012
New Revision: 1359693

URL: http://svn.apache.org/viewvc?rev=1359693&view=rev
Log:
use last fluido skin version

Modified:
tomcat/maven-plugin/trunk/src/site/site.xml

Modified: tomcat/maven-plugin/trunk/src/site/site.xml
URL: 
http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/src/site/site.xml?rev=1359693&r1=1359692&r2=1359693&view=diff
==
--- tomcat/maven-plugin/trunk/src/site/site.xml (original)
+++ tomcat/maven-plugin/trunk/src/site/site.xml Tue Jul 10 14:16:12 2012
@@ -30,7 +30,7 @@
   
 org.apache.maven.skins
 maven-fluido-skin
-1.2.1
+1.2.2
   
   
   



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



svn commit: r1359705 - /tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java

2012-07-10 Thread fhanik
Author: fhanik
Date: Tue Jul 10 14:47:07 2012
New Revision: 1359705

URL: http://svn.apache.org/viewvc?rev=1359705&view=rev
Log:
https://issues.apache.org/bugzilla/show_bug.cgi?id=53526
Use proper comparison of objects

Modified:

tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java

Modified: 
tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=1359705&r1=1359704&r2=1359705&view=diff
==
--- 
tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
 (original)
+++ 
tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
 Tue Jul 10 14:47:07 2012
@@ -834,7 +834,7 @@ public class ConnectionPool {
  */
 protected boolean terminateTransaction(PooledConnection con) {
 try {
-if (con.getPoolProperties().getDefaultAutoCommit()==Boolean.FALSE) 
{
+if 
(Boolean.FALSE.equals(con.getPoolProperties().getDefaultAutoCommit())) {
 if (this.getPoolProperties().getRollbackOnReturn()) {
 boolean autocommit = con.getConnection().getAutoCommit();
 if (!autocommit) con.getConnection().rollback();



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



[Bug 53526] .ConnectionPool.terminateTransaction unsafe == check of Boolean

2012-07-10 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=53526

Filip Hanik  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #1 from Filip Hanik  ---
Fixed in r1359705

-- 
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 37455] https/sll hangs with tcnative-1.dll

2012-07-10 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=37455

--- Comment #11 from Tgutierrez017  ---
Hi
After read the http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html, it said
that the implementation used by tomcat is chosen automatically and it depends
if you have installed the native library tcnative-1.dll. 
if you not want remove the tcnative-1.dll you have to modify the protocol in
your connector



-- 
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: r1359742 - /tomcat/tc5.5.x/trunk/STATUS.txt

2012-07-10 Thread jim
Author: jim
Date: Tue Jul 10 16:04:37 2012
New Revision: 1359742

URL: http://svn.apache.org/viewvc?rev=1359742&view=rev
Log:
Votes

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=1359742&r1=1359741&r2=1359742&view=diff
==
--- tomcat/tc5.5.x/trunk/STATUS.txt (original)
+++ tomcat/tc5.5.x/trunk/STATUS.txt Tue Jul 10 16:04:37 2012
@@ -42,7 +42,7 @@ PATCHES PROPOSED TO BACKPORT:
   recycled.
   http://svn.apache.org/viewvc?rev=1342795&view=rev
   (r1342797 in Tomcat 7)
-  +1: kkolinko, schultz
+  +1: kkolinko, schultz, jim
   -1:
 
 * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53050
@@ -50,7 +50,7 @@ PATCHES PROPOSED TO BACKPORT:
   initialize random numbers generator in session manager. Based on
   proposal by Andras Rozsa.
   https://issues.apache.org/bugzilla/attachment.cgi?id=28895
-  +1: kkolinko, schultz
+  +1: kkolinko, schultz, jim
   -1:
 
 * Implement maxHeaderCount attribute on HTTP Connectors.



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



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

2012-07-10 Thread jim
Author: jim
Date: Tue Jul 10 16:05:44 2012
New Revision: 1359743

URL: http://svn.apache.org/viewvc?rev=1359743&view=rev
Log:
promote

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=1359743&r1=1359742&r2=1359743&view=diff
==
--- tomcat/tc5.5.x/trunk/STATUS.txt (original)
+++ tomcat/tc5.5.x/trunk/STATUS.txt Tue Jul 10 16:05:44 2012
@@ -24,19 +24,6 @@ $Id$
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK/OTHER:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-
-PATCHES PROPOSED TO BACKPORT:
-  [ New proposals should be added at the end of the list ]
-
-* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=52579
-  Propose new implementation of ByteChunk.toStringInternal().
-  This fix does not reintroduce issue BZ51400.
-  This fix avoids http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6196991.
-  https://issues.apache.org/bugzilla/attachment.cgi?id=28274 (remove generics )
-  +1: kfujino
-  -0: markt (see https://issues.apache.org/bugzilla/show_bug.cgi?id=52579#c8) 
-  -1:
-
 * https://issues.apache.org/bugzilla/show_bug.cgi?id=52055#c14
   Correctly reset ChunkedInputFilter.needCRLFParse flag when the filter is
   recycled.
@@ -53,6 +40,18 @@ PATCHES PROPOSED TO BACKPORT:
   +1: kkolinko, schultz, jim
   -1:
 
+PATCHES PROPOSED TO BACKPORT:
+  [ New proposals should be added at the end of the list ]
+
+* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=52579
+  Propose new implementation of ByteChunk.toStringInternal().
+  This fix does not reintroduce issue BZ51400.
+  This fix avoids http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6196991.
+  https://issues.apache.org/bugzilla/attachment.cgi?id=28274 (remove generics )
+  +1: kfujino
+  -0: markt (see https://issues.apache.org/bugzilla/show_bug.cgi?id=52579#c8) 
+  -1:
+
 * Implement maxHeaderCount attribute on HTTP Connectors.
   It is equivalent of LimitRequestFields directive of Apache HTTPD
   See r1356239 in Tomcat 6.



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



svn commit: r1359748 - in /tomcat/tc5.5.x/trunk: STATUS.txt connectors/http11/src/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java

2012-07-10 Thread jim
Author: jim
Date: Tue Jul 10 16:10:58 2012
New Revision: 1359748

URL: http://svn.apache.org/viewvc?rev=1359748&view=rev
Log:
Reset needCRLFParse for recycling ChunkedInputFilter

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

tomcat/tc5.5.x/trunk/connectors/http11/src/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java

Modified: tomcat/tc5.5.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/STATUS.txt?rev=1359748&r1=1359747&r2=1359748&view=diff
==
--- tomcat/tc5.5.x/trunk/STATUS.txt (original)
+++ tomcat/tc5.5.x/trunk/STATUS.txt Tue Jul 10 16:10:58 2012
@@ -24,14 +24,6 @@ $Id$
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK/OTHER:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-* https://issues.apache.org/bugzilla/show_bug.cgi?id=52055#c14
-  Correctly reset ChunkedInputFilter.needCRLFParse flag when the filter is
-  recycled.
-  http://svn.apache.org/viewvc?rev=1342795&view=rev
-  (r1342797 in Tomcat 7)
-  +1: kkolinko, schultz, jim
-  -1:
-
 * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53050
   Fix XOR arithmetics and charset issue when calculating entropy to
   initialize random numbers generator in session manager. Based on

Modified: 
tomcat/tc5.5.x/trunk/connectors/http11/src/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/connectors/http11/src/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java?rev=1359748&r1=1359747&r2=1359748&view=diff
==
--- 
tomcat/tc5.5.x/trunk/connectors/http11/src/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java
 (original)
+++ 
tomcat/tc5.5.x/trunk/connectors/http11/src/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java
 Tue Jul 10 16:10:58 2012
@@ -202,6 +202,7 @@ public class ChunkedInputFilter implemen
 pos = 0;
 lastValid = 0;
 endChunk = false;
+needCRLFParse = false;
 }
 
 



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



svn commit: r1359751 - in /tomcat/tc5.5.x/trunk: STATUS.txt container/catalina/src/share/org/apache/catalina/session/ManagerBase.java

2012-07-10 Thread jim
Author: jim
Date: Tue Jul 10 16:12:46 2012
New Revision: 1359751

URL: http://svn.apache.org/viewvc?rev=1359751&view=rev
Log:
* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53050
  Fix XOR arithmetics and charset issue when calculating entropy to
  initialize random numbers generator in session manager. Based on
  proposal by Andras Rozsa.
  https://issues.apache.org/bugzilla/attachment.cgi?id=28895
  +1: kkolinko, schultz, jim
  -1:


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

tomcat/tc5.5.x/trunk/container/catalina/src/share/org/apache/catalina/session/ManagerBase.java

Modified: tomcat/tc5.5.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/STATUS.txt?rev=1359751&r1=1359750&r2=1359751&view=diff
==
--- tomcat/tc5.5.x/trunk/STATUS.txt (original)
+++ tomcat/tc5.5.x/trunk/STATUS.txt Tue Jul 10 16:12:46 2012
@@ -24,13 +24,6 @@ $Id$
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK/OTHER:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53050
-  Fix XOR arithmetics and charset issue when calculating entropy to
-  initialize random numbers generator in session manager. Based on
-  proposal by Andras Rozsa.
-  https://issues.apache.org/bugzilla/attachment.cgi?id=28895
-  +1: kkolinko, schultz, jim
-  -1:
 
 PATCHES PROPOSED TO BACKPORT:
   [ New proposals should be added at the end of the list ]

Modified: 
tomcat/tc5.5.x/trunk/container/catalina/src/share/org/apache/catalina/session/ManagerBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/container/catalina/src/share/org/apache/catalina/session/ManagerBase.java?rev=1359751&r1=1359750&r2=1359751&view=diff
==
--- 
tomcat/tc5.5.x/trunk/container/catalina/src/share/org/apache/catalina/session/ManagerBase.java
 (original)
+++ 
tomcat/tc5.5.x/trunk/container/catalina/src/share/org/apache/catalina/session/ManagerBase.java
 Tue Jul 10 16:12:46 2012
@@ -25,6 +25,7 @@ import java.io.DataInputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
+import java.io.UnsupportedEncodingException;
 import java.lang.reflect.Method;
 import java.security.AccessController;
 import java.security.MessageDigest;
@@ -396,7 +397,12 @@ public abstract class ManagerBase implem
 // Ignore
 }
 if (apr) {
-setEntropy(new String(result));
+try {
+setEntropy(new String(result, "ISO-8859-1"));
+} catch (UnsupportedEncodingException ux) {
+// ISO-8859-1 should always be supported
+throw new Error(ux);
+}
 } else {
 setEntropy(this.toString());
 }
@@ -561,7 +567,7 @@ public abstract class ManagerBase implem
 long t1 = seed;
 char entropy[] = getEntropy().toCharArray();
 for (int i = 0; i < entropy.length; i++) {
-long update = ((byte) entropy[i]) << ((i % 8) * 8);
+long update = ((long) entropy[i]) << ((i % 8) * 8);
 seed ^= update;
 }
 try {



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



RE: Unit tests and trunk

2012-07-10 Thread Filip Hanik (mailing lists)
Ok, definitely a bug in Java 7/Windows 7.
If I turn on ProcMon from sysinternals to try to figure out what is going
on, the test succeeds everytime. Shutdown procmon, and it hangs again. The
Selector is not registering the OP_WRITE event

Filip


> -Original Message-
> From: Filip Hanik (mailing lists) [mailto:devli...@hanik.com]
> Sent: Monday, July 09, 2012 2:31 PM
> To: 'Tomcat Developers List'
> Subject: RE: Unit tests and trunk
> 
> This failure happens when the write blocks, and we enter the Selector
> for a
> write operation.
> 
> filip
> 
> > -Original Message-
> > From: Filip Hanik (mailing lists) [mailto:devli...@hanik.com]
> > Sent: Monday, July 09, 2012 2:23 PM
> > To: 'Tomcat Developers List'
> > Subject: RE: Unit tests and trunk
> >
> > I'm on Windows 7 and see TestOutputBuffer fail inconsistently with
> Java
> > 7
> > Most runs are failures.
> >
> > I'll be looking into this this week
> >
> > > -Original Message-
> > > From: Mark Thomas [mailto:ma...@apache.org]
> > > Sent: Monday, July 09, 2012 4:33 AM
> > > To: Tomcat Developers List
> > > Subject: Unit tests and trunk
> > >
> > > With the fixes over the weekend for setting traffic class, I now see
> > the
> > > unit tests passing consistently for:
> > >
> > > Windows: BIO, NIO, APR
> > > Linux: BIO, NIO
> > >
> > > I do see a consistent failure for Linux and APR with the Comet
> tests.
> > It
> > > is the connector stop test failing (the one that was failing in
> > buildbot
> > > previously with NIO). I'll take a look at this today.
> > >
> > > Mark
> > >
> > > 
> -
> > > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> > > For additional commands, e-mail: dev-h...@tomcat.apache.org
> >
> >
> >
> > -
> > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> > For additional commands, e-mail: dev-h...@tomcat.apache.org
> 
> 
> 
> -
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org



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



tomcat bad encoding

2012-07-10 Thread Thushara Wijeratna
Is it possible to have tomcat treat bad URI encodings leniently? It
currently modifies a buffer in place and if a % sign is followed by
anything other than 2 hexadecimal characters, it gives up decoding and
throws an exception. But if this method was changed to a lenient decoding,
then the buffer would not be corrupt and can be returned to caller.

We get bad encodings due to various truncation issues so it is very helpful
if we can get a lenient decoding.

Please let me know if this is something that could be looked at. I'd
volunteer dev / test time to get this in the code.

thx,
thushara


Re: svn commit: r1359342 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/catalina/connector/Response.java test/org/apache/catalina/connector/TestResponse.java webapps/docs/changelog.xml

2012-07-10 Thread Mark Thomas
On 10/07/2012 10:59, Konstantin Kolinko wrote:
> 2012/7/9  :
>> Author: markt
>> Date: Mon Jul  9 19:11:54 2012
>> New Revision: 1359342
>>
>> URL: http://svn.apache.org/viewvc?rev=1359342&view=rev
>> Log:
>> Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53062
>> Correctly handle case where redirect URL includes a query string (with test 
>> cases)
>>
>> Modified:
>> tomcat/tc7.0.x/trunk/   (props changed)
>> tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/Response.java
>> tomcat/tc7.0.x/trunk/test/org/apache/catalina/connector/TestResponse.java
>> tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
>>
>> Propchange: tomcat/tc7.0.x/trunk/
>> --
>>   Merged /tomcat/trunk:r1359340
>>
>> Modified: 
>> tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/Response.java
>> URL: 
>> http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/Response.java?rev=1359342&r1=1359341&r2=1359342&view=diff
>> ==
>> --- tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/Response.java 
>> (original)
>> +++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/Response.java 
>> Mon Jul  9 19:11:54 2012
>> @@ -1752,6 +1752,18 @@ public class Response
>>   * Code borrowed heavily from CoyoteAdapter.normalize()
>>   */
>>  private void normalize(CharChunk cc) {
>> +// Strip query string first (doing it this way makes the logic a lot
>> +// simpler)
>> +int query = cc.indexOf('?');
> 
> Maybe it needs process anchors if query is absent. Something like this:
> if (query < 0) {
> query = cc.indexOf('#');
> }

Agreed. I'll add some more unit tests to confirm and update as necessary.

> 
>> +char[] queryCC = null;
>> +if (query > -1) {
>> +queryCC = new char[cc.getEnd() - query];
> 
> java.util.Arrays.copyOfRange(char[],int from,int to) ?

Yep.

Cheers,

Mark

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



Re: tomcat bad encoding

2012-07-10 Thread Julian Reschke

On 2012-07-10 19:03, Thushara Wijeratna wrote:

Is it possible to have tomcat treat bad URI encodings leniently? It
currently modifies a buffer in place and if a % sign is followed by
anything other than 2 hexadecimal characters, it gives up decoding and
throws an exception. But if this method was changed to a lenient decoding,
then the buffer would not be corrupt and can be returned to caller.

We get bad encodings due to various truncation issues so it is very helpful
if we can get a lenient decoding.

> ...

Well, I like "fail early". Wouldn't it be better to fix the truncation 
issues instead?


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



RE: Unit tests and trunk

2012-07-10 Thread Filip Hanik (mailing lists)
Here's what I've found out so far

The patch below does solve the problem. In a rather remarkable way. 
The line
int cnt = socket.write(buf); //write the data

never returns 0, meaning the writes are always blocking. Even though they
are not supposed to be.
Remove this patch, and socket.write(buf) returns 0, and then we never get
issued the OP_WRITE from the selector itself.

Index: java/org/apache/tomcat/util/net/NioBlockingSelector.java
===
--- java/org/apache/tomcat/util/net/NioBlockingSelector.java(revision
1359329)
+++ java/org/apache/tomcat/util/net/NioBlockingSelector.java(working
copy)
@@ -89,6 +89,12 @@
 int keycount = 1; //assume we can write
 long time = System.currentTimeMillis(); //start the timeout timer
 try {
+
+synchronized (Selector.class) {
+Selector s = Selector.open();
+s.close();
+}
+
 while ( (!timedout) && buf.hasRemaining()) {
 if (keycount > 0) { //only write if we were registered for
a write
 int cnt = socket.write(buf); //write the data

> -Original Message-
> From: Filip Hanik (mailing lists) [mailto:devli...@hanik.com]
> Sent: Tuesday, July 10, 2012 10:43 AM
> To: 'Tomcat Developers List'
> Subject: RE: Unit tests and trunk
> 
> Ok, definitely a bug in Java 7/Windows 7.
> If I turn on ProcMon from sysinternals to try to figure out what is
> going
> on, the test succeeds everytime. Shutdown procmon, and it hangs again.
> The
> Selector is not registering the OP_WRITE event
> 
> Filip
> 
> 
> > -Original Message-
> > From: Filip Hanik (mailing lists) [mailto:devli...@hanik.com]
> > Sent: Monday, July 09, 2012 2:31 PM
> > To: 'Tomcat Developers List'
> > Subject: RE: Unit tests and trunk
> >
> > This failure happens when the write blocks, and we enter the Selector
> > for a
> > write operation.
> >
> > filip
> >
> > > -Original Message-
> > > From: Filip Hanik (mailing lists) [mailto:devli...@hanik.com]
> > > Sent: Monday, July 09, 2012 2:23 PM
> > > To: 'Tomcat Developers List'
> > > Subject: RE: Unit tests and trunk
> > >
> > > I'm on Windows 7 and see TestOutputBuffer fail inconsistently with
> > Java
> > > 7
> > > Most runs are failures.
> > >
> > > I'll be looking into this this week
> > >
> > > > -Original Message-
> > > > From: Mark Thomas [mailto:ma...@apache.org]
> > > > Sent: Monday, July 09, 2012 4:33 AM
> > > > To: Tomcat Developers List
> > > > Subject: Unit tests and trunk
> > > >
> > > > With the fixes over the weekend for setting traffic class, I now
> see
> > > the
> > > > unit tests passing consistently for:
> > > >
> > > > Windows: BIO, NIO, APR
> > > > Linux: BIO, NIO
> > > >
> > > > I do see a consistent failure for Linux and APR with the Comet
> > tests.
> > > It
> > > > is the connector stop test failing (the one that was failing in
> > > buildbot
> > > > previously with NIO). I'll take a look at this today.
> > > >
> > > > Mark
> > > >
> > > > --
> --
> > -
> > > > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> > > > For additional commands, e-mail: dev-h...@tomcat.apache.org
> > >
> > >
> > >
> > > 
> -
> > > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> > > For additional commands, e-mail: dev-h...@tomcat.apache.org
> >
> >
> >
> > -
> > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> > For additional commands, e-mail: dev-h...@tomcat.apache.org
> 
> 
> 
> -
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org



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



[Bug 53531] New: ExpandWar.expand does not check the return value of File.mkdirs

2012-07-10 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=53531

  Priority: P2
Bug ID: 53531
  Assignee: dev@tomcat.apache.org
   Summary: ExpandWar.expand does not check the return value of
File.mkdirs
  Severity: trivial
Classification: Unclassified
OS: All
  Reporter: ch...@christopherschultz.net
  Hardware: All
Status: NEW
   Version: 5.5.35
 Component: Catalina
   Product: Tomcat 5

http://markmail.org/message/fvyxksx7muk3icr4

o.a.c.startup.ExpandWar.expand() calls File.mkdirs on line 165 and does not
check the return value. If the call fails, a subsequent attempt to create a new
FileOutputStream for a file in the (failed-to-create) directory results in a
FileNotFoundException with the whole filename as the message. Here is an
example from the above tomcat-user original post:

SEVERE: Exception fixing docBase: {0}
java.io.FileNotFoundException:
/home/surgnet/public_html/sample/META-INF/MANIFEST.MF (No such file or
directory)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.(FileOutputStream.java:194)
at java.io.FileOutputStream.(FileOutputStream.java:145)
at org.apache.catalina.startup.ExpandWar.expand(ExpandWar.java:457)
at org.apache.catalina.startup.ExpandWar.expand(ExpandWar.java:173)

This is confusing to users because the real issue has been hidden: the
inability to create the parent directory for the file.

The analogous code in the current trunk is:

if (!parent.mkdirs() && !parent.isDirectory()) {
throw new IOException(
sm.getString("expandWar.createFailed",
parent));
}

I believe this is the correct approach, which should be adopted for Tomcat 5.5.

-- 
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 53531] ExpandWar.expand does not check the return value of File.mkdirs

2012-07-10 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=53531

--- Comment #1 from Christopher Schultz  ---
Created attachment 29045
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=29045&action=edit
Patch against current trunk (r1359975)

-- 
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: r1359978 - /tomcat/tc5.5.x/trunk/STATUS.txt

2012-07-10 Thread schultz
Author: schultz
Date: Wed Jul 11 01:51:31 2012
New Revision: 1359978

URL: http://svn.apache.org/viewvc?rev=1359978&view=rev
Log:
Proposal

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=1359978&r1=1359977&r2=1359978&view=diff
==
--- tomcat/tc5.5.x/trunk/STATUS.txt (original)
+++ tomcat/tc5.5.x/trunk/STATUS.txt Wed Jul 11 01:51:31 2012
@@ -66,3 +66,11 @@ PATCHES PROPOSED TO BACKPORT:
   
http://people.apache.org/~kkolinko/patches/2012-07-03_tc55_maxHeaderCount_v1.patch
   +1: kkolinko
   -1:
+
+* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53531
+  ExpandWar.expand does not check the return value of File.mkdirs.
+  Note that this is not a backport -- it's just a fix for 5.5.x.
+  Patch is attached to BZ ticket.
+  +1: schultz
+  -1:
+



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



svn commit: r1359981 - /tomcat/trunk/java/org/apache/catalina/startup/ExpandWar.java

2012-07-10 Thread schultz
Author: schultz
Date: Wed Jul 11 01:55:00 2012
New Revision: 1359981

URL: http://svn.apache.org/viewvc?rev=1359981&view=rev
Log:
Added check of return value for docBase.mkdir.

Modified:
tomcat/trunk/java/org/apache/catalina/startup/ExpandWar.java

Modified: tomcat/trunk/java/org/apache/catalina/startup/ExpandWar.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ExpandWar.java?rev=1359981&r1=1359980&r2=1359981&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/startup/ExpandWar.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/ExpandWar.java Wed Jul 11 
01:55:00 2012
@@ -84,7 +84,8 @@ public class ExpandWar {
 }
 
 // Create the new document base directory
-docBase.mkdir();
+if(!docBase.mkdir() && !docBase.isDirectory())
+throw new IOException(sm.getString("expandWar.createFailed", 
docBase));
 
 // Expand the WAR into the new document base directory
 String canonicalDocBasePrefix = docBase.getCanonicalPath();



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



svn commit: r1359986 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/catalina/startup/ExpandWar.java

2012-07-10 Thread schultz
Author: schultz
Date: Wed Jul 11 01:59:54 2012
New Revision: 1359986

URL: http://svn.apache.org/viewvc?rev=1359986&view=rev
Log:
Back-port of change to ExpandWar.expand to check return value of docBase.mkdir.

Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ExpandWar.java

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1359981

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ExpandWar.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ExpandWar.java?rev=1359986&r1=1359985&r2=1359986&view=diff
==
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ExpandWar.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ExpandWar.java Wed 
Jul 11 01:59:54 2012
@@ -96,7 +96,8 @@ public class ExpandWar {
 }
 
 // Create the new document base directory
-docBase.mkdir();
+if(!docBase.mkdir() && !docBase.isDirectory())
+throw new IOException(sm.getString("expandWar.createFailed", 
docBase));
 
 // Expand the WAR into the new document base directory
 String canonicalDocBasePrefix = docBase.getCanonicalPath();



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



[Bug 53531] ExpandWar.expand does not check the return value of File.mkdirs

2012-07-10 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=53531

--- Comment #2 from Christopher Schultz  ---
This bug exists in Tomcat 6.0.x, so I'm re-assigning since it's a bit more
relevant. The fix can be thought of as a back-port, then, I guess.

-- 
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 53531] ExpandWar.expand does not check the return value of File.mkdirs

2012-07-10 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=53531

Christopher Schultz  changed:

   What|Removed |Added

  Component|Catalina|Catalina
Version|5.5.35  |6.0.35
Product|Tomcat 5|Tomcat 6
   Target Milestone|--- |default

-- 
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