svn commit: r1672434 - /tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java

2015-04-09 Thread markt
Author: markt
Date: Thu Apr  9 17:58:40 2015
New Revision: 1672434

URL: http://svn.apache.org/r1672434
Log:
SNI Refactoring. I'm doing this in small steps as I tried to do it a single go 
and got something wrong that broke secure connections.

Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java?rev=1672434r1=1672433r2=1672434view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java Thu Apr  
9 17:58:40 2015
@@ -28,6 +28,7 @@ import javax.net.ssl.SSLEngine;
 import javax.net.ssl.SSLEngineResult;
 import javax.net.ssl.SSLEngineResult.HandshakeStatus;
 import javax.net.ssl.SSLEngineResult.Status;
+import javax.net.ssl.SSLException;
 
 /**
  *
@@ -53,7 +54,7 @@ public class SecureNioChannel extends Ni
 protected NioSelectorPool pool;
 
 public SecureNioChannel(SocketChannel channel, SSLEngine engine, 
SocketBufferHandler bufHandler,
-NioSelectorPool pool) throws IOException {
+NioSelectorPool pool) {
 super(channel,bufHandler);
 this.sslEngine = engine;
 int netBufSize = sslEngine.getSession().getPacketBufferSize();
@@ -63,14 +64,13 @@ public class SecureNioChannel extends Ni
 
 //selector pool for blocking operations
 this.pool = pool;
-
-reset();
 }
 
 public void reset(SSLEngine engine) throws IOException {
 this.sslEngine = engine;
 reset();
 }
+
 @Override
 public void reset() throws IOException {
 super.reset();
@@ -78,12 +78,10 @@ public class SecureNioChannel extends Ni
 netOutBuffer.limit(0);
 netInBuffer.position(0);
 netInBuffer.limit(0);
+sniComplete = false;
 handshakeComplete = false;
 closed = false;
 closing = false;
-//initiate handshake
-sslEngine.beginHandshake();
-handshakeStatus = sslEngine.getHandshakeStatus();
 }
 
 
@@ -224,7 +222,11 @@ public class SecureNioChannel extends Ni
  * present and, if it is, what host name has been requested. Based on the
  * provided host name, configure the SSLEngine for this connection.
  */
-private int processSNI() {
+private int processSNI() throws SSLException {
+// Initiate handshake
+sslEngine.beginHandshake();
+handshakeStatus = sslEngine.getHandshakeStatus();
+
 return 0;
 }
 



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



[Bug 57801] Tomcat catalina.sh fails to start after machine is reboot because there is another process have the same PID as Tomcat before reboot

2015-04-09 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=57801

Rainer Jung rainer.j...@kippdata.de changed:

   What|Removed |Added

Product|Tomcat 8|Tomcat 6
  Component|Catalina|Catalina
Version|8.0.21  |6.0.43

--- Comment #2 from Rainer Jung rainer.j...@kippdata.de ---
I added the message

If this process is not a Tomcat process, remove the PID file and try again.

to the output. The name of the PID file is already being output earlier during
the script run.

Added to trunk in r1672272, tc 8 in r1672273 (will be part of 8.0.22), tc 7 in
r1672274 (will be part of 7.0.62) and proposed for TC 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



buildbot success in ASF Buildbot on tomcat-trunk

2015-04-09 Thread buildbot
The Buildbot has detected a restored build on builder tomcat-trunk while 
building ASF Buildbot. Full details are available at:
http://ci.apache.org/builders/tomcat-trunk/builds/1116

Buildbot URL: http://ci.apache.org/

Buildslave for this Build: silvanus_ubuntu

Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-commit' 
triggered this build
Build Source Stamp: [branch tomcat/trunk] 1672312
Blamelist: markt

Build succeeded!

Sincerely,
 -The Buildbot




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



svn commit: r1672284 - /tomcat/trunk/bin/catalina.sh

2015-04-09 Thread rjung
Author: rjung
Date: Thu Apr  9 10:29:52 2015
New Revision: 1672284

URL: http://svn.apache.org/r1672284
Log:
More hints about process using the PID.

Modified:
tomcat/trunk/bin/catalina.sh

Modified: tomcat/trunk/bin/catalina.sh
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/bin/catalina.sh?rev=1672284r1=1672283r2=1672284view=diff
==
--- tomcat/trunk/bin/catalina.sh (original)
+++ tomcat/trunk/bin/catalina.sh Thu Apr  9 10:29:52 2015
@@ -342,7 +342,8 @@ elif [ $1 = start ] ; then
   ps -p $PID /dev/null 21
   if [ $? -eq 0 ] ; then
 echo Tomcat appears to still be running with PID $PID. Start 
aborted.
-echo If this process is not a Tomcat process, remove the PID file 
and try again.
+echo If the following process is not a Tomcat process, remove the 
PID file and try again:
+ps -f -p $PID
 exit 1
   else
 echo Removing/clearing stale PID file.



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



buildbot failure in ASF Buildbot on tomcat-7-trunk

2015-04-09 Thread buildbot
The Buildbot has detected a new failure on builder tomcat-7-trunk while 
building ASF Buildbot. Full details are available at:
http://ci.apache.org/builders/tomcat-7-trunk/builds/616

Buildbot URL: http://ci.apache.org/

Buildslave for this Build: silvanus_ubuntu

Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-7-commit' 
triggered this build
Build Source Stamp: [branch tomcat/tc7.0.x/trunk] 1672274
Blamelist: rjung

BUILD FAILED: failed compile_1

Sincerely,
 -The Buildbot




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



buildbot success in ASF Buildbot on tomcat-trunk

2015-04-09 Thread buildbot
The Buildbot has detected a restored build on builder tomcat-trunk while 
building ASF Buildbot. Full details are available at:
http://ci.apache.org/builders/tomcat-trunk/builds/1120

Buildbot URL: http://ci.apache.org/

Buildslave for this Build: silvanus_ubuntu

Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-commit' 
triggered this build
Build Source Stamp: [branch tomcat/trunk] 1672452
Blamelist: markt

Build succeeded!

Sincerely,
 -The Buildbot




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



[Bug 56438] If jar scan does not find context config or TLD config, log a message

2015-04-09 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=56438

--- Comment #3 from VIN reachme.va...@gmail.com ---
Created attachment 32639
  -- https://bz.apache.org/bugzilla/attachment.cgi?id=32639action=edit
Fix for Tomcat7 TldConfig and ContextConfig scan

Attached patch contains below fixes:
1) If any jar is scanned for TLDs and it does not contain any TLDs, add a debug
message No TLDs were found in JAR.  A overall summary INFO message is added
to inform that Atleast one JAR was scanned unnecessarily. 

2) If any JAR or FILE is scanned for fragments and it did not contain any
fragment, add a debug message No fragments were found in JAR/File. A overall
summary INFO message is added to inform that Atleast one JAR/File was scanned
unnecessarily.

Please review my patch and let me know in case of any problems.

-- 
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: r1672286 - in /tomcat/tc7.0.x/trunk: ./ bin/catalina.sh

2015-04-09 Thread rjung
Author: rjung
Date: Thu Apr  9 10:32:21 2015
New Revision: 1672286

URL: http://svn.apache.org/r1672286
Log:
More hints about process using the PID.

Backport of r1672284 from trunk resp.
r1672285 from tc8.

Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/bin/catalina.sh

Propchange: tomcat/tc7.0.x/trunk/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Apr  9 10:32:21 2015
@@ -1,2 +1,2 @@
-/tomcat/tc8.0.x/trunk:1636525,1637336,1637685,1637709,1638726,1640089,1640276,1640349,1640363,1640366,1640642,1640672,1640674,1640689,1640884,1641001,1641065,1641067,1641375,1641638,1641723,1641726,1641729-1641730,1641736,1641988,1642669-1642670,1642698,1642701,1643205,1643215,1643217,1643230,1643232,1643273,1643285,1643329-1643330,1643511,1643513,1643521,1643539,1643571,1643581-1643582,1643635,1643655,1643738,1643964,1644018,1644333,1644954,1644992,1645014,1645360,1645456,1645627,1645642,1645686,1645903-1645904,1645908-1645909,1645913,1645920,1646458,1646460-1646462,1647043,1648816,1651420-1651422,1651844,1652939-1652940,1652973,1653798,1653817,1653841,1654042,1654161,1654736,1654767,1654787,1656592,1662986,1663265,1663278,1663325,1663535,1663567,1663679,1663997,1664175,1664321,1664872,1665061,1665086,1666027,1666395,1666503,1666506,1666560,1666570,1666581,1666759,1666967,1666988,1667553-1667555,1667558,1667617,1667633,1667637,1667747,1667767,1667873,1668028,1668137,1668634,1669432
 
,1669801,1669840,1669895-1669896,1670398,1670435,1670592,1670605-1670607,1670609,1670632,1670720,1670725,1670727,1670731,1671114,1672273
-/tomcat/trunk:1156115-1157160,1157162-1157859,1157862-1157942,1157945-1160347,1160349-1163716,1163718-1166689,1166691-1174340,1174342-1175596,1175598-1175611,1175613-1175932,1175934-1177783,1177785-1177980,1178006-1180720,1180722-1183094,1183096-1187753,1187755,1187775,1187801,1187806,1187809,1187826-1188312,1188314-1188401,1188646-1188840,1188842-1190176,1190178-1195223,1195225-1195953,1195955,1195957-1201238,1201240-1203345,1203347-1206623,1206625-1208046,1208073,1208096,1208114,1208145,1208772,1209194-1212125,1212127-1220291,1220293,1220295-1221321,1221323-1222329,1222332-1222401,1222405-1222795,1222850-1222950,1222969-1225326,1225328-1225463,1225465,1225627,1225629-1226534,1226536-1228908,1228911-1228923,1228927-1229532,1229534-1230766,1230768-1231625,1231627-1233414,1233419-1235207,1235209-1237425,1237427,1237429-1237977,1237981,1237985,1237995,1238070,1238073,1239024-1239048,1239050-1239062,1239135,1239256,1239258-1239485,1239785-1240046,1240101,1240106,1240109,1240112,1240114
 
,1240116,1240118,1240121,1240329,1240474-1240850,1240857,1241087,1241160,1241408-1241822,1241908-1241909,1241912-1242110,1242371-1292130,1292134-1292458,1292464-1292670,1292672-1292776,1292780-1293392,1293397-1297017,1297019-1297963,1297965-1299820,1300108,1300111-1300460,1300520-1300948,1300997,1301006,1301280,1302332,1302348,1302608-1302610,1302649,1302837,1303138,1303163,1303338,1303521,1303587,1303698,1303803,1303852,1304011,1304035,1304037,1304135,1304249,1304253,1304260,1304271,1304275,1304468,1304895,1304930-1304932,1305194,1305943,1305965,1306556,1306579-1306580,1307084,1307310,1307511-1307512,1307579,1307591,1307597,1310636,1310639-1310640,1310642,1310701,1311212,1311995,1327617,1327670,1331766,1333161,1333173,1333827,1334787,1335026,1335257,1335547,1335692,1335711,1335731,1336515,1336813,1336864,1336868,1336884,1337419,1337426,1337546,1337572,1337591-1337595,1337643,1337707,1337719,1337734,1337741,1337745,1338151-1338154,1338178,1342027,1342029,1342315,1342320,1342476,1342
 
