[Bug 60013] New: Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve

2016-08-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013

Bug ID: 60013
   Summary: Non-ASCII characters in querystring get mangled after
URL Rewrite using RewriteValve
   Product: Tomcat 8
   Version: 8.0.35
  Hardware: PC
OS: Mac OS X 10.1
Status: NEW
  Severity: major
  Priority: P2
 Component: Catalina
  Assignee: dev@tomcat.apache.org
  Reporter: santhanapreeth...@gmail.com

I have RewriteValve configured for the ROOT context which is the only context
in my deployment setup. 

I have many RewriteRules like 

RewriteRule ^/abc/(.*)$ /xyz.do?param=$1 [L]

where a part of the URL gets rewritten as querystring 

when I access the URL with non-ASCII characters like
http://www.example.com/abc/在线测试

The page does not load. Checking the rewrite and access logs I found 

Rewrite Log

Rewrote /abc/在线测试 as /xyz.do?param=在线测试 with rule pattern ^/abc/(.*)$

Access log

/xyz.do?param=

This issue only happens when a part of the URL gets rewritten as the
querystring. Checking the source code of the RewriteValve 

chunk.append(URLEncoder.DEFAULT.encode(urlString));

I found the querystring is not encoded. Is this the cause of the problem?

-- 
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 60014] New: Nio2 Connector with SLL (OpenSSL) truncates post data

2016-08-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=60014

Bug ID: 60014
   Summary: Nio2 Connector with SLL (OpenSSL) truncates post data
   Product: Tomcat 8
   Version: 8.5.4
  Hardware: PC
OS: Linux
Status: NEW
  Severity: major
  Priority: P2
 Component: Connectors
  Assignee: dev@tomcat.apache.org
  Reporter: a.vett...@b2bires.com

Hello,
here's the environment :

Linux 3.10.0-327.el7.x86_64 #1 SMP

Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

Tomcat 8.5.4




Problem: Our web app is an e-commerce web site, it uses various technologies
and frameworks. A few days ago we upgraded to tomcat 8.5.4 and java 8 from
tomcat 7.x and java 7. We noticed that a certain form was not working correctly
all of times (sometimes it worked, sometimes not). A large number of users had
the issue, with various browsers and operating system on the client side.
Debugging the issue I found that in some cases, not all form data arrives at
the MVC framework. It seems truncated at some point. Looking at the post data
with browser web tools I can see the entire data. Data size is small, just a
few attribute names and values.

Since on tomcat 7.x we used Apr, I tried to use the Apr Connector (changed the
protocol attribute of the connector to
org.apache.coyote.http11.Http11AprProtocol and removed the
sslImplementationName parameter) , I have not changed anything else on the
server or web app. This fixed the issue.

So my guess is that for some reason Nio2 is the cause.

If this is not a known issue, I'll try to investigate more. Please let me know.
Thanks

-- 
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: r1756778 - in /tomcat/trunk: java/org/apache/tomcat/util/net/Nio2Endpoint.java webapps/docs/changelog.xml

2016-08-18 Thread violetagg
Author: violetagg
Date: Thu Aug 18 13:19:30 2016
New Revision: 1756778

URL: http://svn.apache.org/viewvc?rev=1756778&view=rev
Log:
Ensure that Semaphore.release is called in all cases. Even when there is an 
exception.

Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java?rev=1756778&r1=1756777&r2=1756778&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Thu Aug 18 
13:19:30 2016
@@ -819,6 +819,10 @@ public class Nio2Endpoint extends Abstra
 log.debug("Socket: [" + this + "], block: [" + block + "], 
length: [" + len + "]");
 }
 
+if (socketBufferHandler == null) {
+throw new IOException(sm.getString("socket.closed"));
+}
+
 if (block) {
 try {
 readPending.acquire();
@@ -834,9 +838,6 @@ public class Nio2Endpoint extends Abstra
 }
 }
 
-if (socketBufferHandler == null) {
-throw new IOException(sm.getString("socket.closed"));
-}
 socketBufferHandler.configureReadBufferForRead();
 ByteBuffer readBuffer = socketBufferHandler.getReadBuffer();
 int remaining = readBuffer.remaining();