498,1342503,1342717,1342795,1342805,1343044-1343046,1343335,1343394,1343400,1343629,1343708,1343718,1343895,1344063,1344068,1344250,1344266,1344515,1344528,1344612,1344629,1344725,1344868,1344890,1344893,1344896,1344901,1345020,1345029,1345039,1345287-1345290,1345294,1345309,1345325,1345357,1345367,1345579-1345580,1345582,1345688,1345699,1345704,1345731-1345732,1345737,1345744,1345752,1345754,1345779,1345781,1345846,1346107,1346365,1346376,1346404,1346510,1346514,1346519,1346581,1346635,1346644,1346683,1346794,1346885,1346932,1347034,1347047,1347087,1347108-1347109,1347583,1347737,1348105,1348357,1348398,1348425,1348461-1348495,1348498,1348752,1348762,1348772,1348776,1348859,1348968,1348973,1348989,1349007,1349237,1349298,1349317,1349410,1349473,1349539,1349879,1349887,1349893,1349922,1349984,1350124,1350241,1350243,1350294-1350295,1350299,1350864,1350900,1351010,1351054,1351056,1351068,1351134-1351135,1351148,1351259,1351604,1351636-1351640,1351991,1351993,1352011,1352056,1352059,1
 

[Bug 57799] MessageCreationException: Couldn't create SOAP message with Nio2 connector protocol

2015-04-09 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=57799

--- Comment #3 from Remy Maucherat r...@apache.org ---
As part of the investigation I fixed some issues (r1672297) which will be
backported to Tomcat 8, but I don't see any way for the read pending flag to
have a bad state. Without some test, the issue will eventually be closed.

-- 
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: r1672287 - /tomcat/tc6.0.x/trunk/STATUS.txt

2015-04-09 Thread rjung
Author: rjung
Date: Thu Apr  9 10:34:27 2015
New Revision: 1672287

URL: http://svn.apache.org/r1672287
Log:
Add further improvement to proposal.

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=1672287r1=1672286r2=1672287view=diff
==
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Thu Apr  9 10:34:27 2015
@@ -41,8 +41,11 @@ PATCHES PROPOSED TO BACKPORT:
 * Improve catalina.sh error message, the PID read from the PID file during
   startup is already taken by an existing process.
   trunk: http://svn.apache.org/r1672272
+ http://svn.apache.org/r1672284
   tc8  : http://svn.apache.org/r1672273
+ http://svn.apache.org/r1672285
   tc7  : http://svn.apache.org/r1672274
+ http://svn.apache.org/r1672286
   +1: rjung
   -1:
 



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



svn commit: r1672297 - /tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java

2015-04-09 Thread remm
Author: remm
Date: Thu Apr  9 11:45:56 2015
New Revision: 1672297

URL: http://svn.apache.org/r1672297
Log:
Investigating 57799 I found some issues in the SSL impl:
- Possibly incomplete writes.
- After some errors (which shouldn't happen however), the pending flag could 
still be set.
- A bad idea to deal with possible behavior differences for read IO calls 
between NIO and NIO2 (according to my testing, it doesn't seem to be needed). 
Test: the byte counter.

Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java?rev=1672297r1=1672296r2=1672297view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java Thu Apr 
 9 11:45:56 2015
@@ -470,26 +470,29 @@ public class SecureNio2Channel extends N
 }
 
 private class FutureRead implements FutureInteger {
-private ByteBuffer dst;
+private final ByteBuffer dst;
+private final FutureInteger integer;
 public FutureRead(ByteBuffer dst) {
 this.dst = dst;
+this.integer = sc.read(netInBuffer);
 }
 @Override
 public boolean cancel(boolean mayInterruptIfRunning) {
-return false;
+readPending = false;
+return integer.cancel(mayInterruptIfRunning);
 }
 @Override
 public boolean isCancelled() {
-return false;
+return integer.isCancelled();
 }
 @Override
 public boolean isDone() {
-return true;
+return integer.isDone();
 }
 @Override
 public Integer get() throws InterruptedException, ExecutionException {
 try {
-return unwrap(netInBuffer.position());
+return unwrap(integer.get().intValue());
 } finally {
 readPending = false;
 }
@@ -499,17 +502,17 @@ public class SecureNio2Channel extends N
 throws InterruptedException, ExecutionException,
 TimeoutException {
 try {
-return unwrap(netInBuffer.position());
+return unwrap(integer.get(timeout, unit).intValue());
 } finally {
 readPending = false;
 }
 }
-protected Integer unwrap(int netread) throws ExecutionException {
+private Integer unwrap(int nRead) throws ExecutionException {
 //are we in the middle of closing or closed?
 if (closing || closed)
 return Integer.valueOf(-1);
 //did we reach EOF? if so send EOF up one layer.
-if (netread == -1)
+if (nRead  0)
 return Integer.valueOf(-1);
 //the data read
 int read = 0;
@@ -526,16 +529,18 @@ public class SecureNio2Channel extends N
 }
 //compact the buffer
 netInBuffer.compact();
-if (unwrap.getStatus()==Status.OK || 
unwrap.getStatus()==Status.BUFFER_UNDERFLOW) {
+if (unwrap.getStatus() == Status.OK || unwrap.getStatus() == 
Status.BUFFER_UNDERFLOW) {
 //we did receive some data, add it to our total
 read += unwrap.bytesProduced();
 //perform any tasks if needed
-if (unwrap.getHandshakeStatus() == 
HandshakeStatus.NEED_TASK)
+if (unwrap.getHandshakeStatus() == 
HandshakeStatus.NEED_TASK) {
 tasks();
+}
 //if we need more network data, then bail out for now.
-if (unwrap.getStatus() == Status.BUFFER_UNDERFLOW)
+if (unwrap.getStatus() == Status.BUFFER_UNDERFLOW) {
 break;
-} else if (unwrap.getStatus()==Status.BUFFER_OVERFLOW  read 
 0) {
+}
+} else if (unwrap.getStatus() == Status.BUFFER_OVERFLOW  
read  0) {
 //buffer overflow can happen, if we have read data, then
 //empty out the dst buffer before we do another read
 break;
@@ -550,46 +555,6 @@ public class SecureNio2Channel extends N
 }
 }
 
-private class FutureNetRead extends FutureRead {
-private FutureInteger integer;
-protected FutureNetRead(ByteBuffer dst) {
-super(dst);
-this.integer = sc.read(netInBuffer);
-}
-@Override
-public boolean cancel(boolean mayInterruptIfRunning) {
-return integer.cancel(mayInterruptIfRunning);
-}
-@Override
-

Re: [GUMP@vmgump]: Project tomcat-tc8.0.x (in module tomcat-8.0.x) failed

2015-04-09 Thread Rainer Jung

Am 09.04.2015 um 02:57 schrieb Bill Barker:

To whom it may engage...

This is an automated request, but not an unsolicited one. For
more information please visit http://gump.apache.org/nagged.html,
and/or contact the folk at gene...@gump.apache.org.

Project tomcat-tc8.0.x has an issue affecting its community integration.
This issue affects 4 projects,
  and has been outstanding for 3 runs.
The current state of this project is 'Failed', with reason 'Missing Build 
Outputs'.


I removed lib/tomcat-spdy.jarfrom the list of expected outputs for TC 8.

Regards,

Rainer


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



buildbot exception in ASF Buildbot on tomcat-trunk

2015-04-09 Thread buildbot
The Buildbot has detected a build exception on builder tomcat-trunk while 
building ASF Buildbot. Full details are available at:
http://ci.apache.org/builders/tomcat-trunk/builds/1118

Buildbot URL: http://ci.apache.org/

Buildslave for this Build: silvanus_ubuntu

Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-commit' 
triggered this build
Build Source Stamp: [branch tomcat/trunk] 1672393
Blamelist: markt

BUILD FAILED: exception upload_2

Sincerely,
 -The Buildbot




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



svn commit: r1672312 - in /tomcat/trunk/java/org/apache/coyote: ./ ajp/ http11/ http11/filters/ spdy/

2015-04-09 Thread markt
Author: markt
Date: Thu Apr  9 12:33:37 2015
New Revision: 1672312

URL: http://svn.apache.org/r1672312
Log:
Remove unused parameter passed around a whole bunch of code.
Discovered while fixing Java 8 Javadoc issues with InputBuffer when I wondered 
what the Request parameter was for. Answer: in this case, nothing!

Modified:
tomcat/trunk/java/org/apache/coyote/InputBuffer.java
tomcat/trunk/java/org/apache/coyote/Request.java
tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
tomcat/trunk/java/org/apache/coyote/http11/Http11InputBuffer.java
tomcat/trunk/java/org/apache/coyote/http11/InputFilter.java
tomcat/trunk/java/org/apache/coyote/http11/filters/BufferedInputFilter.java
tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java
tomcat/trunk/java/org/apache/coyote/http11/filters/IdentityInputFilter.java

tomcat/trunk/java/org/apache/coyote/http11/filters/SavedRequestInputFilter.java
tomcat/trunk/java/org/apache/coyote/http11/filters/VoidInputFilter.java
tomcat/trunk/java/org/apache/coyote/spdy/SpdyProcessor.java

Modified: tomcat/trunk/java/org/apache/coyote/InputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/InputBuffer.java?rev=1672312r1=1672311r2=1672312view=diff
==
--- tomcat/trunk/java/org/apache/coyote/InputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/InputBuffer.java Thu Apr  9 12:33:37 
2015
@@ -14,30 +14,24 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 package org.apache.coyote;
 
 import java.io.IOException;
 
 import org.apache.tomcat.util.buf.ByteChunk;
 
-
 /**
- * Input buffer.
- *
- * This class is used only in the protocol implementation. All reading from
- * Tomcat ( or adapter ) should be done using Request.doRead().
+ * This class is only for internal use in the protocol implementation. All
+ * reading from Tomcat (or adapter) should be done using Request.doRead().
  */
 public interface InputBuffer {
 
-
-/** Return from the input stream.
+/**
+ * Read from the input
+ * Return from the input stream.
 IMPORTANT: the current model assumes that the protocol will 'own' the
 buffer and return a pointer to it in ByteChunk ( i.e. the param will
 have chunk.getBytes()==null before call, and the result after the call 
).
 */
-public int doRead(ByteChunk chunk, Request request)
-throws IOException;
-
-
+public int doRead(ByteChunk chunk) throws IOException;
 }

Modified: tomcat/trunk/java/org/apache/coyote/Request.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/Request.java?rev=1672312r1=1672311r2=1672312view=diff
==
--- tomcat/trunk/java/org/apache/coyote/Request.java (original)
+++ tomcat/trunk/java/org/apache/coyote/Request.java Thu Apr  9 12:33:37 2015
@@ -464,9 +464,8 @@ public final class Request {
  * InputStream, this interface allows the app to process data in place, 
without copy.
  *
  */
-public int doRead(ByteChunk chunk)
-throws IOException {
-int n = inputBuffer.doRead(chunk, this);
+public int doRead(ByteChunk chunk) throws IOException {
+int n = inputBuffer.doRead(chunk);
 if (n  0) {
 bytesRead+=n;
 }

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java?rev=1672312r1=1672311r2=1672312view=diff
==
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java Thu Apr  9 
12:33:37 2015
@@ -37,7 +37,6 @@ import org.apache.coyote.AsyncContextCal
 import org.apache.coyote.ErrorState;
 import org.apache.coyote.InputBuffer;
 import org.apache.coyote.OutputBuffer;
-import org.apache.coyote.Request;
 import org.apache.coyote.RequestInfo;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
@@ -1589,7 +1588,7 @@ public class AjpProcessor extends Abstra
  * Read bytes into the specified chunk.
  */
 @Override
-public int doRead(ByteChunk chunk, Request req) throws IOException {
+public int doRead(ByteChunk chunk) throws IOException {
 
 if (endOfStream) {
 return -1;

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11InputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11InputBuffer.java?rev=1672312r1=1672311r2=1672312view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/Http11InputBuffer.java (original)

svn commit: r1672329 - in /tomcat/trunk/java/org/apache/tomcat/util/net: AbstractJsseEndpoint.java Nio2Endpoint.java NioEndpoint.java

2015-04-09 Thread markt
Author: markt
Date: Thu Apr  9 13:05:23 2015
New Revision: 1672329

URL: http://svn.apache.org/r1672329
Log:
Insert an additional class into the Endpoint class structure for JSSE specific 
stuff common to NIO and NIO2. The is primarily intended for SNI.

Added:
tomcat/trunk/java/org/apache/tomcat/util/net/AbstractJsseEndpoint.java   
(with props)
Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

Added: tomcat/trunk/java/org/apache/tomcat/util/net/AbstractJsseEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AbstractJsseEndpoint.java?rev=1672329view=auto
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/AbstractJsseEndpoint.java 
(added)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/AbstractJsseEndpoint.java Thu 
Apr  9 13:05:23 2015
@@ -0,0 +1,21 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the License); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an AS IS BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tomcat.util.net;
+
+public abstract class AbstractJsseEndpointS extends AbstractEndpointS {
+
+}

Propchange: 
tomcat/trunk/java/org/apache/tomcat/util/net/AbstractJsseEndpoint.java
--
svn:eol-style = native

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=1672329r1=1672328r2=1672329view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Thu Apr  9 
13:05:23 2015
@@ -14,7 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 package org.apache.tomcat.util.net;
 
 import java.io.EOFException;
@@ -63,7 +62,7 @@ import org.apache.tomcat.util.net.jsse.N
 /**
  * NIO2 endpoint.
  */
-public class Nio2Endpoint extends AbstractEndpointNio2Channel {
+public class Nio2Endpoint extends AbstractJsseEndpointNio2Channel {
 
 
 // -- Constants

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1672329r1=1672328r2=1672329view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Thu Apr  9 
13:05:23 2015
@@ -14,7 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 package org.apache.tomcat.util.net;
 
 import java.io.File;
@@ -72,7 +71,7 @@ import org.apache.tomcat.util.net.jsse.N
  * @author Mladen Turk
  * @author Remy Maucherat
  */
-public class NioEndpoint extends AbstractEndpointNioChannel {
+public class NioEndpoint extends AbstractJsseEndpointNioChannel {
 
 
 // -- Constants



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



Re: Reg: Bug 56438

2015-04-09 Thread Pravallika Peddi
Hi Mark,



I can add the Boolean variable at ContextConfig class level so that all
pluggability scans can access it and set the value accordingly.

Almost all web-inf/lib/class scans are internally calling
“processAnnotationsStream()” method of ContextConfig.java. So in this
method I can change the Boolean variable to true if annotations are found.



Here the problem is:   In case if a JAR is unnecessarily processed we can
ask user to add that jAR under “JarsToSkip” property. But in case if a
class file is scanned unnecessarily, we cannot ask user to add it under
“JARsToSkip” property.



So I felt there is no point in handling for class scans.



Please correct me if my understanding is wrong.



Thanks,
Pravallika(VIN)

On Thu, Apr 9, 2015 at 1:10 PM, Mark Thomas ma...@apache.org wrote:

 On 08/04/2015 14:07, Pravallika Peddi wrote:
  Hi Mark,
 
  *Fix for Pluggability Scan in Tomcat 7.0:  *

 You have only addressed fragment scanning. You have not addressed the
 other scans such as class scanning which are part of the pluggability
 scanning process.

 I agree adding a flag to track if a patch is found is the way to solve
 this. I disagree with where you have placed it. It needs to be somewhere
 that is accessible for all types of pluggability scans.

 Mark

 
 
 
  1)  Org.apache.catalina.startup.ContextConfig.java  à
  processJarsForWebFragments(WebXml application)
 
 
 
  FragmentJarScannerCallbackcallback =
 
  *new*FragmentJarScannerCallback(parseRequired);
 
 
 
  jarScanner.scan(context.getServletContext(),
 
  context.getLoader().getClassLoader(), callback,
 
  /pluggabilityJarsToSkip/);
 
 
 
  *if*(callback.scanFoundNoFragments()){
 
 
  /log/.info(/sm/.getString(contextConfig.NoFragmentSummary));
 
}
 
 
 
 
 
  2)  In Org.apache.catalina.startup.ContextConfig.java à
  FragmentJarScannerCallbackinner class:
 
 
 
  Add new Boolean variable:
 
  private boolean fragmentFoundInJar = false;
 
 
 
  *Create a method to return the variable status.*
 
  *public**boolean*scanFoundNoFragments(){
 
  *return*!fragmentFoundInJar;
 
  }
 
 
 
  Attached the class file with fix.
 
 
  Thanks,
 
  Pravallika(VIN)
 
 
  On Sun, Mar 29, 2015 at 4:07 AM, Mark Thomas ma...@apache.org
  mailto:ma...@apache.org wrote:
 
  On 26/03/2015 13:27, Pravallika Peddi wrote:
 
  snip/
 
   1) As mentioned in bug, in Tomcat7.0 catalina.properties file
 first 4
   default jars(except jdom.jar) are missing:
 commons-discovery-*.jar,commons-el-*.jar,commons-net-*.jar
  
We can add them under
   “tomcat.util.scan.DefaultJarScanner.jarsToSkip”
 
  jdom.jar isn't covered by the existing filters.
 
  snip/
 
   3)   3)  So I am planning to provide a fix as below for
 Tomcat 7.0
   TLD scan:
 
  Looks OK so far.
 
  snip/
 
   But in Tomcat 7.0, StandardJarScanner.scan  method only called
 from both
   TldConfig.java and ContextConfig.java. So I am afraid I cannot add
 the
   Summary message in Tomcat7.0. When User enables FINE  level then
 only they
   can see the noTldInJar messages
 
  Look again. It certainly is possible to add the summary message for
 TLDs
  in Tomcat 7.
 
   4) Tomcat7.0 ContextConfig scan is taking less time, hence I feel
 we can
   ignore it for now.
 
  I disagree. The pluggability scanning can add a significant start-up
  delay to web applications. The reason that the bug report was opened
 in
  the first place is the time taken for the pluggability scans.
 
   Please let me know your opinion.
 
  I think you have some more research to do.
 
  Mark
 
 
  -
  To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
  mailto:dev-unsubscr...@tomcat.apache.org
  For additional commands, e-mail: dev-h...@tomcat.apache.org
  mailto: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 56438] If jar scan does not find context config or TLD config, log a message

2015-04-09 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=56438

--- Comment #4 from Justin Cranford justincranf...@hotmail.com ---
The patch sounds great. Three small suggestions to make it just a little
better:

1) Can you add a debug message to show positive matches? Logging negative
matches is very useful since Tomcat's configuration uses exclusion filters, but
in hindsight I think showing the positive matches too gives the developer more
visibility into how many jars contain newer servlet 3.0 pieces. For example, if
they notice multiple jars with fragments but offering similar functionality,
they could decide to refactor their application to eliminate a few of those
jars for a little more start up performance.

2) Is it possible to log a message at the end of scanning to show
positive/negative match totals? I would recommend warning log level if either
negative match total is 0, otherwise info or debug level. A warning seems
appropriate here since unnecessary jar scanning has such a huge negative impact
on startup performance. It would not overwhelm a new user, it gives them
valuable feedback to optimize startup times using your new debug messages, and
it would disappear automatically after they add all the necessary exclusion
filters.

3) If you just added 1) and 2) that would be more than enough. However, you
could go a step further and use your code to identify common jar files that
should be filtered. If you added some of them to the default exclusion filters
in catalina.properties then new users would get greater performance out of
default installs.

-- 
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: Reg: Bug 56438

2015-04-09 Thread Mark Thomas
On 08/04/2015 11:20, Pravallika Peddi wrote:
 Hi Mark, 
 
 
 Highlighted code is the Fix to add summary message to *Tomcat7.0*:

Patches should be in diff -u format and are best attached to bug reports.

Mark

 
 
 In org.apache.catalina.startup.TldConfig.java à 
 
  
 
 a)  Return a Boolean variable from tldScanJar(JarURLConnection
 jarConn)method which indicates tld found or not.
 
 b)  In  TldJarScannerCallback inner class à add code a sbelow:
 
   
 
  boolean isFound = false;
 
  
 
  @Override
 
 public void scan(JarURLConnection urlConn) throws IOException {
 
 log.info http://log.info(Scanning jar in scan function: +
 urlConn);
 
 isFound = tldScanJar(urlConn);
 
 }
 
  
 
 @Override
 
 public void scan(File file) {
 
 File metaInf = new File(file, META-INF);   
 
 if (metaInf.isDirectory()) {
 
 isFound = tldScanDir(metaInf);
 
 }
 
 }
 

 
 private boolean scanFoundNoTLDs() {
 
 log.info http://log.info(tldFound at end: + isFound);
 
 return !isFound;
 
 }
 
  
 
  
 
 c)   In execute() method add below code:
 
  
 
 TldJarScannerCallback objCallBack = *new*TldJarScannerCallback();
 
  jarScanner.scan(context.getServletContext(),
 
 context.getLoader().getClassLoader(),
 
 objCallBack, /noTldJars/);
 

 
 *if*(objCallBack.scanFoundNoTLDs()){
 
 /log/.info(/sm/.getString(tldConfig.noTldSummary));
 
 }
 
 
 
 I tested the fix and Summary message is getting added to log.
 
 Attached the java file that contains these changes.
 
 Please review and let me know if the fix is ok or not.
 
 
 I will send another mail for pluggability scan fix details for Tomcat7.0
 
 
 Thanks,
 
 Pravallika (VIN)
 
 
 On Sun, Mar 29, 2015 at 4:07 AM, Mark Thomas ma...@apache.org
 mailto:ma...@apache.org wrote:
 
 On 26/03/2015 13:27, Pravallika Peddi wrote:
 
 snip/
 
  1) As mentioned in bug, in Tomcat7.0 catalina.properties file first 
 4
  default jars(except jdom.jar) are missing:
commons-discovery-*.jar,commons-el-*.jar,commons-net-*.jar
 
   We can add them under
  “tomcat.util.scan.DefaultJarScanner.jarsToSkip”
 
 jdom.jar isn't covered by the existing filters.
 
 snip/
 
  3)   3)  So I am planning to provide a fix as below for Tomcat 
 7.0
  TLD scan:
 
 Looks OK so far.
 
 snip/
 
  But in Tomcat 7.0, StandardJarScanner.scan  method only called from both
  TldConfig.java and ContextConfig.java. So I am afraid I cannot add the
  Summary message in Tomcat7.0. When User enables FINE  level then only 
 they
  can see the noTldInJar messages
 
 Look again. It certainly is possible to add the summary message for TLDs
 in Tomcat 7.
 
  4) Tomcat7.0 ContextConfig scan is taking less time, hence I feel we can
  ignore it for now.
 
 I disagree. The pluggability scanning can add a significant start-up
 delay to web applications. The reason that the bug report was opened in
 the first place is the time taken for the pluggability scans.
 
  Please let me know your opinion.
 
 I think you have some more research to do.
 
 Mark
 
 
 -
 To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
 mailto:dev-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: dev-h...@tomcat.apache.org
 mailto: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 57108] Implement multiple sslcontext SNI (server name indication) dispatch

2015-04-09 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=57108

--- Comment #12 from Mark Thomas ma...@apache.org ---
Keeping the config at the connector level is probably the way to go. There are
weird and wonderful configuration possibilities like one Connector on one
interface with one set of certs for internal users and another connector on
another interface with another set of certs for external users that share the
same hosts.

I think we should keep the TLS cert - host name mapping completely
independent from the Host - host name mapping. Most folks will have them
aligned but some will want to do soemthign different. Using Alias.../Alias
should allow some config copy/paste for those that want to.

SNI is mandatory for HTTP/2 so this has just jumped to the top of my TODO list.

I'm thinking along the lines of the the configuration style in comment#7.

I've also been thinking about trying to merge the JSSE and OpenSSL
configuration attributes. I'm not sure if it will work but the idea is to
deprecate setting these on the connector and add a defaultTLSAlias= element
to the Connector that references the cert to use if nothing else matches. If
the existing configuration attributes are used on the Connector then they are
mapped to a TLSAlias element with a pre-defined name (probably default or
something similar), along with a deprecated config warning.