@@ -1096,9 +1097,6 @@ public class Nio2Endpoint extends Abstra
 try {
 integer = 
getSocket().read(socketBufferHandler.getReadBuffer());
 nRead = integer.get(getNio2ReadTimeout(), 
TimeUnit.MILLISECONDS).intValue();
-// Blocking read so need to release here since there will
-// not be a callback to a completion handler.
-readPending.release();
 } catch (ExecutionException e) {
 if (e.getCause() instanceof IOException) {
 throw (IOException) e.getCause();
@@ -1110,6 +1108,10 @@ public class Nio2Endpoint extends Abstra
 } catch (TimeoutException e) {
 integer.cancel(true);
 throw new SocketTimeoutException();
+} finally {
+// Blocking read so need to release here since there will
+// not be a callback to a completion handler.
+readPending.release();
 }
 } else {
 Nio2Endpoint.startInline();

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1756778&r1=1756777&r2=1756778&view=diff
==
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Thu Aug 18 13:19:30 2016
@@ -166,6 +166,10 @@
 number of HTTP/2 streams for a connection could not be pruned to below
 the limit. (markt)
   
+  
+Ensure that Semaphore.release is called in all cases. Even
+when there is an exception. (violetagg)
+  
 
   
   



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



svn commit: r1756780 - in /tomcat/tc8.5.x/trunk: ./ java/org/apache/tomcat/util/net/Nio2Endpoint.java webapps/docs/changelog.xml

2016-08-18 Thread violetagg
Author: violetagg
Date: Thu Aug 18 13:22:04 2016
New Revision: 1756780

URL: http://svn.apache.org/viewvc?rev=1756780&view=rev
Log:
Ensure that Semaphore.release is called in all cases. Even when there is an 
exception.

Modified:
tomcat/tc8.5.x/trunk/   (props changed)
tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc8.5.x/trunk/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Aug 18 13:22:04 2016
@@ -1 +1 @@
-/tomcat/trunk:1734785,1734799,1734845,1734928,1735041,1735044,1735480,1735577,1735597,1735599-1735600,1735615,1736145,1736162,1736209,1736280,1736297,1736299,1736489,1736646,1736703,1736836,1736849,1737104-1737105,1737112,1737117,1737119-1737120,1737155,1737157,1737192,1737280,1737339,1737632,1737664,1737715,1737748,1737785,1737834,1737860,1737903,1737959,1738005,1738007,1738014-1738015,1738018,1738022,1738039,1738043,1738059-1738060,1738147,1738149,1738174-1738175,1738261,1738589,1738623-1738625,1738643,1738816,1738850,1738855,1738946-1738948,1738953-1738954,1738979,1738982,1739079-1739081,1739087,1739113,1739153,1739172,1739176,1739191,1739474,1739726,1739762,1739775,1739814,1739817-1739818,1739975,1740131,1740324,1740465,1740495,1740508-1740509,1740520,1740535,1740707,1740803,1740810,1740969,1740980,1740991,1740997,1741015,1741033,1741036,1741058,1741060,1741080,1741147,1741159,1741164,1741173,1741181,1741190,1741197,1741202,1741208,1741213,1741221,1741225,1741232,1741409,1741501
 
,1741677,1741892,1741896,1741984,1742023,1742042,1742071,1742090,1742093,1742101,1742105,1742111,1742139,1742146,1742148,1742166,1742181,1742184,1742187,1742246,1742248-1742251,1742263-1742264,1742268,1742276,1742369,1742387,1742448,1742509-1742512,1742917,1742919,1742933,1742975-1742976,1742984,1742986,1743019,1743115,1743117,1743124-1743125,1743134,1743425,1743554,1743679,1743696-1743698,1743700-1743701,1744058,1744064-1744065,1744125,1744194,1744229,1744270,1744323,1744432,1744684,1744697,1744705,1744713,1744760,1744786,1745083,1745142-1745143,1745145,1745177,1745179-1745180,1745227,1745248,1745254,1745337,1745467,1745473,1745576,1745735,1745744,1746304,1746306-1746307,1746319,1746327,1746338,1746340-1746341,1746344,1746427,1746441,1746473,1746490,1746492,1746495-1746496,1746499-1746501,1746503-1746507,1746509,1746549,1746551,1746554,1746556,1746558,1746584,1746620,1746649,1746724,1746939,1746989,1747014,1747028,1747035,1747210,1747225,1747234,1747253,1747404,1747506,1747536,1747
 
924,1747980,1747993,1748001,1748253,1748452,1748547,1748629,1748676,1748715,1749287,1749296,1749328,1749373,1749465,1749506,1749508,1749665-1749666,1749763,1749865-1749866,1749898,1749978,1749980,1750011,1750015,1750056,1750480,1750617,1750634,1750692,1750697,1750700,1750703,1750707,1750714,1750718,1750723,1750774,1750899,1750975,1750995,1751061,1751097,1751173,1751438,1751447,1751463,1751702,1752212,1752737,1752745,1753078,1753080,1753358,1753363,1754111,1754140-1754141,1754281,1754310,1754445,1754467,1754494,1754496,1754528,1754532-1754533,1754613,1754714,1754874,1754941,1754944,1754950-1754951,1755005,1755007,1755009,1755132,1755180-1755181,1755185,1755190,1755204-1755206,1755208,1755214,1755224,1755227,1755230,1755629,1755646-1755647,1755650,1755653,1755675,1755680,1755683,1755693,1755717,1755731-1755737,1755812,1755828,1755884,1755890,1755918-1755919,1755942,1755958,1755960,1755970,1755993,1756013,1756019,1756039,1756056,1756083-1756114,1756175,1756288-1756289,1756408-1756410
+/tomcat/trunk:1734785,1734799,1734845,1734928,1735041,1735044,1735480,1735577,1735597,1735599-1735600,1735615,1736145,1736162,1736209,1736280,1736297,1736299,1736489,1736646,1736703,1736836,1736849,1737104-1737105,1737112,1737117,1737119-1737120,1737155,1737157,1737192,1737280,1737339,1737632,1737664,1737715,1737748,1737785,1737834,1737860,1737903,1737959,1738005,1738007,1738014-1738015,1738018,1738022,1738039,1738043,1738059-1738060,1738147,1738149,1738174-1738175,1738261,1738589,1738623-1738625,1738643,1738816,1738850,1738855,1738946-1738948,1738953-1738954,1738979,1738982,1739079-1739081,1739087,1739113,1739153,1739172,1739176,1739191,1739474,1739726,1739762,1739775,1739814,1739817-1739818,1739975,1740131,1740324,1740465,1740495,1740508-1740509,1740520,1740535,1740707,1740803,1740810,1740969,1740980,1740991,1740997,1741015,1741033,1741036,1741058,1741060,1741080,1741147,1741159,1741164,1741173,1741181,1741190,1741197,1741202,1741208,1741213,1741221,1741225,1741232,1741409,1741501
 
,1741677,1741892,1741896,1741984,1742023,1742042,1742071,1742090,1742093,1742101,1742105,1742111,1742139,1742146,1742148,1742166,1742181,1742184,1742187,1742246,1742248-1742251,1742263-1742264,1742268,1742276,1742369,1742387,1742448,1742509-1742512,1742917,1742919,1742933,1742975-1742976,1742984,1742986,1743019,1743115,1743117,1743124-1743125,1743134,1743425,1743554,1743679,1743696-1743698,1743700-

[Bug 59708] LockOutRealm Details

2016-08-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=59708

--- Comment #4 from Ben  ---
Thanks for this fix. I'd like to ask one more technical question about it: Are
the wrapped realms authenticated before the lockout or is the lockout checked
before attempting real authentication?

Example:

  


If I try to authenticate but I'm in lockout, is LDAP triggered? It looks like
the answer is probably "yes" because of the 401 Unauthorized response, which
usually indicates authentication was successful.

-- 
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: r1756798 - in /tomcat/trunk/java/org/apache/tomcat/util/net: AprEndpoint.java Nio2Endpoint.java NioEndpoint.java SocketWrapperBase.java

2016-08-18 Thread violetagg
Author: violetagg
Date: Thu Aug 18 14:43:05 2016
New Revision: 1756798

URL: http://svn.apache.org/viewvc?rev=1756798&view=rev
Log:
Reduce duplications.
Extract a new method SocketWrapperBase.populateReadBuffer(byte[], int, int).

Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1756798&r1=1756797&r2=1756798&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Thu Aug 18 
14:43:05 2016
@@ -2279,19 +2279,10 @@ public class AprEndpoint extends Abstrac
 
 
 @Override
-public int read(boolean block, byte[] b, int off, int len)
-throws IOException {
-
-socketBufferHandler.configureReadBufferForRead();
-ByteBuffer readBuffer = socketBufferHandler.getReadBuffer();
-int remaining = readBuffer.remaining();
-
-// Is there enough data in the read buffer to satisfy this request?
-// Copy what data there is in the read buffer to the byte array
-if (remaining > 0) {
-remaining = Math.min(remaining, len);
-readBuffer.get(b, off, remaining);
-return remaining;
+public int read(boolean block, byte[] b, int off, int len) throws 
IOException {
+int nRead = populateReadBuffer(b, off, len);
+if (nRead > 0) {
+return nRead;
 /*
  * Since more bytes may have arrived since the buffer was last
  * filled, it is an option at this point to perform a
@@ -2302,14 +2293,14 @@ public class AprEndpoint extends Abstrac
 }
 
 // Fill the read buffer as best we can.
-int nRead = fillReadBuffer(block);
+nRead = fillReadBuffer(block);
 
-// Full as much of the remaining byte array as possible with the
+// Fill as much of the remaining byte array as possible with the
 // data that was just read
 if (nRead > 0) {
 socketBufferHandler.configureReadBufferForRead();
 nRead = Math.min(nRead, len);
-readBuffer.get(b, off, nRead);
+socketBufferHandler.getReadBuffer().get(b, off, nRead);
 }
 return nRead;
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java?rev=1756798&r1=1756797&r2=1756798&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Thu Aug 18 
14:43:05 2016
@@ -838,36 +838,26 @@ public class Nio2Endpoint extends Abstra
 }
 }
 
-socketBufferHandler.configureReadBufferForRead();
-ByteBuffer readBuffer = socketBufferHandler.getReadBuffer();
-int remaining = readBuffer.remaining();
-
-// Is there enough data in the read buffer to satisfy this request?
-// Copy what data there is in the read buffer to the byte array
-if (remaining > 0) {
-remaining = Math.min(remaining, len);
-readBuffer.get(b, off, remaining);
-if (log.isDebugEnabled()) {
-log.debug("Socket: [" + this + "], Read from buffer: [" + 
remaining + "]");
-}
+int nRead = populateReadBuffer(b, off, len);
+if (nRead > 0) {
 // This may be sufficient to complete the request and we
 // don't want to trigger another read since if there is no
 // more data to read and this request takes a while to
 // process the read will timeout triggering an error.
 readPending.release();
-return remaining;
+return nRead;
 }
 
 synchronized (readCompletionHandler) {
 // Fill the read buffer as best we can.
-int nRead = fillReadBuffer(block);
+nRead = fillReadBuffer(block);
 
 // Fill as much of the remaining byte array as possible with 
the
 // data that was just read
 if (nRead > 0) {
 socketBufferHandler.configureReadBufferForRead();
   

svn commit: r1756799 - in /tomcat/tc8.5.x/trunk: ./ java/org/apache/tomcat/util/net/AprEndpoint.java java/org/apache/tomcat/util/net/Nio2Endpoint.java java/org/apache/tomcat/util/net/NioEndpoint.java

2016-08-18 Thread violetagg
Author: violetagg
Date: Thu Aug 18 14:45:40 2016
New Revision: 1756799

URL: http://svn.apache.org/viewvc?rev=1756799&view=rev
Log:
Reduce duplications.
Extract a new method SocketWrapperBase.populateReadBuffer(byte[], int, int).

Modified:
tomcat/tc8.5.x/trunk/   (props changed)
tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java

Propchange: tomcat/tc8.5.x/trunk/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Aug 18 14:45:40 2016
@@ -1 +1 @@
-/tomcat/trunk:1734785,1734799,1734845,1734928,1735041,1735044,1735480,1735577,1735597,1735599-1735600,1735615,1736145,1736162,1736209,1736280,1736297,1736299,1736489,1736646,1736703,1736836,1736849,1737104-1737105,1737112,1737117,1737119-1737120,1737155,1737157,1737192,1737280,1737339,1737632,1737664,1737715,1737748,1737785,1737834,1737860,1737903,1737959,1738005,1738007,1738014-1738015,1738018,1738022,1738039,1738043,1738059-1738060,1738147,1738149,1738174-1738175,1738261,1738589,1738623-1738625,1738643,1738816,1738850,1738855,1738946-1738948,1738953-1738954,1738979,1738982,1739079-1739081,1739087,1739113,1739153,1739172,1739176,1739191,1739474,1739726,1739762,1739775,1739814,1739817-1739818,1739975,1740131,1740324,1740465,1740495,1740508-1740509,1740520,1740535,1740707,1740803,1740810,1740969,1740980,1740991,1740997,1741015,1741033,1741036,1741058,1741060,1741080,1741147,1741159,1741164,1741173,1741181,1741190,1741197,1741202,1741208,1741213,1741221,1741225,1741232,1741409,1741501
 
,1741677,1741892,1741896,1741984,1742023,1742042,1742071,1742090,1742093,1742101,1742105,1742111,1742139,1742146,1742148,1742166,1742181,1742184,1742187,1742246,1742248-1742251,1742263-1742264,1742268,1742276,1742369,1742387,1742448,1742509-1742512,1742917,1742919,1742933,1742975-1742976,1742984,1742986,1743019,1743115,1743117,1743124-1743125,1743134,1743425,1743554,1743679,1743696-1743698,1743700-1743701,1744058,1744064-1744065,1744125,1744194,1744229,1744270,1744323,1744432,1744684,1744697,1744705,1744713,1744760,1744786,1745083,1745142-1745143,1745145,1745177,1745179-1745180,1745227,1745248,1745254,1745337,1745467,1745473,1745576,1745735,1745744,1746304,1746306-1746307,1746319,1746327,1746338,1746340-1746341,1746344,1746427,1746441,1746473,1746490,1746492,1746495-1746496,1746499-1746501,1746503-1746507,1746509,1746549,1746551,1746554,1746556,1746558,1746584,1746620,1746649,1746724,1746939,1746989,1747014,1747028,1747035,1747210,1747225,1747234,1747253,1747404,1747506,1747536,1747
 
924,1747980,1747993,1748001,1748253,1748452,1748547,1748629,1748676,1748715,1749287,1749296,1749328,1749373,1749465,1749506,1749508,1749665-1749666,1749763,1749865-1749866,1749898,1749978,1749980,1750011,1750015,1750056,1750480,1750617,1750634,1750692,1750697,1750700,1750703,1750707,1750714,1750718,1750723,1750774,1750899,1750975,1750995,1751061,1751097,1751173,1751438,1751447,1751463,1751702,1752212,1752737,1752745,1753078,1753080,1753358,1753363,1754111,1754140-1754141,1754281,1754310,1754445,1754467,1754494,1754496,1754528,1754532-1754533,1754613,1754714,1754874,1754941,1754944,1754950-1754951,1755005,1755007,1755009,1755132,1755180-1755181,1755185,1755190,1755204-1755206,1755208,1755214,1755224,1755227,1755230,1755629,1755646-1755647,1755650,1755653,1755675,1755680,1755683,1755693,1755717,1755731-1755737,1755812,1755828,1755884,1755890,1755918-1755919,1755942,1755958,1755960,1755970,1755993,1756013,1756019,1756039,1756056,1756083-1756114,1756175,1756288-1756289,1756408-1756410,1
 756778
+/tomcat/trunk:1734785,1734799,1734845,1734928,1735041,1735044,1735480,1735577,1735597,1735599-1735600,1735615,1736145,1736162,1736209,1736280,1736297,1736299,1736489,1736646,1736703,1736836,1736849,1737104-1737105,1737112,1737117,1737119-1737120,1737155,1737157,1737192,1737280,1737339,1737632,1737664,1737715,1737748,1737785,1737834,1737860,1737903,1737959,1738005,1738007,1738014-1738015,1738018,1738022,1738039,1738043,1738059-1738060,1738147,1738149,1738174-1738175,1738261,1738589,1738623-1738625,1738643,1738816,1738850,1738855,1738946-1738948,1738953-1738954,1738979,1738982,1739079-1739081,1739087,1739113,1739153,1739172,1739176,1739191,1739474,1739726,1739762,1739775,1739814,1739817-1739818,1739975,1740131,1740324,1740465,1740495,1740508-1740509,1740520,1740535,1740707,1740803,1740810,1740969,1740980,1740991,1740997,1741015,1741033,1741036,1741058,1741060,1741080,1741147,1741159,1741164,1741173,1741181,1741190,1741197,1741202,1741208,1741213,1741221,1741225,1741232,1741409,1741501
 
,1741677,1741892,1741896,1741984,1742023,1742042,1742071,1742090,1742093,1742101,1742105,1742111,1742139,1742146,1742148,1742166,1742181,1742184,1742187,1742246,1742248-1742251,1742263-1742264,1742268,1742

[Bug 60022] New: ContextConfig#fixDocBase function generates invalid docBase if exploded war is a sym-link

2016-08-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=60022

Bug ID: 60022
   Summary: ContextConfig#fixDocBase function generates invalid
docBase if exploded war is a sym-link
   Product: Tomcat 8
   Version: 8.5.4
  Hardware: PC
OS: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: Catalina
  Assignee: dev@tomcat.apache.org
  Reporter: mohitch...@yahoo.com

I have a scenario where my appBase looks something like this - 

/xyz/tomcat/webapps

and I have a ROOT.war file and a pre-exploded war both as symlinks, something
like -

/xyz/tomcat/webapps/ROOT -> /abc/ROOT/
/xyz/tomcat/webapps/ROOT.war -> /abc/ROOT.war

This means that in ContextConfig.fixDocBase():578, I see docBase = ROOT.war

This then expands to docBase = /xyz/tomcat/webapps/ROOT.war at line:591. 

Stepping forward, at line:609, docBaseInAppBase gets set to true as my docBase
indeed starts with the appBase string.

Considering that the docBase value as of now ends in .war and it is not a
directory and I have unpackWARS set to true, at line 614, docBase is set to
'/xyz/tomcat/webapps/ROOT' (as that's what ExpandWars.expand returns).

And then at line 616, docBase is set to the canonicalPath of
/xyz/tomcat/webapps/ROOT which in my case is /abc/ROOT/

Note that my docBaseInAppBase is still set to true, which is now incorrect.

This means that at line:656, either docBase.substring() throws an exception if
my docBase was shorter than appBase, or, if not, context.setDocBase gets set to
an invalid truncated value of the canonical path at line:665 which causes
problems down the line.

Specifically for longer canonical paths of the exploded war I get -  

Caused by: java.lang.IllegalArgumentException: The main resource set specified
[] is not valid
239   at
org.apache.catalina.webresources.StandardRoot.createMainResourceSet(StandardRoot.java:729)
~[catalina.jar:8.5.4]
240   at
org.apache.catalina.webresources.StandardRoot.startInternal(StandardRoot.java:686)
~[catalina.jar:8.5.4]
241   at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152)
~[catalina.jar:8.5.4]
242   at
org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4831)
~[catalina.jar:8.5.4]
243   at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4963)
~[catalina.jar:8.5.4]
244   at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152)
~[catalina.jar:8.5.4]

In my tests, refreshing the docBaseInAppBase value by calling again -
docBaseInAppBase = docBase.startsWith(appBase.getPath() + File.separatorChar); 

just before line:655 (which checks the docBaseInAppBase value) solves the
problem, but I'm not sure if I'm missing any other edge conditions.

I'll really appreciate a formal fix for the issue. Thanks!

-- 
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 60022] ContextConfig#fixDocBase function generates invalid docBase if exploded war is a sym-link

2016-08-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=60022

--- Comment #1 from mohitch...@yahoo.com ---
To summarize, ContextConfig.fixDocBase() is not correctly revalidating the fact
that it thought docBase was inside appBase after it sets docBase to its
canonical path.

-- 
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 60012] Several log refactoring/improvement suggestions

2016-08-18 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=60012

Violeta Georgieva  changed:

   What|Removed |Added

   Severity|major   |normal

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