I don't know how feasible this merging plan is but if it works, in addition to
simpler config, it should allow further simplification of the Http11*Protocol
implementations.

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



Fix submitted for bug 56438

2015-04-09 Thread Pravallika Peddi
Hi Mark,
I have submitted a fix for 56438 bug for Tomcat7.
Can you help review it and let me know?

Thanks in advance.


Regards,
Pravallika(VIN)


buildbot success in ASF Buildbot on tomcat-7-trunk

2015-04-09 Thread buildbot
The Buildbot has detected a restored build on builder tomcat-7-trunk while 
building ASF Buildbot. Full details are available at:
http://ci.apache.org/builders/tomcat-7-trunk/builds/617

Buildbot URL: http://ci.apache.org/

Buildslave for this Build: silvanus_ubuntu

Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-7-commit' 
triggered this build
Build Source Stamp: [branch tomcat/tc7.0.x/trunk] 1672286
Blamelist: rjung

Build succeeded!

Sincerely,
 -The Buildbot




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



Re: Reg: Bug 56438

2015-04-09 Thread Mark Thomas
On 08/04/2015 14:07, Pravallika Peddi wrote:
 Hi Mark,
 
 *Fix for Pluggability Scan in Tomcat 7.0:  *

You have only addressed fragment scanning. You have not addressed the
other scans such as class scanning which are part of the pluggability
scanning process.

I agree adding a flag to track if a patch is found is the way to solve
this. I disagree with where you have placed it. It needs to be somewhere
that is accessible for all types of pluggability scans.

Mark

 
  
 
 1)  Org.apache.catalina.startup.ContextConfig.java  à
 processJarsForWebFragments(WebXml application)
 
  
 
 FragmentJarScannerCallbackcallback =
 
 *new*FragmentJarScannerCallback(parseRequired);
 
  
 
 jarScanner.scan(context.getServletContext(),
 
 context.getLoader().getClassLoader(), callback,
 
 /pluggabilityJarsToSkip/);
 
   
 
 *if*(callback.scanFoundNoFragments()){
 
 /log/.info(/sm/.getString(contextConfig.NoFragmentSummary));
 
   }
 
  
 
  
 
 2)  In Org.apache.catalina.startup.ContextConfig.java à
 FragmentJarScannerCallbackinner class:
 
  
 
 Add new Boolean variable:
 
 private boolean fragmentFoundInJar = false;
 
  
 
 *Create a method to return the variable status.*
 
 *public**boolean*scanFoundNoFragments(){
 
 *return*!fragmentFoundInJar;
 
 }
 
  
 
 Attached the class file with fix.
 
 
 Thanks,
 
 Pravallika(VIN)
 
 
 On Sun, Mar 29, 2015 at 4:07 AM, Mark Thomas ma...@apache.org
 mailto:ma...@apache.org wrote:
 
 On 26/03/2015 13:27, Pravallika Peddi wrote:
 
 snip/
 
  1) As mentioned in bug, in Tomcat7.0 catalina.properties file first 
 4
  default jars(except jdom.jar) are missing:
commons-discovery-*.jar,commons-el-*.jar,commons-net-*.jar
 
   We can add them under
  “tomcat.util.scan.DefaultJarScanner.jarsToSkip”
 
 jdom.jar isn't covered by the existing filters.
 
 snip/
 
  3)   3)  So I am planning to provide a fix as below for Tomcat 
 7.0
  TLD scan:
 
 Looks OK so far.
 
 snip/
 
  But in Tomcat 7.0, StandardJarScanner.scan  method only called from both
  TldConfig.java and ContextConfig.java. So I am afraid I cannot add the
  Summary message in Tomcat7.0. When User enables FINE  level then only 
 they
  can see the noTldInJar messages
 
 Look again. It certainly is possible to add the summary message for TLDs
 in Tomcat 7.
 
  4) Tomcat7.0 ContextConfig scan is taking less time, hence I feel we can
  ignore it for now.
 
 I disagree. The pluggability scanning can add a significant start-up
 delay to web applications. The reason that the bug report was opened in
 the first place is the time taken for the pluggability scans.
 
  Please let me know your opinion.
 
 I think you have some more research to do.
 
 Mark
 
 
 -
 To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
 mailto:dev-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: dev-h...@tomcat.apache.org
 mailto: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



Re: svn commit: r1672272 - /tomcat/trunk/bin/catalina.sh

2015-04-09 Thread Rainer Jung

Am 09.04.2015 um 11:57 schrieb Konstantin Kolinko:

2015-04-09 12:24 GMT+03:00  rj...@apache.org:

Author: rjung
Date: Thu Apr  9 09:24:49 2015
New Revision: 1672272

URL: http://svn.apache.org/r1672272
Log:
BZ57801: Give a hint on what to do.

This might happen, if a system reboot happens,
Tomcat is not shut down properly and another
process reuses the PID after the reboot, before
Tomcat is being started.

Modified:
 tomcat/trunk/bin/catalina.sh

Modified: tomcat/trunk/bin/catalina.sh
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/bin/catalina.sh?rev=1672272r1=1672271r2=1672272view=diff
==
--- tomcat/trunk/bin/catalina.sh (original)
+++ tomcat/trunk/bin/catalina.sh Thu Apr  9 09:24:49 2015
@@ -342,6 +342,7 @@ elif [ $1 = start ] ; then
ps -p $PID /dev/null 21
if [ $? -eq 0 ] ; then
  echo Tomcat appears to still be running with PID $PID. Start 
aborted.
+echo If this process is not a Tomcat process, remove the PID file and 
try again.
  exit 1
else
  echo Removing/clearing stale PID file.


Maybe provide additional information?

a) Information on the process?  (ps .. ?)


Will do using ps -f -p $PID which seems to be standards compliant and 
at least works on some Linux I tested, Solaris and FreeBSD.


Example output:

 UID   PID  PPID   CSTIME TTY TIME CMD
jung 10743 1   0 10:59:23 pts/1   0:26 
/usr/local/jdk1.8.0/bin/java -Dapp.id=jmeter.bank-api -jar 
/shared/build/dev/jm


Solaris truncates the CMD field (like in this example), Linux and 
FreeBSD seem to show the full one.



b) Path to the PID file.


Path the the PID file is printed further up when the script starts 
Using CATALINA_PID: 


Regards,

Rainer

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



[Bug 57801] New: Tomcat catalina.sh fails to start after machine is reboot because there is another process have the same PID as Tomcat before reboot

2015-04-09 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=57801

Bug ID: 57801
   Summary: Tomcat catalina.sh fails to start  after machine is
reboot because there is another process have the same
PID as Tomcat before reboot
   Product: Tomcat 8
   Version: 8.0.21
  Hardware: PC
OS: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: Catalina
  Assignee: dev@tomcat.apache.org
  Reporter: jia...@gmail.com

We have set CATALINA_PID in setenv.sh.

After the machine is reboot, The PID file is still there and tomcat fails to
start. 

The error message is: 
Existing PID file found during start.
Tomcat appears to still be running with PID 3387. Start aborted.

After checking, there is another process have the same PID: 3387.

After checking the code catalina.sh, the following logic has issue:


  if [ ! -z $CATALINA_PID ]; then
if [ -f $CATALINA_PID ]; then
  if [ -s $CATALINA_PID ]; then
echo Existing PID file found during start.
if [ -r $CATALINA_PID ]; then
  PID=`cat $CATALINA_PID`
  ps -p $PID /dev/null 21
  if [ $? -eq 0 ] ; then
echo Tomcat appears to still be running with PID $PID. Start
aborted.
exit 1
  else


Tomcat should not treat tomcat is still alive.
The script should work anyway.

-- 
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: r1672272 - /tomcat/trunk/bin/catalina.sh

2015-04-09 Thread Konstantin Kolinko
2015-04-09 13:26 GMT+03:00 Rainer Jung rainer.j...@kippdata.de:
 Am 09.04.2015 um 11:57 schrieb Konstantin Kolinko:

 2015-04-09 12:24 GMT+03:00  rj...@apache.org:

 Author: rjung
 Date: Thu Apr  9 09:24:49 2015
 New Revision: 1672272

 URL: http://svn.apache.org/r1672272
 Log:
 BZ57801: Give a hint on what to do.

 This might happen, if a system reboot happens,
 Tomcat is not shut down properly and another
 process reuses the PID after the reboot, before
 Tomcat is being started.

 Modified:
  tomcat/trunk/bin/catalina.sh

 Modified: tomcat/trunk/bin/catalina.sh
 URL:
 http://svn.apache.org/viewvc/tomcat/trunk/bin/catalina.sh?rev=1672272r1=1672271r2=1672272view=diff

 ==
 --- tomcat/trunk/bin/catalina.sh (original)
 +++ tomcat/trunk/bin/catalina.sh Thu Apr  9 09:24:49 2015
 @@ -342,6 +342,7 @@ elif [ $1 = start ] ; then
 ps -p $PID /dev/null 21
 if [ $? -eq 0 ] ; then
   echo Tomcat appears to still be running with PID $PID.
 Start aborted.
 +echo If this process is not a Tomcat process, remove the
 PID file and try again.
   exit 1
 else
   echo Removing/clearing stale PID file.


 Maybe provide additional information?

 a) Information on the process?  (ps .. ?)


 Will do using ps -f -p $PID which seems to be standards compliant and at
 least works on some Linux I tested, Solaris and FreeBSD.

 Example output:

  UID   PID  PPID   CSTIME TTY TIME CMD
 jung 10743 1   0 10:59:23 pts/1   0:26
 /usr/local/jdk1.8.0/bin/java -Dapp.id=jmeter.bank-api -jar
 /shared/build/dev/jm

 Solaris truncates the CMD field (like in this example), Linux and FreeBSD
 seem to show the full one.

Looking into POSIX,  option -o formatname seems to be more standard than -f
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ps.html

Though Solaris is known for not following POSIX in some of its
utilities,  and using -f gives a more customary (=more usual) format
from user's point of view.  Thank you for testing on different OSes.

 b) Path to the PID file.


 Path the the PID file is printed further up when the script starts Using
 CATALINA_PID: 

Ack.

Though a caveat is that those Using... lines are only printed when
starting interactively (guarded by if [ $have_tty -eq 1 ];).

Best regards,
Konstantin Kolinko

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



[Bug 57801] Tomcat catalina.sh fails to start after machine is reboot because there is another process have the same PID as Tomcat before reboot

2015-04-09 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=57801

Rainer Jung rainer.j...@kippdata.de changed:

   What|Removed |Added

   Severity|normal  |enhancement
   Hardware|PC  |All

--- Comment #1 from Rainer Jung rainer.j...@kippdata.de ---
Either you should integrate your Tomcat stop (and probably start) into your
system shutdown/startup (rc scripts or whatever methodology your system uses)
or you rely on doing it by hand.

In the latter case, Tomcat does not get any info about the system shutdown and
can not react on it. Trying to find out whether the found process after reboot
actually is a Tomcat process or something else is not the task of the start
script.Integrating it will be error prone and hard to maintain cross platform.

If you start by hand and get the cited error, you need to check the other
process (like you did) and if it is something else and Tomcat is not running,
purge the old PID file.

We could probably make the message

Existing PID file found during start.
Tomcat appears to still be running with PID 3387. Start aborted.

a bit better

Existing PID file found during start.
Tomcat appears to still be running with PID 3387. Start aborted.
If the process with PID 3387 is not a Tomcat process, remove the PID file
NAME_OF_PID_FILE_HERE and try again.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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



svn commit: r1672274 - in /tomcat/tc7.0.x/trunk: ./ bin/catalina.sh webapps/docs/changelog.xml

2015-04-09 Thread rjung
Author: rjung
Date: Thu Apr  9 09:33:29 2015
New Revision: 1672274

URL: http://svn.apache.org/r1672274
Log:
BZ57801: Give a hint on what to do.

This might happen, if a system reboot happens,
Tomcat is not shut down properly and another
process reuses the PID after the reboot, before
Tomcat is being started.

Backport of r1672272 from trunk resp.
r1672273 from tc8.

Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/bin/catalina.sh
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Apr  9 09:33:29 2015
@@ -1,2 +1,2 @@
-/tomcat/tc8.0.x/trunk:1636525,1637336,1637685,1637709,1638726,1640089,1640276,1640349,1640363,1640366,1640642,1640672,1640674,1640689,1640884,1641001,1641065,1641067,1641375,1641638,1641723,1641726,1641729-1641730,1641736,1641988,1642669-1642670,1642698,1642701,1643205,1643215,1643217,1643230,1643232,1643273,1643285,1643329-1643330,1643511,1643513,1643521,1643539,1643571,1643581-1643582,1643635,1643655,1643738,1643964,1644018,1644333,1644954,1644992,1645014,1645360,1645456,1645627,1645642,1645686,1645903-1645904,1645908-1645909,1645913,1645920,1646458,1646460-1646462,1647043,1648816,1651420-1651422,1651844,1652939-1652940,1652973,1653798,1653817,1653841,1654042,1654161,1654736,1654767,1654787,1656592,1662986,1663265,1663278,1663325,1663535,1663567,1663679,1663997,1664175,1664321,1664872,1665061,1665086,1666027,1666395,1666503,1666506,1666560,1666570,1666581,1666759,1666967,1666988,1667553-1667555,1667558,1667617,1667633,1667637,1667747,1667767,1667873,1668028,1668137,1668634,1669432
 
,1669801,1669840,1669895-1669896,1670398,1670435,1670592,1670605-1670607,1670609,1670632,1670720,1670725,1670727,1670731,1671114
-/tomcat/trunk:1156115-1157160,1157162-1157859,1157862-1157942,1157945-1160347,1160349-1163716,1163718-1166689,1166691-1174340,1174342-1175596,1175598-1175611,1175613-1175932,1175934-1177783,1177785-1177980,1178006-1180720,1180722-1183094,1183096-1187753,1187755,1187775,1187801,1187806,1187809,1187826-1188312,1188314-1188401,1188646-1188840,1188842-1190176,1190178-1195223,1195225-1195953,1195955,1195957-1201238,1201240-1203345,1203347-1206623,1206625-1208046,1208073,1208096,1208114,1208145,1208772,1209194-1212125,1212127-1220291,1220293,1220295-1221321,1221323-1222329,1222332-1222401,1222405-1222795,1222850-1222950,1222969-1225326,1225328-1225463,1225465,1225627,1225629-1226534,1226536-1228908,1228911-1228923,1228927-1229532,1229534-1230766,1230768-1231625,1231627-1233414,1233419-1235207,1235209-1237425,1237427,1237429-1237977,1237981,1237985,1237995,1238070,1238073,1239024-1239048,1239050-1239062,1239135,1239256,1239258-1239485,1239785-1240046,1240101,1240106,1240109,1240112,1240114
 
,1240116,1240118,1240121,1240329,1240474-1240850,1240857,1241087,1241160,1241408-1241822,1241908-1241909,1241912-1242110,1242371-1292130,1292134-1292458,1292464-1292670,1292672-1292776,1292780-1293392,1293397-1297017,1297019-1297963,1297965-1299820,1300108,1300111-1300460,1300520-1300948,1300997,1301006,1301280,1302332,1302348,1302608-1302610,1302649,1302837,1303138,1303163,1303338,1303521,1303587,1303698,1303803,1303852,1304011,1304035,1304037,1304135,1304249,1304253,1304260,1304271,1304275,1304468,1304895,1304930-1304932,1305194,1305943,1305965,1306556,1306579-1306580,1307084,1307310,1307511-1307512,1307579,1307591,1307597,1310636,1310639-1310640,1310642,1310701,1311212,1311995,1327617,1327670,1331766,1333161,1333173,1333827,1334787,1335026,1335257,1335547,1335692,1335711,1335731,1336515,1336813,1336864,1336868,1336884,1337419,1337426,1337546,1337572,1337591-1337595,1337643,1337707,1337719,1337734,1337741,1337745,1338151-1338154,1338178,1342027,1342029,1342315,1342320,1342476,1342
 
498,1342503,1342717,1342795,1342805,1343044-1343046,1343335,1343394,1343400,1343629,1343708,1343718,1343895,1344063,1344068,1344250,1344266,1344515,1344528,1344612,1344629,1344725,1344868,1344890,1344893,1344896,1344901,1345020,1345029,1345039,1345287-1345290,1345294,1345309,1345325,1345357,1345367,1345579-1345580,1345582,1345688,1345699,1345704,1345731-1345732,1345737,1345744,1345752,1345754,1345779,1345781,1345846,1346107,1346365,1346376,1346404,1346510,1346514,1346519,1346581,1346635,1346644,1346683,1346794,1346885,1346932,1347034,1347047,1347087,1347108-1347109,1347583,1347737,1348105,1348357,1348398,1348425,1348461-1348495,1348498,1348752,1348762,1348772,1348776,1348859,1348968,1348973,1348989,1349007,1349237,1349298,1349317,1349410,1349473,1349539,1349879,1349887,1349893,1349922,1349984,1350124,1350241,1350243,1350294-1350295,1350299,1350864,1350900,1351010,1351054,1351056,1351068,1351134-1351135,1351148,1351259,1351604,1351636-1351640,1351991,1351993,1352011,1352056,1352059,1
 

svn commit: r1672492 - in /tomcat/trunk/java/org/apache/tomcat/util/net: LocalStrings.properties SNIExtractor.java SecureNioChannel.java

2015-04-09 Thread markt
Author: markt
Date: Thu Apr  9 21:15:11 2015
New Revision: 1672492

URL: http://svn.apache.org/r1672492
Log:
SNI refactoring for NIO.
Peek at the data but currently parsing the data is stubbed to report no 
hostname found.

Added:
tomcat/trunk/java/org/apache/tomcat/util/net/SNIExtractor.java   (with 
props)
Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/LocalStrings.properties
tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/LocalStrings.properties?rev=1672492r1=1672491r2=1672492view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/LocalStrings.properties 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/LocalStrings.properties Thu 
Apr  9 21:15:11 2015
@@ -94,6 +94,8 @@ channel.nio.ssl.wrapFail=Unable to wrap
 channel.nio.ssl.incompleteHandshake=Handshake incomplete, you must complete 
handshake before reading data.
 channel.nio.ssl.closing=Channel is in closing state.
 channel.nio.ssl.invalidBuffer=You can only read using the application read 
buffer provided by the handler.
+channel.nio.ssl.expandNetInBuffer=Expanding network input buffer to [{0}] bytes
+channel.nio.ssl.expandNetOutBuffer=Expanding network input buffer to [{0}] 
bytes
 
 socket.closed=The socket associated with this connection has been closed.
 

Added: tomcat/trunk/java/org/apache/tomcat/util/net/SNIExtractor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SNIExtractor.java?rev=1672492view=auto
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/SNIExtractor.java (added)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SNIExtractor.java Thu Apr  9 
21:15:11 2015
@@ -0,0 +1,59 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the License); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an AS IS BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tomcat.util.net;
+
+import java.nio.ByteBuffer;
+
+public class SNIExtractor {
+
+private final SNIResult result = SNIResult.NOT_PRESENT;
+private final String sniValue = null;
+
+public SNIExtractor(ByteBuffer netInBuffer) {
+// TODO: Detect use of http on a secure connection and provide a simple
+//   error page.
+
+int pos = netInBuffer.position();
+try {
+// TODO Parse the data
+
+} finally {
+// Whatever happens, return the buffer to its original state
+netInBuffer.limit(netInBuffer.capacity());
+netInBuffer.position(pos);
+}
+}
+
+public SNIResult getResult() {
+return result;
+}
+
+public String getSNIValue() {
+if (result == SNIResult.FOUND) {
+return sniValue;
+} else {
+throw new IllegalStateException();
+}
+}
+
+public static enum SNIResult {
+FOUND,
+NOT_PRESENT,
+UNDERFLOW,
+ERROR
+}
+}

Propchange: tomcat/trunk/java/org/apache/tomcat/util/net/SNIExtractor.java
--
svn:eol-style = native

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java?rev=1672492r1=1672491r2=1672492view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java Thu Apr  
9 21:15:11 2015
@@ -28,16 +28,23 @@ import javax.net.ssl.SSLEngine;
 import javax.net.ssl.SSLEngineResult;
 import javax.net.ssl.SSLEngineResult.HandshakeStatus;
 import javax.net.ssl.SSLEngineResult.Status;
-import javax.net.ssl.SSLException;
+
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
+import org.apache.tomcat.util.res.StringManager;
 
 /**
- *
  * Implementation of a secure socket channel
- * @version 1.0
  */
-
 public class 

[Bug 56438] If jar scan does not find context config or TLD config, log a message

2015-04-09 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=56438

--- Comment #5 from Mark Thomas ma...@apache.org ---
(In reply to VIN from comment #3)

 Please review my patch and let me know in case of any problems.

Part 1 looks generally OK. You need to use 4 spaces rather than tabs and I
agree with the idea in comment #4 to delog log matches and non-matches. I'm
less sure about a message with the counts. I think it is too noisy for info and
it the summary is debug then why bother since the individual messages are
there.

Part 2 needs works. Pluggability scans are more than just fragments and the
patch needs to take that into account.

Also keep in mind the changes are made to trunk first and then back-ported so
if the festure you are implementing isn't in trunk or 8.0.x then patches are
required for those versions too.

You might find it easier to deal with part 1 first and then part 2.

-- 
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: r1672437 - in /tomcat/trunk/java/org/apache/tomcat/util/net: NioEndpoint.java SecureNioChannel.java

2015-04-09 Thread markt
Author: markt
Date: Thu Apr  9 18:17:24 2015
New Revision: 1672437

URL: http://svn.apache.org/r1672437
Log:
SNI Refactoring. I'm doing this in small steps as I tried to do it a single go 
and got something wrong that broke secure connections.

Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1672437r1=1672436r2=1672437view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Thu Apr  9 
18:17:24 2015
@@ -465,7 +465,7 @@ public class NioEndpoint extends Abstrac
 
Math.max(appbufsize,socketProperties.getAppReadBufSize()),
 
Math.max(appbufsize,socketProperties.getAppWriteBufSize()),
 socketProperties.getDirectBuffer());
-channel = new SecureNioChannel(socket, engine, bufhandler, 
selectorPool);
+channel = new SecureNioChannel(socket, engine, bufhandler, 
selectorPool, this);
 } else {
 // normal tcp setup
 SocketBufferHandler bufhandler = new SocketBufferHandler(

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java?rev=1672437r1=1672436r2=1672437view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java Thu Apr  
9 18:17:24 2015
@@ -52,18 +52,16 @@ public class SecureNioChannel extends Ni
 protected boolean closing = false;
 
 protected NioSelectorPool pool;
+private final NioEndpoint endpoint;
 
 public SecureNioChannel(SocketChannel channel, SSLEngine engine, 
SocketBufferHandler bufHandler,
-NioSelectorPool pool) {
+NioSelectorPool pool, NioEndpoint endpoint) {
 super(channel,bufHandler);
 this.sslEngine = engine;
-int netBufSize = sslEngine.getSession().getPacketBufferSize();
-//allocate network buffers - TODO, add in optional direct non-direct 
buffers
-if ( netInBuffer == null ) netInBuffer = 
ByteBuffer.allocateDirect(netBufSize);
-if ( netOutBuffer == null ) netOutBuffer = 
ByteBuffer.allocateDirect(netBufSize);
 
-//selector pool for blocking operations
+// selector pool for blocking operations
 this.pool = pool;
+this.endpoint = endpoint;
 }
 
 public void reset(SSLEngine engine) throws IOException {
@@ -74,10 +72,6 @@ public class SecureNioChannel extends Ni
 @Override
 public void reset() throws IOException {
 super.reset();
-netOutBuffer.position(0);
-netOutBuffer.limit(0);
-netInBuffer.position(0);
-netInBuffer.limit(0);
 sniComplete = false;
 handshakeComplete = false;
 closed = false;
@@ -223,6 +217,46 @@ public class SecureNioChannel extends Ni
  * provided host name, configure the SSLEngine for this connection.
  */
 private int processSNI() throws SSLException {
+// TODO The peek at the available data to determine the host requested
+//  via SNI (if any) goes here.
+
+SocketProperties sp = endpoint.getSocketProperties();
+// Create/expand network buffers.
+// In/Out are always created in a pair with identical settings so only
+// need to test one to determine what needs to be done for both.
+int netBufSize = sslEngine.getSession().getPacketBufferSize();
+if (netInBuffer == null) {
+if (sp.getDirectSslBuffer()) {
+netInBuffer = ByteBuffer.allocateDirect(netBufSize);
+netOutBuffer = ByteBuffer.allocateDirect(netBufSize);
+} else {
+netInBuffer = ByteBuffer.allocate(netBufSize);
+netOutBuffer = ByteBuffer.allocate(netBufSize);
+}
+} else if (netInBuffer.capacity()  netBufSize) {
+// Need to expand the buffers, making sure no data is lost.
+ByteBuffer newInBuffer;
+ByteBuffer newOutBuffer;
+if (sp.getDirectSslBuffer()) {
+newInBuffer = ByteBuffer.allocateDirect(netBufSize);
+newOutBuffer = ByteBuffer.allocateDirect(netBufSize);
+} else {
+newInBuffer = ByteBuffer.allocate(netBufSize);
+newOutBuffer = ByteBuffer.allocate(netBufSize);
+}
+

svn commit: r1672273 - in /tomcat/tc8.0.x/trunk: ./ bin/catalina.sh webapps/docs/changelog.xml

2015-04-09 Thread rjung
Author: rjung
Date: Thu Apr  9 09:30:52 2015
New Revision: 1672273

URL: http://svn.apache.org/r1672273
Log:
BZ57801: Give a hint on what to do.

This might happen, if a system reboot happens,
Tomcat is not shut down properly and another
process reuses the PID after the reboot, before
Tomcat is being started.

Backport of r1672272 from trunk.

Modified:
tomcat/tc8.0.x/trunk/   (props changed)
tomcat/tc8.0.x/trunk/bin/catalina.sh
tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc8.0.x/trunk/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Apr  9 09:30:52 2015
@@ -1 +1 @@
-/tomcat/trunk:1636524,1637156,1637176,1637188,1637331,1637684,1637695,1638720-1638725,1639653,1640010,1640083-1640084,1640088,1640275,1640322,1640347,1640361,1640365,1640403,1640410,1640652,1640655-1640658,1640688,1640700-1640883,1640903,1640976,1640978,1641000,1641026,1641038-1641039,1641051-1641052,1641058,1641064,1641300,1641369,1641374,1641380,1641486,1641634,1641656-1641692,1641704,1641707-1641718,1641720-1641722,1641735,1641981,1642233,1642280,1642554,1642564,1642595,1642606,1642668,1642679,1642697,1642699,1642766,1643002,1643045,1643054-1643055,1643066,1643121,1643128,1643206,1643209-1643210,1643216,1643249,1643270,1643283,1643309-1643310,1643323,1643365-1643366,1643370-1643371,1643465,1643474,1643536,1643570,1643634,1643649,1643651,1643654,1643675,1643731,1643733-1643734,1643761,1643766,1643814,1643937,1643963,1644017,1644169,1644201-1644203,1644321,1644323,1644516,1644523,1644529,1644535,1644730,1644768,1644784-1644785,1644790,1644793,1644815,1644884,1644886,1644890,1644892
 
,1644910,1644924,1644929-1644930,1644935,1644989,1645011,1645247,1645355,1645357-1645358,1645455,1645465,1645469,1645471,1645473,1645475,1645486-1645488,1645626,1645641,1645685,1645743,1645763,1645951-1645953,1645955,1645993,1646098-1646106,1646178,1646220,1646302,1646304,1646420,1646470-1646471,1646476,1646559,1646717-1646723,1646773,1647026,1647042,1647530,1647655,1648304,1648815,1648907,1650081,1650365,1651116,1651120,1651280,1651470,1652938,1652970,1653041,1653471,1653550,1653574,1653797,1653815-1653816,1653819,1653840,1653857,1653888,1653972,1654013,1654030,1654050,1654123,1654148,1654159,1654513,1654515,1654517,1654522,1654524,1654725,1654735,1654766,1654785,1654851-1654852,1654978,1655122-1655124,1655126-1655127,1655129-1655130,1655132-1655133,1655312,1655438,1655441,1655454,168,1656087,1656299,1656319,1656331,1656345,1656350,1656590,1656648-1656650,1656657,1657041,1657054,1657374,1657492,1657510,1657565,1657580,1657584,1657586,1657589,1657592,1657607,1657609,1657682,1657
 
907,1658207,1658734,1658781,1658790,1658799,1658802,1658804,1658833,1658840,1658966,1659043,1659053,1659059,1659188-1659189,1659216,1659263,1659293,1659304,1659306-1659307,1659382,1659384,1659428,1659471,1659486,1659505,1659516,1659521,1659524,1659559,1659562,1659803,1659806,1659814,1659833,1659862,1659905,1659919,1659948,1659967,1659983-1659984,1660060,1660074,1660077,1660133,1660168,1660331-1660332,1660353,1660358,1660924,1661386,1661867,1661972,1661990,1662200,1662308-1662309,1662548,1662614,1662736,1662985,1662988-1662989,1663264,1663277,1663298,1663534,1663562,1663676,1663715,1663754,1663768,1663772,1663781,1663893,1663995,1664143,1664163,1664174,1664301,1664317,1664347,1664657,1664659,1664710,1664863-1664864,1664866,1665085,1665292,1665559,1665653,1665661,1665672,1665694,1665697,1665736,1665779,1665976-1665977,1665980-1665981,1665985-1665986,1665989,1665998,1666004,1666008,1666013,1666017,1666024,1666116,1666386-1666387,1666494,1666496,1666552,1666569,1666579,137,149,1
 
666757,1666966,1666972,1666985,1666995,1666997,1667292,1667402,1667406,1667546,1667615,1667630,1667636,1667688,1667764,1667871,1668026,1668135,1668193,1668593,1668596,1668630,1668639,1668843,1669353,1669370,1669451,1669800,1669838,1669876,1669882,1670394,1670433,1670591,1670598-1670600,1670610,1670631,1670719,1670724,1670726,1670730,1670940,1671112

svn commit: r1672285 - in /tomcat/tc8.0.x/trunk: ./ bin/catalina.sh

2015-04-09 Thread rjung
Author: rjung
Date: Thu Apr  9 10:31:09 2015
New Revision: 1672285

URL: http://svn.apache.org/r1672285
Log:
More hints about process using the PID.

Backport of r1672284 from trunk.

Modified:
tomcat/tc8.0.x/trunk/   (props changed)
tomcat/tc8.0.x/trunk/bin/catalina.sh

Propchange: tomcat/tc8.0.x/trunk/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Apr  9 10:31:09 2015
@@ -1 +1 @@
-/tomcat/trunk:1636524,1637156,1637176,1637188,1637331,1637684,1637695,1638720-1638725,1639653,1640010,1640083-1640084,1640088,1640275,1640322,1640347,1640361,1640365,1640403,1640410,1640652,1640655-1640658,1640688,1640700-1640883,1640903,1640976,1640978,1641000,1641026,1641038-1641039,1641051-1641052,1641058,1641064,1641300,1641369,1641374,1641380,1641486,1641634,1641656-1641692,1641704,1641707-1641718,1641720-1641722,1641735,1641981,1642233,1642280,1642554,1642564,1642595,1642606,1642668,1642679,1642697,1642699,1642766,1643002,1643045,1643054-1643055,1643066,1643121,1643128,1643206,1643209-1643210,1643216,1643249,1643270,1643283,1643309-1643310,1643323,1643365-1643366,1643370-1643371,1643465,1643474,1643536,1643570,1643634,1643649,1643651,1643654,1643675,1643731,1643733-1643734,1643761,1643766,1643814,1643937,1643963,1644017,1644169,1644201-1644203,1644321,1644323,1644516,1644523,1644529,1644535,1644730,1644768,1644784-1644785,1644790,1644793,1644815,1644884,1644886,1644890,1644892
 
,1644910,1644924,1644929-1644930,1644935,1644989,1645011,1645247,1645355,1645357-1645358,1645455,1645465,1645469,1645471,1645473,1645475,1645486-1645488,1645626,1645641,1645685,1645743,1645763,1645951-1645953,1645955,1645993,1646098-1646106,1646178,1646220,1646302,1646304,1646420,1646470-1646471,1646476,1646559,1646717-1646723,1646773,1647026,1647042,1647530,1647655,1648304,1648815,1648907,1650081,1650365,1651116,1651120,1651280,1651470,1652938,1652970,1653041,1653471,1653550,1653574,1653797,1653815-1653816,1653819,1653840,1653857,1653888,1653972,1654013,1654030,1654050,1654123,1654148,1654159,1654513,1654515,1654517,1654522,1654524,1654725,1654735,1654766,1654785,1654851-1654852,1654978,1655122-1655124,1655126-1655127,1655129-1655130,1655132-1655133,1655312,1655438,1655441,1655454,168,1656087,1656299,1656319,1656331,1656345,1656350,1656590,1656648-1656650,1656657,1657041,1657054,1657374,1657492,1657510,1657565,1657580,1657584,1657586,1657589,1657592,1657607,1657609,1657682,1657
 
907,1658207,1658734,1658781,1658790,1658799,1658802,1658804,1658833,1658840,1658966,1659043,1659053,1659059,1659188-1659189,1659216,1659263,1659293,1659304,1659306-1659307,1659382,1659384,1659428,1659471,1659486,1659505,1659516,1659521,1659524,1659559,1659562,1659803,1659806,1659814,1659833,1659862,1659905,1659919,1659948,1659967,1659983-1659984,1660060,1660074,1660077,1660133,1660168,1660331-1660332,1660353,1660358,1660924,1661386,1661867,1661972,1661990,1662200,1662308-1662309,1662548,1662614,1662736,1662985,1662988-1662989,1663264,1663277,1663298,1663534,1663562,1663676,1663715,1663754,1663768,1663772,1663781,1663893,1663995,1664143,1664163,1664174,1664301,1664317,1664347,1664657,1664659,1664710,1664863-1664864,1664866,1665085,1665292,1665559,1665653,1665661,1665672,1665694,1665697,1665736,1665779,1665976-1665977,1665980-1665981,1665985-1665986,1665989,1665998,1666004,1666008,1666013,1666017,1666024,1666116,1666386-1666387,1666494,1666496,1666552,1666569,1666579,137,149,1
 
666757,1666966,1666972,1666985,1666995,1666997,1667292,1667402,1667406,1667546,1667615,1667630,1667636,1667688,1667764,1667871,1668026,1668135,1668193,1668593,1668596,1668630,1668639,1668843,1669353,1669370,1669451,1669800,1669838,1669876,1669882,1670394,1670433,1670591,1670598-1670600,1670610,1670631,1670719,1670724,1670726,1670730,1670940,1671112,1672272
+/tomcat/trunk:1636524,1637156,1637176,1637188,1637331,1637684,1637695,1638720-1638725,1639653,1640010,1640083-1640084,1640088,1640275,1640322,1640347,1640361,1640365,1640403,1640410,1640652,1640655-1640658,1640688,1640700-1640883,1640903,1640976,1640978,1641000,1641026,1641038-1641039,1641051-1641052,1641058,1641064,1641300,1641369,1641374,1641380,1641486,1641634,1641656-1641692,1641704,1641707-1641718,1641720-1641722,1641735,1641981,1642233,1642280,1642554,1642564,1642595,1642606,1642668,1642679,1642697,1642699,1642766,1643002,1643045,1643054-1643055,1643066,1643121,1643128,1643206,1643209-1643210,1643216,1643249,1643270,1643283,1643309-1643310,1643323,1643365-1643366,1643370-1643371,1643465,1643474,1643536,1643570,1643634,1643649,1643651,1643654,1643675,1643731,1643733-1643734,1643761,1643766,1643814,1643937,1643963,1644017,1644169,1644201-1644203,1644321,1644323,1644516,1644523,1644529,1644535,1644730,1644768,1644784-1644785,1644790,1644793,1644815,1644884,1644886,1644890,1644892
 

Re: svn commit: r1672272 - /tomcat/trunk/bin/catalina.sh

2015-04-09 Thread Konstantin Kolinko
2015-04-09 12:24 GMT+03:00  rj...@apache.org:
 Author: rjung
 Date: Thu Apr  9 09:24:49 2015
 New Revision: 1672272

 URL: http://svn.apache.org/r1672272
 Log:
 BZ57801: Give a hint on what to do.

 This might happen, if a system reboot happens,
 Tomcat is not shut down properly and another
 process reuses the PID after the reboot, before
 Tomcat is being started.

 Modified:
 tomcat/trunk/bin/catalina.sh

 Modified: tomcat/trunk/bin/catalina.sh
 URL: 
 http://svn.apache.org/viewvc/tomcat/trunk/bin/catalina.sh?rev=1672272r1=1672271r2=1672272view=diff
 ==
 --- tomcat/trunk/bin/catalina.sh (original)
 +++ tomcat/trunk/bin/catalina.sh Thu Apr  9 09:24:49 2015
 @@ -342,6 +342,7 @@ elif [ $1 = start ] ; then
ps -p $PID /dev/null 21
if [ $? -eq 0 ] ; then
  echo Tomcat appears to still be running with PID $PID. Start 
 aborted.
 +echo If this process is not a Tomcat process, remove the PID 
 file and try again.
  exit 1
else
  echo Removing/clearing stale PID file.

Maybe provide additional information?

a) Information on the process?  (ps .. ?)
b) Path to the PID file.


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: r1672276 - /tomcat/tc6.0.x/trunk/STATUS.txt

2015-04-09 Thread rjung
Author: rjung
Date: Thu Apr  9 09:40:35 2015
New Revision: 1672276

URL: http://svn.apache.org/r1672276
Log:
Propose.

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=1672276r1=1672275r2=1672276view=diff
==
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Thu Apr  9 09:40:35 2015
@@ -38,6 +38,13 @@ PATCHES PROPOSED TO BACKPORT:
   +1: markt
   -1:
 
+* Improve catalina.sh error message, the PID read from the PID file during
+  startup is already taken by an existing process.
+  trunk: http://svn.apache.org/r1672272
+  tc8  : http://svn.apache.org/r1672273
+  tc7  : http://svn.apache.org/r1672274
+  +1: rjung
+  -1:
 
 PATCHES/ISSUES THAT ARE STALLED:
 



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



svn commit: r1672272 - /tomcat/trunk/bin/catalina.sh

2015-04-09 Thread rjung
Author: rjung
Date: Thu Apr  9 09:24:49 2015
New Revision: 1672272

URL: http://svn.apache.org/r1672272
Log:
BZ57801: Give a hint on what to do.

This might happen, if a system reboot happens,
Tomcat is not shut down properly and another
process reuses the PID after the reboot, before
Tomcat is being started.

Modified:
tomcat/trunk/bin/catalina.sh

Modified: tomcat/trunk/bin/catalina.sh
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/bin/catalina.sh?rev=1672272r1=1672271r2=1672272view=diff
==
--- tomcat/trunk/bin/catalina.sh (original)
+++ tomcat/trunk/bin/catalina.sh Thu Apr  9 09:24:49 2015
@@ -342,6 +342,7 @@ elif [ $1 = start ] ; then
   ps -p $PID /dev/null 21
   if [ $? -eq 0 ] ; then
 echo Tomcat appears to still be running with PID $PID. Start 
aborted.
+echo If this process is not a Tomcat process, remove the PID file 
and try again.
 exit 1
   else
 echo Removing/clearing stale PID file.



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



svn commit: r1672393 - in /tomcat/trunk/java/org/apache/tomcat/util/net: Nio2Channel.java NioChannel.java SecureNio2Channel.java SecureNioChannel.java

2015-04-09 Thread markt
Author: markt
Date: Thu Apr  9 15:16:42 2015
New Revision: 1672393

URL: http://svn.apache.org/r1672393
Log:
Some initial plumbing for SNI.
While Java 8 supports SNI, if you want different certs for different hosts then 
you have to manually parse the incoming TLS bytes to look for the SNI 
extension. This makes it 'interesting'. The idea at this point is to do it as 
part of the handshake. This will require moving the SSLEngine init code to 
processSNI() - that is the next step.
Fix some Java 8 Javadoc issues while I was in the area.

Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Channel.java
tomcat/trunk/java/org/apache/tomcat/util/net/NioChannel.java
tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java
tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Channel.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Channel.java?rev=1672393r1=1672392r2=1672393view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Channel.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Channel.java Thu Apr  9 
15:16:42 2015
@@ -70,12 +70,21 @@ public class Nio2Channel implements Asyn
 sc.close();
 }
 
+
+/**
+ * Close the connection.
+ *
+ * @param force Should the underlying socket be forcibly closed?
+ *
+ * @throws IOException If closing the secure channel fails.
+ */
 public void close(boolean force) throws IOException {
 if (isOpen() || force) {
 close();
 }
 }
 
+
 /**
  * Tells whether or not this channel is open.
  *

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioChannel.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioChannel.java?rev=1672393r1=1672392r2=1672393view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioChannel.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioChannel.java Thu Apr  9 
15:16:42 2015
@@ -92,9 +92,17 @@ public class NioChannel implements ByteC
 getIOChannel().close();
 }
 
+/**
+ * Close the connection.
+ *
+ * @param force Should the underlying socket be forcibly closed?
+ *
+ * @throws IOException If closing the secure channel fails.
+ */
 public void close(boolean force) throws IOException {
 if (isOpen() || force ) close();
 }
+
 /**
  * Tells whether or not this channel is open.
  *

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java?rev=1672393r1=1672392r2=1672393view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java Thu Apr 
 9 15:16:42 2015
@@ -50,6 +50,8 @@ public class SecureNio2Channel extends N
 protected SSLEngine sslEngine;
 protected final Nio2Endpoint endpoint;
 
+protected boolean sniComplete = false;
+
 protected boolean handshakeComplete;
 protected HandshakeStatus handshakeStatus; //gets set by handshake
 
@@ -191,7 +193,8 @@ public class SecureNio2Channel extends N
  * In the event of a positive value coming back, reregister the selection 
key for the return values interestOps.
  *
  * @return int - 0 if hand shake is complete, otherwise it returns a 
SelectionKey interestOps value
- * @throws IOException
+ * @throws IOException If an I/O error occurs during the handshake or if 
the
+ * handshake fails during wrapping or unwrapping
  */
 @Override
 public int handshake() throws IOException {
@@ -199,8 +202,18 @@ public class SecureNio2Channel extends N
 }
 
 protected int handshakeInternal(boolean async) throws IOException {
-if (handshakeComplete)
+if (handshakeComplete) {
 return 0; //we have done our initial handshake
+}
+
+if (!sniComplete) {
+int sniResult = processSNI();
+if (sniResult == 0) {
+sniComplete = true;
+} else {
+return sniResult;
+}
+}
 
 SSLEngineResult handshake = null;
 
@@ -290,6 +303,17 @@ public class SecureNio2Channel extends N
 return handshakeComplete ? 0 : handshakeInternal(async);
 }
 
+
+/*
+ * Peeks at the initial network bytes to determine if the SNI extension is
+ * present and, if it is, what host name has been requested. Based on the
+ * provided host name, configure the SSLEngine for this connection.
+ 

svn commit: r1672452 - in /tomcat/trunk/java/org/apache/tomcat/util/net: NioEndpoint.java SecureNioChannel.java SocketBufferHandler.java

2015-04-09 Thread markt
Author: markt
Date: Thu Apr  9 18:58:39 2015
New Revision: 1672452

URL: http://svn.apache.org/r1672452
Log:
More SNI refactoring. Should be ready to start peeking at the input stream now.

Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java
tomcat/trunk/java/org/apache/tomcat/util/net/SocketBufferHandler.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1672452r1=1672451r2=1672452view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Thu Apr  9 
18:58:39 2015
@@ -456,32 +456,19 @@ public class NioEndpoint extends Abstrac
 socketProperties.setProperties(sock);
 
 NioChannel channel = nioChannels.pop();
-if ( channel == null ) {
-// SSL setup
+if (channel == null) {
+SocketBufferHandler bufhandler = new SocketBufferHandler(
+socketProperties.getAppReadBufSize(),
+socketProperties.getAppWriteBufSize(),
+socketProperties.getDirectBuffer());
 if (isSSLEnabled()) {
-SSLEngine engine = createSSLEngine();
-int appbufsize = 
engine.getSession().getApplicationBufferSize();
-SocketBufferHandler bufhandler = new SocketBufferHandler(
-
Math.max(appbufsize,socketProperties.getAppReadBufSize()),
-
Math.max(appbufsize,socketProperties.getAppWriteBufSize()),
-socketProperties.getDirectBuffer());
-channel = new SecureNioChannel(socket, engine, bufhandler, 
selectorPool, this);
+channel = new SecureNioChannel(socket, bufhandler, 
selectorPool, this);
 } else {
-// normal tcp setup
-SocketBufferHandler bufhandler = new SocketBufferHandler(
-socketProperties.getAppReadBufSize(),
-socketProperties.getAppWriteBufSize(),
-socketProperties.getDirectBuffer());
 channel = new NioChannel(socket, bufhandler);
 }
 } else {
 channel.setIOChannel(socket);
-if ( channel instanceof SecureNioChannel ) {
-SSLEngine engine = createSSLEngine();
-((SecureNioChannel)channel).reset(engine);
-} else {
-channel.reset();
-}
+channel.reset();
 }
 getPoller0().register(channel);
 } catch (Throwable t) {

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java?rev=1672452r1=1672451r2=1672452view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java Thu Apr  
9 18:58:39 2015
@@ -54,24 +54,19 @@ public class SecureNioChannel extends Ni
 protected NioSelectorPool pool;
 private final NioEndpoint endpoint;
 
-public SecureNioChannel(SocketChannel channel, SSLEngine engine, 
SocketBufferHandler bufHandler,
+public SecureNioChannel(SocketChannel channel, SocketBufferHandler 
bufHandler,
 NioSelectorPool pool, NioEndpoint endpoint) {
-super(channel,bufHandler);
-this.sslEngine = engine;
+super(channel, bufHandler);
 
 // selector pool for blocking operations
 this.pool = pool;
 this.endpoint = endpoint;
 }
 
-public void reset(SSLEngine engine) throws IOException {
-this.sslEngine = engine;
-reset();
-}
-
 @Override
 public void reset() throws IOException {
 super.reset();
+sslEngine = null;
 sniComplete = false;
 handshakeComplete = false;
 closed = false;
@@ -221,6 +216,12 @@ public class SecureNioChannel extends Ni
 //  via SNI (if any) goes here.
 
 SocketProperties sp = endpoint.getSocketProperties();
+sslEngine = endpoint.createSSLEngine();
+
+// Ensure the application buffers (which have to be created earlier) 
are
+// big enough.
+bufHandler.expand(sslEngine.getSession().getApplicationBufferSize());
+
 // Create/expand network buffers.
 // In/Out are always created in a pair with identical settings so only
 // need to test one to 

svn commit: r1672342 - in /tomcat/trunk/java/org/apache/tomcat/util/net: AbstractJsseEndpoint.java Nio2Endpoint.java NioEndpoint.java

2015-04-09 Thread markt
Author: markt
Date: Thu Apr  9 13:23:53 2015
New Revision: 1672342

URL: http://svn.apache.org/r1672342
Log:
Pull up the common JSSE code.

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

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AbstractJsseEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AbstractJsseEndpoint.java?rev=1672342r1=1672341r2=1672342view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/AbstractJsseEndpoint.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/AbstractJsseEndpoint.java Thu 
Apr  9 13:23:53 2015
@@ -16,6 +16,92 @@
  */
 package org.apache.tomcat.util.net;
 
+import javax.net.ssl.KeyManager;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLEngine;
+import javax.net.ssl.SSLSessionContext;
+import javax.net.ssl.X509KeyManager;
+
+import org.apache.tomcat.util.net.jsse.NioX509KeyManager;
+
 public abstract class AbstractJsseEndpointS extends AbstractEndpointS {
 
+private SSLImplementation sslImplementation = null;
+public SSLImplementation getSslImplementation() {
+return sslImplementation;
+}
+
+private String[] enabledCiphers;
+@Override
+public String[] getCiphersUsed() {
+return enabledCiphers;
+}
+
+private String[] enabledProtocols;
+
+private SSLContext sslContext = null;
+public SSLContext getSSLContext() { return sslContext;}
+public void setSSLContext(SSLContext c) { sslContext = c;}
+
+
+protected void initialiseSsl() throws Exception {
+if (isSSLEnabled()) {
+sslImplementation = 
SSLImplementation.getInstance(getSslImplementationName());
+SSLUtil sslUtil = sslImplementation.getSSLUtil(this);
+
+sslContext = sslUtil.createSSLContext();
+sslContext.init(wrap(sslUtil.getKeyManagers()),
+sslUtil.getTrustManagers(), null);
+
+SSLSessionContext sessionContext =
+sslContext.getServerSessionContext();
+if (sessionContext != null) {
+sslUtil.configureSessionContext(sessionContext);
+}
+// Determine which cipher suites and protocols to enable
+enabledCiphers = sslUtil.getEnableableCiphers(sslContext);
+enabledProtocols = sslUtil.getEnableableProtocols(sslContext);
+}
+}
+
+
+protected SSLEngine createSSLEngine() {
+SSLEngine engine = sslContext.createSSLEngine();
+if (false.equals(getClientAuth())) {
+engine.setNeedClientAuth(false);
+engine.setWantClientAuth(false);
+} else if (true.equals(getClientAuth()) || 
yes.equals(getClientAuth())){
+engine.setNeedClientAuth(true);
+} else if (want.equals(getClientAuth())) {
+engine.setWantClientAuth(true);
+}
+engine.setUseClientMode(false);
+engine.setEnabledCipherSuites(enabledCiphers);
+engine.setEnabledProtocols(enabledProtocols);
+
+configureUseServerCipherSuitesOrder(engine);
+
+return engine;
+}
+
+
+
+@Override
+public void unbind() throws Exception {
+sslContext = null;
+}
+
+
+private KeyManager[] wrap(KeyManager[] managers) {
+if (managers==null) return null;
+KeyManager[] result = new KeyManager[managers.length];
+for (int i=0; iresult.length; i++) {
+if (managers[i] instanceof X509KeyManager  getKeyAlias()!=null) {
+result[i] = new 
NioX509KeyManager((X509KeyManager)managers[i],getKeyAlias());
+} else {
+result[i] = managers[i];
+}
+}
+return result;
+}
 }

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=1672342r1=1672341r2=1672342view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Thu Apr  9 
13:23:53 2015
@@ -43,12 +43,8 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import javax.net.ssl.KeyManager;
-import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLEngine;
 import javax.net.ssl.SSLSession;
-import javax.net.ssl.SSLSessionContext;
-import javax.net.ssl.X509KeyManager;
 
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
@@ -57,7 +53,6 @@ import org.apache.tomcat.util.buf.ByteBu
 import org.apache.tomcat.util.collections.SynchronizedStack;
 

buildbot failure in ASF Buildbot on tomcat-trunk

2015-04-09 Thread buildbot
The Buildbot has detected a new failure on builder tomcat-trunk while building 
ASF Buildbot. Full details are available at:
http://ci.apache.org/builders/tomcat-trunk/builds/1119

Buildbot URL: http://ci.apache.org/

Buildslave for this Build: silvanus_ubuntu

Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-commit' 
triggered this build
Build Source Stamp: [branch tomcat/trunk] 1672434
Blamelist: markt

BUILD FAILED: failed compile_1

Sincerely,
 -The Buildbot




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



Re: HTTP/2 progress report

2015-04-09 Thread Rémy Maucherat
2015-04-08 23:56 GMT+02:00 Mark Thomas ma...@apache.org:

 As of r1672190 we now have the following:

 - ALPN support in tc-native trunk
 - The ability to register upgrade protocol implementations that will:
   - be included in the ALPN negotiation
   - cause processing to be passed to a protocol dedicated processor
 implementation once ALPN negotiation completes

 I have tested this with h2 and it works - up until the point where
 processing passes to the HTTP/2 processor. Since that processor is only
 a dummy implementation the connection dies at that point.

 This is intended to be extensible. If, for example, WebSocket is added
 to the IANA registry for ALPN (I'm not sure if it will be or not) then
 it should be relatively simple to add the plumbing to Tomcat to make
 that work.

 I'm still thinking where about in the processing chain to insert the
 check for HTTP upgrade. It could be as early as the Adapter or as late
 as the ContextContextValve.

 I have been considering refactoring WebSocket to use this new HTTP
 upgrade process - whatever it becomes - but I think - on balance - it
 makes sense not to. They are fundamentally different.
 - HTTP upgrade for h2c happens irrespective of the URL being requested.
 - HTTP upgrade for WebSocket only happens if the upgrade request is for
 a valid URL.

 Given this, I am leaning towards the new HTTP upgrade mechanism (the one
 that will be used by h2c) being earlier rather than later in the
 processing chain.

 Next steps are:
 - start to flesh out the Http2Processor implementation
 - provide a 1.2.0-dev build of tc-native for Windows (assuming folks
 want one and can't built it themselves)

 Very nice.

As for the user API, it's a big question at the moment.

Rémy


[Bug 57801] Tomcat catalina.sh fails to start after machine is reboot because there is another process have the same PID as Tomcat before reboot

2015-04-09 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=57801

--- Comment #3 from Rainer Jung rainer.j...@kippdata.de ---
Also added ps output for the process with the PID in r1672284 (trunk),
r1672285 (tc8) and r1672286 (tc7).

-- 
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: r1672325 - in /tomcat/trunk/java/org/apache/coyote: ./ ajp/ http11/ http11/filters/

2015-04-09 Thread markt
Author: markt
Date: Thu Apr  9 12:54:41 2015
New Revision: 1672325

URL: http://svn.apache.org/r1672325
Log:
Javadoc fixes for InputBuffer

Modified:
tomcat/trunk/java/org/apache/coyote/InputBuffer.java
tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
tomcat/trunk/java/org/apache/coyote/http11/Http11InputBuffer.java
tomcat/trunk/java/org/apache/coyote/http11/InputFilter.java
tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java
tomcat/trunk/java/org/apache/coyote/http11/filters/IdentityInputFilter.java

tomcat/trunk/java/org/apache/coyote/http11/filters/SavedRequestInputFilter.java
tomcat/trunk/java/org/apache/coyote/http11/filters/VoidInputFilter.java

Modified: tomcat/trunk/java/org/apache/coyote/InputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/InputBuffer.java?rev=1672325r1=1672324r2=1672325view=diff
==
--- tomcat/trunk/java/org/apache/coyote/InputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/InputBuffer.java Thu Apr  9 12:54:41 
2015
@@ -27,11 +27,17 @@ import org.apache.tomcat.util.buf.ByteCh
 public interface InputBuffer {
 
 /**
- * Read from the input
- * Return from the input stream.
-IMPORTANT: the current model assumes that the protocol will 'own' the
-buffer and return a pointer to it in ByteChunk ( i.e. the param will
-have chunk.getBytes()==null before call, and the result after the call 
).
-*/
+ * Read from the input stream into the given buffer.
+ * IMPORTANT: the current model assumes that the protocol will 'own' the
+ * buffer and return a pointer to it in ByteChunk (i.e. the param will
+ * have chunk.getBytes()==null before call, and the result after the call).
+ *
+ * @param chunk The buffer to read data into.
+ *
+ * @return The number of bytes that have been added to the buffer or -1 for
+ * end of stream
+ *
+ * @throws IOException If an I/O error occurs reading from the input stream
+ */
 public int doRead(ByteChunk chunk) throws IOException;
 }

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java?rev=1672325r1=1672324r2=1672325view=diff
==
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java Thu Apr  9 
12:54:41 2015
@@ -1584,9 +1584,6 @@ public class AjpProcessor extends Abstra
  */
 protected class SocketInputBuffer implements InputBuffer {
 
-/**
- * Read bytes into the specified chunk.
- */
 @Override
 public int doRead(ByteChunk chunk) throws IOException {
 

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11InputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11InputBuffer.java?rev=1672325r1=1672324r2=1672325view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/Http11InputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11InputBuffer.java Thu Apr  
9 12:54:41 2015
@@ -292,9 +292,6 @@ public class Http11InputBuffer implement
 
 //  InputBuffer Methods
 
-/**
- * Read some bytes.
- */
 @Override
 public int doRead(ByteChunk chunk) throws IOException {
 
@@ -1046,9 +1043,6 @@ public class Http11InputBuffer implement
  */
 private class SocketInputBuffer implements InputBuffer {
 
-/**
- * Read bytes into the specified chunk.
- */
 @Override
 public int doRead(ByteChunk chunk) throws IOException {
 

Modified: tomcat/trunk/java/org/apache/coyote/http11/InputFilter.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InputFilter.java?rev=1672325r1=1672324r2=1672325view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/InputFilter.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InputFilter.java Thu Apr  9 
12:54:41 2015
@@ -30,16 +30,6 @@ import org.apache.tomcat.util.buf.ByteCh
  */
 public interface InputFilter extends InputBuffer {
 
-
-/**
- * Read bytes.
- *
- * @return Number of bytes read.
- */
-@Override
-public int doRead(ByteChunk chunk) throws IOException;
-
-
 /**
  * Some filters need additional parameters from the request. All the
  * necessary reading can occur in that method, as this method is called

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java
URL: 

Re: Reg: Bug 56438

2015-04-09 Thread Mark Thomas
On 09/04/2015 13:25, Pravallika Peddi wrote:
 Hi Mark,
 
 
 
 I can add the Boolean variable at ContextConfig class level so that all
 pluggability scans can access it and set the value accordingly.

That is too high. It needs to be per JAR.

 Almost all web-inf/lib/class scans are internally calling
 “processAnnotationsStream()” method of ContextConfig.java. So in this
 method I can change the Boolean variable to true if annotations are found.

Almost? That isn't really good enough. This has to be comprehensive to
be useful.

 Here the problem is:   In case if a JAR is unnecessarily processed we can
 ask user to add that jAR under “JarsToSkip” property. But in case if a
 class file is scanned unnecessarily, we cannot ask user to add it under
 “JARsToSkip” property.
 
 So I felt there is no point in handling for class scans.

I agree for classes under WEB-INF/classes. For classes in a JAR then if
all the classes are scanned unnecessarily then the JAR is a candidate
for being skipped.

Mark

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