svn commit: r1530172 - /tomcat/trunk/java/org/apache/catalina/core/StandardWrapperValve.java

2013-10-08 Thread markt
Author: markt
Date: Tue Oct  8 07:19:36 2013
New Revision: 1530172

URL: http://svn.apache.org/r1530172
Log:
Remove completed TODOs

Modified:
tomcat/trunk/java/org/apache/catalina/core/StandardWrapperValve.java

Modified: tomcat/trunk/java/org/apache/catalina/core/StandardWrapperValve.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardWrapperValve.java?rev=1530172&r1=1530171&r2=1530172&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/core/StandardWrapperValve.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardWrapperValve.java Tue 
Oct  8 07:19:36 2013
@@ -197,7 +197,6 @@ final class StandardWrapperValve
 try {
 SystemLogHandler.startCapture();
 if (request.isAsyncDispatching()) {
-//TODO SERVLET3 - async
 
((AsyncContextImpl)request.getAsyncContext()).doInternalDispatch();
 } else if (comet) {
 filterChain.doFilterEvent(request.getEvent());
@@ -214,7 +213,6 @@ final class StandardWrapperValve
 }
 } else {
 if (request.isAsyncDispatching()) {
-//TODO SERVLET3 - async
 
((AsyncContextImpl)request.getAsyncContext()).doInternalDispatch();
 } else if (comet) {
 request.setComet(true);



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



svn commit: r1530178 - /tomcat/sandbox/storeconfig7/tags/0.0.1.Alpha3/

2013-10-08 Thread remm
Author: remm
Date: Tue Oct  8 07:55:25 2013
New Revision: 1530178

URL: http://svn.apache.org/r1530178
Log:
New storeconfig tag.

Added:
tomcat/sandbox/storeconfig7/tags/0.0.1.Alpha3/
  - copied from r1530176, tomcat/sandbox/storeconfig7/trunk/


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



svn commit: r1530177 - in /tomcat/trunk/java/org/apache/tomcat/util/net: AprEndpoint.java JIoEndpoint.java

2013-10-08 Thread markt
Author: markt
Date: Tue Oct  8 07:55:22 2013
New Revision: 1530177

URL: http://svn.apache.org/r1530177
Log:
Revert r1529130 and add a comment that explains why the sync is necessary.

Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1530177&r1=1530176&r2=1530177&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Tue Oct  8 
07:55:22 2013
@@ -855,32 +855,37 @@ public class AprEndpoint extends Abstrac
 public void processSocket(SocketWrapper socket, SocketStatus status,
 boolean dispatch) {
 try {
-if (waitingRequests.remove(socket)) {
-SocketProcessor proc = new SocketProcessor(socket, status);
-Executor executor = getExecutor();
-if (dispatch && executor != null) {
-ClassLoader loader = 
Thread.currentThread().getContextClassLoader();
-try {
-//threads should not be created by the webapp 
classloader
-if (Constants.IS_SECURITY_ENABLED) {
-PrivilegedAction pa = new PrivilegedSetTccl(
-getClass().getClassLoader());
-AccessController.doPrivileged(pa);
-} else {
-Thread.currentThread().setContextClassLoader(
-getClass().getClassLoader());
-}
-executor.execute(proc);
-} finally {
-if (Constants.IS_SECURITY_ENABLED) {
-PrivilegedAction pa = new 
PrivilegedSetTccl(loader);
-AccessController.doPrivileged(pa);
-} else {
-
Thread.currentThread().setContextClassLoader(loader);
+// Synchronisation is required here as this code may be called as a
+// result of calling AsyncContext.dispatch() from a non-container
+// thread
+synchronized (socket) {
+if (waitingRequests.remove(socket)) {
+SocketProcessor proc = new SocketProcessor(socket, status);
+Executor executor = getExecutor();
+if (dispatch && executor != null) {
+ClassLoader loader = 
Thread.currentThread().getContextClassLoader();
+try {
+//threads should not be created by the webapp 
classloader
+if (Constants.IS_SECURITY_ENABLED) {
+PrivilegedAction pa = new 
PrivilegedSetTccl(
+getClass().getClassLoader());
+AccessController.doPrivileged(pa);
+} else {
+Thread.currentThread().setContextClassLoader(
+getClass().getClassLoader());
+}
+executor.execute(proc);
+} finally {
+if (Constants.IS_SECURITY_ENABLED) {
+PrivilegedAction pa = new 
PrivilegedSetTccl(loader);
+AccessController.doPrivileged(pa);
+} else {
+
Thread.currentThread().setContextClassLoader(loader);
+}
 }
+} else {
+proc.run();
 }
-} else {
-proc.run();
 }
 }
 } catch (RejectedExecutionException ree) {

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java?rev=1530177&r1=1530176&r2=1530177&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java Tue Oct  8 
07:55:22 2013
@@ -554,37 +554,42 @@ public class JIoEndpoint extends Abstrac
 public void processSocket(SocketWrapper socket,
 SocketStatus status, boolean dispatch) {
 try {
-if (waitingRequests.remove(socket)) {
-SocketProcessor proc = new SocketProcessor(socket,status);
-Exec

svn commit: r1530179 - /tomcat/sandbox/storeconfig6/tags/0.0.1.Alpha3/

2013-10-08 Thread remm
Author: remm
Date: Tue Oct  8 07:55:58 2013
New Revision: 1530179

URL: http://svn.apache.org/r1530179
Log:
New storeconfig tag.

Added:
tomcat/sandbox/storeconfig6/tags/0.0.1.Alpha3/
  - copied from r1530178, tomcat/sandbox/storeconfig6/trunk/


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



svn commit: r1530180 - in /tomcat/sandbox: storeconfig6/tags/0.0.1.Alpha3/pom.xml storeconfig7/tags/0.0.1.Alpha3/pom.xml

2013-10-08 Thread remm
Author: remm
Date: Tue Oct  8 07:56:57 2013
New Revision: 1530180

URL: http://svn.apache.org/r1530180
Log:
Version number.

Modified:
tomcat/sandbox/storeconfig6/tags/0.0.1.Alpha3/pom.xml
tomcat/sandbox/storeconfig7/tags/0.0.1.Alpha3/pom.xml

Modified: tomcat/sandbox/storeconfig6/tags/0.0.1.Alpha3/pom.xml
URL: 
http://svn.apache.org/viewvc/tomcat/sandbox/storeconfig6/tags/0.0.1.Alpha3/pom.xml?rev=1530180&r1=1530179&r2=1530180&view=diff
==
--- tomcat/sandbox/storeconfig6/tags/0.0.1.Alpha3/pom.xml (original)
+++ tomcat/sandbox/storeconfig6/tags/0.0.1.Alpha3/pom.xml Tue Oct  8 07:56:57 
2013
@@ -27,7 +27,7 @@
 
 org.apache.tomcat
 tomcat6-storeconfig
- 0.0.1.Alpha3-SNAPSHOT
+ 0.0.1.Alpha3
 
 Store Config
 Configuration storage for Apache Tomcat 6

Modified: tomcat/sandbox/storeconfig7/tags/0.0.1.Alpha3/pom.xml
URL: 
http://svn.apache.org/viewvc/tomcat/sandbox/storeconfig7/tags/0.0.1.Alpha3/pom.xml?rev=1530180&r1=1530179&r2=1530180&view=diff
==
--- tomcat/sandbox/storeconfig7/tags/0.0.1.Alpha3/pom.xml (original)
+++ tomcat/sandbox/storeconfig7/tags/0.0.1.Alpha3/pom.xml Tue Oct  8 07:56:57 
2013
@@ -27,7 +27,7 @@
 
 org.apache.tomcat
 tomcat7-storeconfig
-0.0.1.Alpha3-SNAPSHOT
+0.0.1.Alpha3
 
 Store Config
 Configuration storage for Apache Tomcat 7



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



svn commit: r1530182 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/net/NioEndpoint.java

2013-10-08 Thread markt
Author: markt
Date: Tue Oct  8 08:09:31 2013
New Revision: 1530182

URL: http://svn.apache.org/r1530182
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=55633 for NIO.
The Comet code that ensured that multiple threads didn't process the same 
socket when the selector indicated that a socket was ready for read and write 
pre-dated r1001698 where syncs where added to the SocketProcessor to achieve 
the same aim for Servlet 3.0 asyncs processing.
The Comet code was re-used to handle upgraded connections.
The upgrade code did not handle the case where a socket was registered for read 
and write but only a write event occurred. In this case the read registration 
was lost. This is the root cause of the lack of responsiveness observed in bug 
55633.
With the changes in r1001698, a simpler solution can be used for both
Comet and HTTP upgrade. The new approach unregisters the socket operations the 
selector has reported ready for and then triggers a read and/or write as 
appropriate. For Comet the syncs will ensure that read and write aren't 
processed in parallel. For HTTP upgrade such parallel processing is permitted.

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

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

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1530182&r1=1530181&r2=1530182&view=diff
==
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Tue 
Oct  8 08:09:31 2013
@@ -1247,44 +1247,19 @@ public class NioEndpoint extends Abstrac
 if (sk.isReadable() || sk.isWritable() ) {
 if ( attachment.getSendfileData() != null ) {
 processSendfile(sk,attachment, false);
-} else if ( attachment.isComet() ) {
-//check if thread is available
-if ( isWorkerAvailable() ) {
-//set interest ops to 0 so we don't get 
multiple
-//Invocations for both read and write on 
separate threads
-reg(sk, attachment, 0);
-//read goes before write
-if (sk.isReadable()) {
-//read notification
-if (!processSocket(channel, 
SocketStatus.OPEN_READ, true))
-processSocket(channel, 
SocketStatus.DISCONNECT, true);
-} else {
-//future placement of a WRITE notif
-if (!processSocket(channel, 
SocketStatus.OPEN_WRITE, true))
-processSocket(channel, 
SocketStatus.DISCONNECT, true);
-}
-} else {
-result = false;
-}
 } else {
-//later on, improve latch behavior
 if ( isWorkerAvailable() ) {
-
-boolean readAndWrite = sk.isReadable() && 
sk.isWritable();
-reg(sk, attachment, 0);
-if (attachment.isAsync() && readAndWrite) {
-//remember the that we want to know about 
write too
-
attachment.interestOps(SelectionKey.OP_WRITE);
-}
-//read goes before write
+unreg(sk, attachment, sk.readyOps());
+// Read goes before write
 if (sk.isReadable()) {
-//read notification
-if (!processSocket(channel, 
SocketStatus.OPEN_READ, true))
+if (!processSocket(channel, 
SocketStatus.OPEN_READ, true)) {
 close = true;
-} else {
-//future placement of a WRITE notif
-if (!processSocket(channel, 
SocketStatus.OPEN_WRITE, true))
+}
+}
+if (!close && sk.isWritable()) {
+if (!processSocket(channel, 
SocketStatus.O

svn commit: r1530183 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/net/AprEndpoint.java

2013-10-08 Thread markt
Author: markt
Date: Tue Oct  8 08:10:38 2013
New Revision: 1530183

URL: http://svn.apache.org/r1530183
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=55633 for APR.
If the socket was registered for read and write and only one occurred, the 
registration for the other event was lost. Ensure that the socket is 
re-registered with the Poller when necessary.

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

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

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1530183&r1=1530182&r2=1530183&view=diff
==
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Tue 
Oct  8 08:10:38 2013
@@ -1874,8 +1874,17 @@ public class AprEndpoint extends Abstrac
 ((desc[n*2] & Poll.APR_POLLOUT) == 
Poll.APR_POLLOUT) &&
 !processSocket(desc[n*2+1], 
SocketStatus.OPEN_WRITE)) {
 // Close socket and clear pool
+error = true;
 closeSocket(desc[n*2+1]);
 }
+if (!error) {
+// If socket was registered for 
multiple events but
+// only some of the occurred, 
re-register for the
+// remaining events.
+if (wrapper.pollerFlags != 0) {
+add(desc[n*2+1], 1, 
wrapper.pollerFlags);
+}
+}
 } else {
 // Unknown event
 getLog().warn(sm.getString(



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



svn commit: r1530184 - in /tomcat/tc7.0.x/trunk: ./ webapps/examples/WEB-INF/classes/websocket/snake/Snake.java

2013-10-08 Thread markt
Author: markt
Date: Tue Oct  8 08:11:50 2013
New Revision: 1530184

URL: http://svn.apache.org/r1530184
Log:
If the browser crashes or a similar event occurs writing messages will start 
failing. Rather than ignoring these failures, close the session.

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

tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/snake/Snake.java

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

Modified: 
tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/snake/Snake.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/snake/Snake.java?rev=1530184&r1=1530183&r2=1530184&view=diff
==
--- 
tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/snake/Snake.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/webapps/examples/WEB-INF/classes/websocket/snake/Snake.java
 Tue Oct  8 08:11:50 2013
@@ -21,6 +21,8 @@ import java.util.ArrayDeque;
 import java.util.Collection;
 import java.util.Deque;
 
+import javax.websocket.CloseReason;
+import javax.websocket.CloseReason.CloseCodes;
 import javax.websocket.Session;
 
 public class Snake {
@@ -65,7 +67,13 @@ public class Snake {
 try {
 session.getBasicRemote().sendText(msg);
 } catch (IOException ioe) {
-// Ignore
+CloseReason cr =
+new CloseReason(CloseCodes.CLOSED_ABNORMALLY, 
ioe.getMessage());
+try {
+session.close(cr);
+} catch (IOException ioe2) {
+// Ignore
+}
 }
 }
 



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



[Bug 55633] [websocket] Tomcat can't read data from the client after the client temporarily pauses

2013-10-08 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55633

Mark Thomas  changed:

   What|Removed |Added

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

--- Comment #2 from Mark Thomas  ---
The back-port to 7.0.x has been completed.

The closing issue was caused by ignoring write errors on the server. That has
also been fixed.

-- 
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: r1530213 - in /tomcat/trunk: java/org/apache/catalina/loader/WebappClassLoader.java webapps/docs/config/context.xml

2013-10-08 Thread markt
Author: markt
Date: Tue Oct  8 10:16:38 2013
New Revision: 1530213

URL: http://svn.apache.org/r1530213
Log:
Fix an intermittent failure with TestWebappClassLoaderExecutorMemoryLeak.
If the executor threads did not stop quickly enough, Thread.stop() was used. 
Sometimes this resulted in the executor not shutting down and the test failing. 
This makes using clearReferencesStopThreads marginally safer.

Modified:
tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
tomcat/trunk/webapps/docs/config/context.xml

Modified: tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java?rev=1530213&r1=1530212&r2=1530213&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java Tue Oct 
 8 10:16:38 2013
@@ -2079,6 +2079,7 @@ public class WebappClassLoader extends U
 @SuppressWarnings("deprecation") // thread.stop()
 private void clearReferencesThreads() {
 Thread[] threads = getThreads();
+List executorThreadsToStop = new ArrayList<>();
 
 // Iterate over the set of threads
 for (Thread thread : threads) {
@@ -2137,6 +2138,7 @@ public class WebappClassLoader extends U
 
 // If the thread has been started via an executor, try
 // shutting down the executor
+boolean usingExecutor = false;
 try {
 
 // Runnable wrapped by Thread
@@ -2169,6 +2171,7 @@ public class WebappClassLoader extends U
 Object executor = executorField.get(target);
 if (executor instanceof ThreadPoolExecutor) {
 ((ThreadPoolExecutor) executor).shutdownNow();
+usingExecutor = true;
 }
 }
 } catch (SecurityException e) {
@@ -2189,14 +2192,46 @@ public class WebappClassLoader extends U
 thread.getName(), getContextName()), e);
 }
 
-// This method is deprecated and for good reason. This is
-// very risky code but is the only option at this point.
-// A *very* good reason for apps to do this clean-up
-// themselves.
-thread.stop();
+if (usingExecutor) {
+// Executor may take a short time to stop all the
+// threads. Make a note of threads that should be
+// stopped and check them at the end of the method.
+executorThreadsToStop.add(thread);
+} else {
+// This method is deprecated and for good reason. This
+// is very risky code but is the only option at this
+// point. A *very* good reason for apps to do this
+// clean-up themselves.
+thread.stop();
+}
 }
 }
 }
+
+// If thread stopping is enabled, executor threads should have been
+// stopped above when the executor was shut down but that depends on 
the
+// thread correctly handling the interrupt. Give all the executor
+// threads a few seconds shutdown and if they are still running
+// Give threads up to 2 seconds to shutdown
+int count = 0;
+for (Thread t : executorThreadsToStop) {
+while (t.isAlive() && count < 100) {
+try {
+Thread.sleep(20);
+} catch (InterruptedException e) {
+// Quit the while loop
+break;
+}
+count++;
+}
+if (t.isAlive()) {
+// This method is deprecated and for good reason. This is
+// very risky code but is the only option at this point.
+// A *very* good reason for apps to do this clean-up
+// themselves.
+t.stop();
+}
+}
 }
 
 

Modified: tomcat/trunk/webapps/docs/config/context.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/context.xml?rev=1530213&r1=1530212&r2=1530213&view=diff
==
--- tomcat/trunk/webapps/docs/config/context.xml (original)
+++ tomcat/trunk/webapps/docs/config/context.xml Tue Oct  8 10:16:38 2013
@@ -667,7 +667,10 @@
 is likely to result in instability. As such, enabling this should be
 viewed as an option of last resort in a dev

svn commit: r1530216 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/catalina/loader/WebappClassLoader.java webapps/docs/config/context.xml

2013-10-08 Thread markt
Author: markt
Date: Tue Oct  8 10:34:19 2013
New Revision: 1530216

URL: http://svn.apache.org/r1530216
Log:
Fix an intermittent failure with TestWebappClassLoaderExecutorMemoryLeak.
If the executor threads did not stop quickly enough, Thread.stop() was used. 
Sometimes this resulted in the executor not shutting down and the test failing. 
This makes using clearReferencesStopThreads marginally safer.

Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
tomcat/tc7.0.x/trunk/webapps/docs/config/context.xml

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1529549,1530213

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/loader/WebappClassLoader.java?rev=1530216&r1=1530215&r2=1530216&view=diff
==
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/loader/WebappClassLoader.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/loader/WebappClassLoader.java 
Tue Oct  8 10:34:19 2013
@@ -2223,6 +2223,7 @@ public class WebappClassLoader
 @SuppressWarnings("deprecation") // thread.stop()
 private void clearReferencesThreads() {
 Thread[] threads = getThreads();
+List executorThreadsToStop = new ArrayList();
 
 // Iterate over the set of threads
 for (Thread thread : threads) {
@@ -2281,6 +2282,7 @@ public class WebappClassLoader
 
 // If the thread has been started via an executor, try
 // shutting down the executor
+boolean usingExecutor = false;
 try {
 
 // Runnable wrapped by Thread
@@ -2313,6 +2315,7 @@ public class WebappClassLoader
 Object executor = executorField.get(target);
 if (executor instanceof ThreadPoolExecutor) {
 ((ThreadPoolExecutor) executor).shutdownNow();
+usingExecutor = true;
 }
 }
 } catch (SecurityException e) {
@@ -2333,14 +2336,46 @@ public class WebappClassLoader
 thread.getName(), contextName), e);
 }
 
-// This method is deprecated and for good reason. This is
-// very risky code but is the only option at this point.
-// A *very* good reason for apps to do this clean-up
-// themselves.
-thread.stop();
+if (usingExecutor) {
+// Executor may take a short time to stop all the
+// threads. Make a note of threads that should be
+// stopped and check them at the end of the method.
+executorThreadsToStop.add(thread);
+} else {
+// This method is deprecated and for good reason. This
+// is very risky code but is the only option at this
+// point. A *very* good reason for apps to do this
+// clean-up themselves.
+thread.stop();
+}
 }
 }
 }
+
+// If thread stopping is enabled, executor threads should have been
+// stopped above when the executor was shut down but that depends on 
the
+// thread correctly handling the interrupt. Give all the executor
+// threads a few seconds shutdown and if they are still running
+// Give threads up to 2 seconds to shutdown
+int count = 0;
+for (Thread t : executorThreadsToStop) {
+while (t.isAlive() && count < 100) {
+try {
+Thread.sleep(20);
+} catch (InterruptedException e) {
+// Quit the while loop
+break;
+}
+count++;
+}
+if (t.isAlive()) {
+// This method is deprecated and for good reason. This is
+// very risky code but is the only option at this point.
+// A *very* good reason for apps to do this clean-up
+// themselves.
+t.stop();
+}
+}
 }
 
 

Modified: tomcat/tc7.0.x/trunk/webapps/docs/config/context.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/config/context.xml?rev=1530216&r1=1530215&r2=1530216&view=diff
==
--- tomcat/tc7.0.x/trunk/webapps/docs/config/context.xml (original)
+

svn commit: r1530217 - /tomcat/tc7.0.x/trunk/test/org/apache/catalina/mbeans/TestRegistration.java

2013-10-08 Thread markt
Author: markt
Date: Tue Oct  8 10:36:17 2013
New Revision: 1530217

URL: http://svn.apache.org/r1530217
Log:
Extend the test case to cover RequestProcessors

Modified:
tomcat/tc7.0.x/trunk/test/org/apache/catalina/mbeans/TestRegistration.java

Modified: 
tomcat/tc7.0.x/trunk/test/org/apache/catalina/mbeans/TestRegistration.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/mbeans/TestRegistration.java?rev=1530217&r1=1530216&r2=1530217&view=diff
==
--- tomcat/tc7.0.x/trunk/test/org/apache/catalina/mbeans/TestRegistration.java 
(original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/catalina/mbeans/TestRegistration.java 
Tue Oct  8 10:36:17 2013
@@ -95,6 +95,14 @@ public class TestRegistration extends To
 }
 }
 
+private static String[] requestMBeanNames(String port, String type) {
+return new String[] {
+"Tomcat:type=RequestProcessor,worker=" +
+ObjectName.quote("http-" + type + "-" + ADDRESS + "-" + 
port) +
+",name=HttpRequest1",
+};
+}
+
 private static String[] contextMBeanNames(String host, String context) {
 return new String[] {
 "Tomcat:j2eeType=WebModule,name=//" + host + context +
@@ -163,6 +171,8 @@ public class TestRegistration extends To
 
 tomcat.start();
 
+getUrl("http://localhost:"; + getPort());
+
 // Verify there are no Catalina MBeans
 onames = mbeanServer.queryNames(new ObjectName("Catalina:*"), null);
 log.info(MBeanDumper.dumpBeans(mbeanServer, onames));
@@ -176,8 +186,7 @@ public class TestRegistration extends To
 }
 
 // Create the list of expected MBean names
-String protocol=
-getTomcatInstance().getConnector().getProtocolHandlerClassName();
+String protocol = tomcat.getConnector().getProtocolHandlerClassName();
 if (protocol.indexOf("Nio") > 0) {
 protocol = "nio";
 } else if (protocol.indexOf("Apr") > 0) {
@@ -185,12 +194,14 @@ public class TestRegistration extends To
 } else {
 protocol = "bio";
 }
-String index = 
getTomcatInstance().getConnector().getProperty("nameIndex").toString();
+String index = 
tomcat.getConnector().getProperty("nameIndex").toString();
 ArrayList expected = new 
ArrayList(Arrays.asList(basicMBeanNames()));
 expected.addAll(Arrays.asList(hostMBeanNames("localhost")));
 expected.addAll(Arrays.asList(contextMBeanNames("localhost", 
contextName)));
 expected.addAll(Arrays.asList(connectorMBeanNames("auto-" + index, 
protocol)));
 expected.addAll(Arrays.asList(optionalMBeanNames("localhost")));
+expected.addAll(Arrays.asList(requestMBeanNames(
+"auto-" + index + "-" + getPort(), protocol)));
 
 // Did we find all expected MBeans?
 ArrayList missing = new ArrayList(expected);



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



svn commit: r1530219 - /tomcat/trunk/res/findbugs/filter-false-positives.xml

2013-10-08 Thread markt
Author: markt
Date: Tue Oct  8 10:47:35 2013
New Revision: 1530219

URL: http://svn.apache.org/r1530219
Log:
Some more false positives

Modified:
tomcat/trunk/res/findbugs/filter-false-positives.xml

Modified: tomcat/trunk/res/findbugs/filter-false-positives.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/res/findbugs/filter-false-positives.xml?rev=1530219&r1=1530218&r2=1530219&view=diff
==
--- tomcat/trunk/res/findbugs/filter-false-positives.xml (original)
+++ tomcat/trunk/res/findbugs/filter-false-positives.xml Tue Oct  8 10:47:35 
2013
@@ -433,6 +433,12 @@
 
   
   
+
+
+
+
+  
+  
 
 
 
@@ -451,10 +457,15 @@
 
   
   
-
-
-
-
+
+
+
+
+  
+  
+  
+
+
   
   
 



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



svn commit: r1530269 - /tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java

2013-10-08 Thread markt
Author: markt
Date: Tue Oct  8 13:28:44 2013
New Revision: 1530269

URL: http://svn.apache.org/r1530269
Log:
Ensure sendfile is enabled by default for APR.

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

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1530269&r1=1530268&r2=1530269&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Tue Oct  8 
13:28:44 2013
@@ -150,8 +150,19 @@ public class AprEndpoint extends Abstrac
 /**
  * Use sendfile for sending static files.
  */
-protected boolean useSendfile = Library.APR_HAS_SENDFILE;
-public void setUseSendfile(boolean useSendfile) { this.useSendfile = 
useSendfile; }
+protected boolean useSendfile = false;
+/*
+ * When the endpoint is created and configured, the APR library will not
+ * have been initialised. This flag is used to determine if the default
+ * value of useSendFile should be changed if the APR library indicates it
+ * supports send file once it has been initialised. If useSendFile is set
+ * by configuration, that configuration will always take priority.
+ */
+private boolean useSendFileSet = false;
+public void setUseSendfile(boolean useSendfile) {
+useSendFileSet = true;
+this.useSendfile = useSendfile;
+}
 @Override
 public boolean getUseSendfile() { return useSendfile; }
 
@@ -606,6 +617,9 @@ public class AprEndpoint extends Abstrac
 pollerThread.start();
 
 // Start sendfile thread
+if (!useSendFileSet) {
+useSendfile = Library.APR_HAS_SENDFILE;
+}
 if (useSendfile) {
 sendfile = new Sendfile();
 sendfile.init();



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



CI build issues

2013-10-08 Thread Mark Thomas
The CI builds have been taking 2-3 times longer than they should have.
This has been triggering a number of timing related test failures.

I took a look on the CI slave and it appears a couple of old builds were
sat burning CPU cycles and generally slowing everything down. I have
killed those builds and (hopefully) things should be back to normal now.

Mark

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



RE: svn commit: r1530081 - /tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java

2013-10-08 Thread Konstantin Preißer
Hi Mark,

> -Original Message-
> From: ma...@apache.org [mailto:ma...@apache.org]
> Sent: Monday, October 7, 2013 11:44 PM
> To: dev@tomcat.apache.org
> Subject: svn commit: r1530081 -
> /tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
> 
> Author: markt
> Date: Mon Oct  7 21:44:09 2013
> New Revision: 1530081
> 
> URL: http://svn.apache.org/r1530081
> Log:
> Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=55633 for APR.
> If the socket was registered for read and write and only one occurred, the
> registration for the other event was lost. Ensure that the socket is re-
> registered with the Poller when necessary.

Thanks for the fix.

Unfortunately, for APR it seems there is an issue with connections being closed 
by Tomcat (on Windows):

After resuming firefox.exe, in ~ 50% of the cases Tomcat will close the 
connection one second after resuming the browser (which normally shouldn't 
happen). The snake will disappear in the other browser and Firefox prints 
"WebSocket cosed".
Any idea about this?


Thanks,
Konstantin Preißer


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



[Bug 55639] Add Drawboard Websocket Example

2013-10-08 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55639

--- Comment #2 from Mark Thomas  ---
Trunk (a.k.a. 8.0.x) is Commit-the-Review so go for it. So is 7.0.x for that
matter, but I'd recommend against an immediate back-port. Get everything sorted
in 8 and then back-port.

-- 
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: r1530081 - /tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java

2013-10-08 Thread Mark Thomas
On 08/10/2013 14:50, Konstantin Preißer wrote:
> Hi Mark,
> 
>> -Original Message-
>> From: ma...@apache.org [mailto:ma...@apache.org]
>> Sent: Monday, October 7, 2013 11:44 PM
>> To: dev@tomcat.apache.org
>> Subject: svn commit: r1530081 -
>> /tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
>>
>> Author: markt
>> Date: Mon Oct  7 21:44:09 2013
>> New Revision: 1530081
>>
>> URL: http://svn.apache.org/r1530081
>> Log:
>> Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=55633 for APR.
>> If the socket was registered for read and write and only one occurred, the
>> registration for the other event was lost. Ensure that the socket is re-
>> registered with the Poller when necessary.
> 
> Thanks for the fix.
> 
> Unfortunately, for APR it seems there is an issue with connections being 
> closed by Tomcat (on Windows):
> 
> After resuming firefox.exe, in ~ 50% of the cases Tomcat will close the 
> connection one second after resuming the browser (which normally shouldn't 
> happen). The snake will disappear in the other browser and Firefox prints 
> "WebSocket cosed".
> Any idea about this?

None. I've seem the same problem but haven't got to the bottom of it
yet. What I do know is:
- Tomcat doesn't send a close
- The browser closes the connection on its own
- Tomcat tries (and fails) to write some data and that triggers the
  close on the Tomcat side

I'm wondering if some form of data corruption could be the trigger.

Whatever is going on, I'm fairly sure it is a different issue to BZ 55633.

I need to do some more careful analysis with Wireshark.

Mark

-
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

2013-10-08 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/5066

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

Buildslave for this Build: bb-vm_ubuntu

Build Reason: scheduler
Build Source Stamp: [branch tomcat/trunk] 1530219
Blamelist: markt

Build succeeded!

sincerely,
 -The Buildbot





svn commit: r1530298 [2/2] - in /tomcat/trunk/webapps/examples: WEB-INF/classes/websocket/drawboard/ WEB-INF/classes/websocket/drawboard/wsmessages/ websocket/

2013-10-08 Thread kpreisser
Modified: tomcat/trunk/webapps/examples/websocket/drawboard.xhtml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/websocket/drawboard.xhtml?rev=1530298&r1=1530297&r2=1530298&view=diff
==
--- tomcat/trunk/webapps/examples/websocket/drawboard.xhtml (original)
+++ tomcat/trunk/webapps/examples/websocket/drawboard.xhtml Tue Oct  8 14:46:53 
2013
@@ -1,611 +1,611 @@
-
-
-http://www.w3.org/1999/xhtml"; xml:lang="en">
-
-Apache Tomcat WebSocket Examples: Drawboard
-
- is not
-// allowed in XHTML
-var noscripts = document.getElementsByClassName("noscript");
-for (var i = 0; i < noscripts.length; i++) {
-noscripts[i].parentNode.removeChild(noscripts[i]);
-}
-
-
-var Console = {};
-
-Console.log = (function() {
-var consoleContainer =
-document.getElementById("console-container");
-var console = document.createElement("div");
-console.setAttribute("id", "console");
-consoleContainer.appendChild(console);
-
-return function(message) {
-var p = document.createElement('p');
-p.style.wordWrap = "break-word";
-p.appendChild(document.createTextNode(message));
-console.appendChild(p);
-while (console.childNodes.length > 25) {
-console.removeChild(console.firstChild);
-}
-console.scrollTop = console.scrollHeight;
-}
-})();
-
-
-function Room(drawContainer) {
-
-// The WebSocket object.
-var socket;
-// ID of the timer which sends ping messages.
-var pingTimerId;
-
-var isStarted = false;
-var playerCount = 0;
-
-// An array of PathIdContainer objects that the server
-// did not yet handle.
-// They are ordered by id (ascending).
-var pathsNotHandled = [];
-
-var nextMsgId = 1;
-
-var canvasDisplay = document.createElement("canvas");
-var canvasBackground = document.createElement("canvas");
-var canvasServerImage = document.createElement("canvas");
-var canvasArray = [canvasDisplay, canvasBackground,
-canvasServerImage];
-
-var labelPlayerCount = document.createTextNode("0");
-var optionContainer = document.createElement("div");
-
-
-var canvasDisplayCtx = canvasDisplay.getContext("2d");
-var canvasBackgroundCtx = canvasBackground.getContext("2d");
-var canvasServerImageCtx = canvasServerImage.getContext("2d");
-
-var mouseInWindow = false;
-var mouseDown = false;
-var currentMouseX = 0, currentMouseY = 0;
-
-var availableColors = [];
-var currentColorIndex;
-var colorContainers;
-
-var availableThicknesses = [2, 3, 6, 10, 16, 28, 50];
-var currentThicknessIndex;
-var thicknessContainers;
-
-
-var placeholder = document.createElement("div");
-placeholder.appendChild(document.createTextNode("Loading... 
"));
-var progressElem = document.createElement("progress");
-placeholder.appendChild(progressElem);
-
-   

[Bug 53281] Tomcat returns garbage data with HTTP/0.9 200 OK header when SSL port is accessed using http

2013-10-08 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=53281

robc...@knowledgetree.com changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|INVALID |---

--- Comment #9 from robc...@knowledgetree.com ---
With Tomcat 6.0.37, it it straightforward to reproduce this issue using the
following Connector (redacted):



$ curl -f  http://www.myhost.com:9876


-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 53281] Tomcat returns garbage data with HTTP/0.9 200 OK header when SSL port is accessed using http

2013-10-08 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=53281

robc...@knowledgetree.com changed:

   What|Removed |Added

 CC||robc...@knowledgetree.com

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

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



svn commit: r1530325 - in /tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard: Client.java DrawboardEndpoint.java Room.java wsmessages/CloseWebsocketMessage.java

2013-10-08 Thread kpreisser
Author: kpreisser
Date: Tue Oct  8 16:01:28 2013
New Revision: 1530325

URL: http://svn.apache.org/r1530325
Log:
Improve Drawboard Example:
- Check if buffered messages exceed a specific size, to avoid a DoS.
- Combine buffered string message to reduce TCP overhead when sending them.

Added:

tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/wsmessages/CloseWebsocketMessage.java
   (with props)
Modified:

tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Client.java

tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Room.java

Modified: 
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Client.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Client.java?rev=1530325&r1=1530324&r2=1530325&view=diff
==
--- 
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Client.java 
(original)
+++ 
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Client.java 
Tue Oct  8 16:01:28 2013
@@ -16,22 +16,28 @@
  */
 package websocket.drawboard;
 
+import java.io.IOException;
 import java.util.LinkedList;
 
-import javax.websocket.RemoteEndpoint;
+import javax.websocket.CloseReason;
+import javax.websocket.CloseReason.CloseCodes;
+import javax.websocket.RemoteEndpoint.Async;
 import javax.websocket.SendHandler;
 import javax.websocket.SendResult;
+import javax.websocket.Session;
 
 import websocket.drawboard.wsmessages.AbstractWebsocketMessage;
 import websocket.drawboard.wsmessages.BinaryWebsocketMessage;
+import websocket.drawboard.wsmessages.CloseWebsocketMessage;
 import websocket.drawboard.wsmessages.StringWebsocketMessage;
 
 /**
- * Represents a client with methods to send messages.
+ * Represents a client with methods to send messages asynchronously.
  */
 public class Client {
 
-private final RemoteEndpoint.Async async;
+private final Session session;
+private final Async async;
 
 /**
  * Contains the messages wich are buffered until the previous
@@ -43,11 +49,30 @@ public class Client {
  * If this client is currently sending a messages asynchronously.
  */
 private volatile boolean isSendingMessage = false;
+/**
+ * If this client is closing. If true, new messages to
+ * send will be ignored.
+ */
+private volatile boolean isClosing = false;
+/**
+ * The length of all current buffered messages, to avoid iterating
+ * over a linked list.
+ */
+private volatile long messagesToSendLength = 0;
 
-public Client(RemoteEndpoint.Async async) {
-this.async = async;
+public Client(Session session) {
+this.session = session;
+this.async = session.getAsyncRemote();
 }
 
+/**
+ * Asynchronously closes the Websocket session. This will wait until all
+ * remaining messages have been sent to the Client and then close
+ * the Websocket session.
+ */
+public void close() {
+sendMessage(new CloseWebsocketMessage());
+}
 
 /**
  * Sends the given message asynchronously to the client.
@@ -59,23 +84,71 @@ public class Client {
  */
 public void sendMessage(AbstractWebsocketMessage msg) {
 synchronized (messagesToSend) {
-if (isSendingMessage) {
-// TODO: Check if the buffered messages exceed
-// a specific amount - in that case, disconnect the client
-// to prevent DoS.
-
-// TODO: Check if the last message is a
-// String message - in that case we should concatenate them
-// to reduce TCP overhead (using ";" as separator).
-
-messagesToSend.add(msg);
-} else {
-isSendingMessage = true;
-internalSendMessageAsync(msg);
+if (!isClosing) {
+// Check if we have a Close message
+if (msg instanceof CloseWebsocketMessage) {
+isClosing = true;
+}
+
+if (isSendingMessage) {
+// Check if the buffered messages exceed
+// a specific amount - in that case, disconnect the client
+// to prevent DoS.
+// In this case we check if there are >= 1000 messages
+// or length(of all messages) >= 100 bytes.
+if (messagesToSend.size() >= 1000
+|| messagesToSendLength >= 100) {
+isClosing = true;
+
+// Discard the new message and close the session 
immediately.
+CloseReason cr = new CloseReason(
+CloseCodes.VIOLATED_POLICY,
+"

[Bug 55639] Add Drawboard Websocket Example

2013-10-08 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55639

Konstantin Preißer  changed:

   What|Removed |Added

  Component|Examples|Examples
Product|Tomcat 8|Tomcat 7
   Target Milestone||---

--- Comment #3 from Konstantin Preißer  ---
(In reply to Mark Thomas from comment #2)
> Trunk (a.k.a. 8.0.x) is Commit-the-Review so go for it. So is 7.0.x for that
> matter, but I'd recommend against an immediate back-port. Get everything
> sorted in 8 and then back-port.

OK, thank you.

This has been fixed in trunk and will be included in 8.0.0-RC4 onwards.

I'm leaving the bug open against 7.0.x to look at backporting later.

-- 
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: r1530342 - in /tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard: DrawboardEndpoint.java Room.java

2013-10-08 Thread kpreisser
Author: kpreisser
Date: Tue Oct  8 16:39:40 2013
New Revision: 1530342

URL: http://svn.apache.org/r1530342
Log:
- Use "100" as maximum number of players instead of "2" that was for debug 
purposes only.
- If a player couldn't enter the room, close the connection.

Modified:

tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Room.java

Modified: 
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java?rev=1530342&r1=1530341&r2=1530342&view=diff
==
--- 
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java
 (original)
+++ 
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java
 Tue Oct  8 16:39:40 2013
@@ -85,6 +85,8 @@ public final class DrawboardEndpoint ext
 // reached.
 client.sendMessage(new StringWebsocketMessage(
 "0" + ex.getLocalizedMessage()));
+// Close the connection.
+client.close();
 }
 
 } catch (RuntimeException ex) {

Modified: 
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Room.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Room.java?rev=1530342&r1=1530341&r2=1530342&view=diff
==
--- tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Room.java 
(original)
+++ tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Room.java 
Tue Oct  8 16:39:40 2013
@@ -125,7 +125,7 @@ public final class Room {
 /**
  * The maximum number of players that can join this room.
  */
-private static final int MAX_PLAYER_COUNT = 2;
+private static final int MAX_PLAYER_COUNT = 100;
 
 /**
  * List of all currently joined players.
@@ -168,7 +168,8 @@ public final class Room {
  */
 public Player createAndAddPlayer(Client client) {
 if (players.size() >= MAX_PLAYER_COUNT) {
-throw new IllegalStateException("MAX_PLAYER_COUNT has been 
reached.");
+throw new IllegalStateException("Maximum player count ("
++ MAX_PLAYER_COUNT + ") has been reached.");
 }
 
 Player p = new Player(this, client);



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



[Bug 53281] Tomcat returns garbage data with HTTP/0.9 200 OK header when SSL port is accessed using http

2013-10-08 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=53281

--- Comment #10 from Christopher Schultz  ---
Note that I tested this with Tomcat 8 trunk.

$ keytool -genkey -alias tomcat  -keystore ~/.keystore -keyalg RSA -keysize
4096
Enter keystore password:  
Re-enter new password: 
What is your first and last name?
  [Unknown]:  Christopher Schultz
What is the name of your organizational unit?
  [Unknown]:  Testing
What is the name of your organization?
  [Unknown]:  Snake Oil, Ltd.
What is the name of your City or Locality?
  [Unknown]:  Washington
What is the name of your State or Province?
  [Unknown]:  District of Columbia
What is the two-letter country code for this unit?
  [Unknown]:  US
Is CN=Christopher Schultz, OU=Testing, O="Snake Oil, Ltd.", L=Washington,
ST=District of Columbia, C=US correct?
  [no]:  yes

Enter key password for 
(RETURN if same as keystore password):  [left blank]

I Modified your  slightly to match the key alias from the Tomcat
documentation:



$ curl -f http://localhost:9876
curl: (52) Empty reply from server

$ telnet localhost 9876
Trying ::1...
Connected to localhost.
Escape character is '^]'.
GET /
Connection closed by foreign host.

$ telnet localhost 9876
Trying ::1...
Connected to localhost.
Escape character is '^]'.
GET / HTTP/1.1
Connection closed by foreign host.

Tomcat is behaving as expected, here. I can test against Tomcat 6 to help
corroborate, but I want to make sure that I have my process correct. To those
who have reported problems, please verify that my steps-to-reproduce are
correct.

-- 
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: r1530348 - /tomcat/trunk/webapps/examples/websocket/drawboard.xhtml

2013-10-08 Thread kpreisser
Author: kpreisser
Date: Tue Oct  8 16:53:39 2013
New Revision: 1530348

URL: http://svn.apache.org/r1530348
Log:
Fix error in JavaScript code.

Modified:
tomcat/trunk/webapps/examples/websocket/drawboard.xhtml

Modified: tomcat/trunk/webapps/examples/websocket/drawboard.xhtml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/websocket/drawboard.xhtml?rev=1530348&r1=1530347&r2=1530348&view=diff
==
--- tomcat/trunk/webapps/examples/websocket/drawboard.xhtml (original)
+++ tomcat/trunk/webapps/examples/websocket/drawboard.xhtml Tue Oct  8 16:53:39 
2013
@@ -148,6 +148,7 @@
 var thicknessContainers;
 
 
+var labelContainer = document.getElementById("labelContainer");
 var placeholder = document.createElement("div");
 placeholder.appendChild(document.createTextNode("Loading... 
"));
 var progressElem = document.createElement("progress");
@@ -395,7 +396,6 @@
 }
 
 function startControls() {
-var labelContainer = 
document.getElementById("labelContainer");
 labelContainer.removeChild(placeholder);
 placeholder = undefined;
 



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



[Bug 55639] Add Drawboard Websocket Example

2013-10-08 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55639

--- Comment #4 from Christopher Schultz  ---
Is there any reason to bother sending a PNG image to begin with? Why not just
store all the mutations (i.e. draw commands) on the server and send those to
the clients when they connect? If you did that, you could also avoid performing
any AWT operations on the server.

I suppose as a demo it's nice to see how to handle both binary and text-based
data in one example.

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

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



[Bug 55639] Add Drawboard Websocket Example

2013-10-08 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55639

--- Comment #5 from Konstantin Preißer  ---
Hi Christopher,

(In reply to Christopher Schultz from comment #4)
> Is there any reason to bother sending a PNG image to begin with? Why not
> just store all the mutations (i.e. draw commands) on the server and send
> those to the clients when they connect? If you did that, you could also
> avoid performing any AWT operations on the server.
> 
> I suppose as a demo it's nice to see how to handle both binary and
> text-based data in one example.

The reason for sending a PNG at the beginning is because otherwise the server
would need to store a huge amount of draw commands so that the client can
reconstruct the generated image (because you can never remove a drawed path -
you can only overwrite them with your own). This would need a lot of CPU usage
at the client and a lot of space on the server.
Also the server would need some logic to detect if a previously draw command is
not needed because it is completely overlapped with other draw commands, etc.

Therefore I chose to have a current representation of the room image at the
server which is sent to the clients at the start of a session.

-- 
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: r1530354 - /tomcat/trunk/webapps/docs/changelog.xml

2013-10-08 Thread markt
Author: markt
Date: Tue Oct  8 17:11:02 2013
New Revision: 1530354

URL: http://svn.apache.org/r1530354
Log:
Tab police

Modified:
tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1530354&r1=1530353&r2=1530354&view=diff
==
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Tue Oct  8 17:11:02 2013
@@ -261,7 +261,7 @@
 Preißer. (markt)
   
  
-   55639: Add a Drawboard WebSocket example. (kpreisser)
+55639: Add a Drawboard WebSocket example. (kpreisser)
  
 
   



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



svn commit: r1530355 - /tomcat/trunk/webapps/docs/changelog.xml

2013-10-08 Thread markt
Author: markt
Date: Tue Oct  8 17:12:07 2013
New Revision: 1530355

URL: http://svn.apache.org/r1530355
Log:
More tab police

Modified:
tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1530355&r1=1530354&r2=1530355&view=diff
==
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Tue Oct  8 17:12:07 2013
@@ -260,9 +260,9 @@
 the documentation web application. Patches provided by Konstantin
 Preißer. (markt)
   
- 
+  
 55639: Add a Drawboard WebSocket example. (kpreisser)
- 
+  
 
   
   



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



svn commit: r1530353 - in /tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard: Client.java DrawMessage.java DrawboardEndpoint.java Room.java wsmessages/CloseWebsocketMessage.java

2013-10-08 Thread markt
Author: markt
Date: Tue Oct  8 17:09:29 2013
New Revision: 1530353

URL: http://svn.apache.org/r1530353
Log:
Add missing license header.
Remove trailing whitespace.
Fix Javadoc errors.
Remove some blank lines.

Modified:

tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Client.java

tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawMessage.java

tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Room.java

tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/wsmessages/CloseWebsocketMessage.java

Modified: 
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Client.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Client.java?rev=1530353&r1=1530352&r2=1530353&view=diff
==
--- 
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Client.java 
(original)
+++ 
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Client.java 
Tue Oct  8 17:09:29 2013
@@ -78,7 +78,7 @@ public class Client {
  * Sends the given message asynchronously to the client.
  * If there is already a async sending in progress, then the message
  * will be buffered and sent when possible.
- * 
+ *
  * This method can be called from multiple threads.
  * @param msg
  */
@@ -111,7 +111,7 @@ public class Client {
 }
 
 } else {
-
+
 // Check if the last message and the new message are
 // String messages - in that case we concatenate them
 // to reduce TCP overhead (using ";" as separator).

Modified: 
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawMessage.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawMessage.java?rev=1530353&r1=1530352&r2=1530353&view=diff
==
--- 
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawMessage.java
 (original)
+++ 
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawMessage.java
 Tue Oct  8 17:09:29 2013
@@ -24,13 +24,12 @@ import java.awt.Graphics2D;
  * A message that represents a drawing action.
  * Note that we use primitive types instead of Point, Color etc.
  * to reduce object allocation.
- * 
+ *
  * TODO: But a Color objects needs to be created anyway for drawing this
  * onto a Graphics2D object, so this probably does not save much.
  */
 public final class DrawMessage {
 
-
 private int type;
 private byte colorR, colorG, colorB, colorA;
 private double thickness;
@@ -38,7 +37,6 @@ public final class DrawMessage {
 
 /**
  * The type. 1: Line.
- * @return
  */
 public int getType() {
 return type;
@@ -156,7 +154,7 @@ public final class DrawMessage {
 public static DrawMessage parseFromString(String str)
 throws ParseException {
 
-int type; 
+int type;
 byte[] colors = new byte[4];
 double thickness;
 int[] coords = new int[4];

Modified: 
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java?rev=1530353&r1=1530352&r2=1530353&view=diff
==
--- 
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java
 (original)
+++ 
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/DrawboardEndpoint.java
 Tue Oct  8 17:09:29 2013
@@ -49,7 +49,7 @@ public final class DrawboardEndpoint ext
 /**
  * The player that is associated with this Endpoint and the current room.
  * Note that this variable is only accessed from the Room Thread.
- * 
+ *
  * TODO: Currently, Tomcat uses an Endpoint instance once - however
  * the java doc of endpoint says:
  * "Each instance of a websocket endpoint is guaranteed not to be called by
@@ -193,7 +193,7 @@ public final class DrawboardEndpoint ext
 } catch (RuntimeException|ParseException ex) {
 // Client sent invalid data.
 // Ignore, TODO: maybe close connection
-if (dontSwallowException 
+if (dontSwallowException
 && ex instanceof RuntimeException) {
 throw (RuntimeException) ex;
 }

Modified: 
tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/drawboard/Room.java
U

setting handler in AbstractEndpont

2013-10-08 Thread Niki Dokovski
Hi,
Is there a good reason why AbstractEndpoint in coyote does not have an
association with Handler through an abstract getter and setter? All
concrete implementations of AbstractEndpoint
[AprEndpoint,JIoEndpoint,NioEndpoint] provide a getter and a setter of a
AbstractEndpoint.Handler

Cheers
Niki


Re: setting handler in AbstractEndpont

2013-10-08 Thread Mark Thomas
On 08/10/2013 19:46, Niki Dokovski wrote:
> Hi,
> Is there a good reason why AbstractEndpoint in coyote does not have an
> association with Handler through an abstract getter and setter? All
> concrete implementations of AbstractEndpoint
> [AprEndpoint,JIoEndpoint,NioEndpoint] provide a getter and a setter of a
> AbstractEndpoint.Handler

No they don't. The getters and setters use the endpoint specific Handler.

Mark


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



Re: setting handler in AbstractEndpont

2013-10-08 Thread Niki Dokovski
On Tue, Oct 8, 2013 at 9:52 PM, Mark Thomas  wrote:

> On 08/10/2013 19:46, Niki Dokovski wrote:
> > Hi,
> > Is there a good reason why AbstractEndpoint in coyote does not have an
> > association with Handler through an abstract getter and setter? All
> > concrete implementations of AbstractEndpoint
> > [AprEndpoint,JIoEndpoint,NioEndpoint] provide a getter and a setter of a
> > AbstractEndpoint.Handler
>
> No they don't. The getters and setters use the endpoint specific Handler.
>

Yep that's true. Just spotted that in all of the Protocols implementations
[Http11AprProtocol, Http11NioProtocol and Http11Protocol] there is
duplication of the initialization of the handler in the constructors, so I
though of some potential options for cleanup.

What I am doing is to go through the coyote code and try to get a better
understanding of it by providing yet another "dummy" protocol
implementation. :)


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


svn commit: r1530399 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/coyote/http11/upgrade/NioServletOutputStream.java

2013-10-08 Thread markt
Author: markt
Date: Tue Oct  8 19:18:49 2013
New Revision: 1530399

URL: http://svn.apache.org/r1530399
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=55638
Fix the corruption of large WebSocket messages when using the NIO connector.

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

tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/upgrade/NioServletOutputStream.java

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

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/upgrade/NioServletOutputStream.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/upgrade/NioServletOutputStream.java?rev=1530399&r1=1530398&r2=1530399&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/upgrade/NioServletOutputStream.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/upgrade/NioServletOutputStream.java
 Tue Oct  8 19:18:49 2013
@@ -59,6 +59,7 @@ public class NioServletOutputStream exte
 
 writtenThisLoop = doWriteInternal(block, b, offset, writeThisLoop);
 count += writtenThisLoop;
+offset += writtenThisLoop;
 leftToWrite -= writtenThisLoop;
 
 if (writtenThisLoop < writeThisLoop) {



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



svn commit: r1530397 - /tomcat/trunk/java/org/apache/coyote/http11/upgrade/NioServletOutputStream.java

2013-10-08 Thread markt
Author: markt
Date: Tue Oct  8 19:18:04 2013
New Revision: 1530397

URL: http://svn.apache.org/r1530397
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=55638
Fix the corruption of large WebSocket messages when using the NIO connector.

Modified:

tomcat/trunk/java/org/apache/coyote/http11/upgrade/NioServletOutputStream.java

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/upgrade/NioServletOutputStream.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/NioServletOutputStream.java?rev=1530397&r1=1530396&r2=1530397&view=diff
==
--- 
tomcat/trunk/java/org/apache/coyote/http11/upgrade/NioServletOutputStream.java 
(original)
+++ 
tomcat/trunk/java/org/apache/coyote/http11/upgrade/NioServletOutputStream.java 
Tue Oct  8 19:18:04 2013
@@ -59,6 +59,7 @@ public class NioServletOutputStream exte
 
 writtenThisLoop = doWriteInternal(block, b, offset, writeThisLoop);
 count += writtenThisLoop;
+offset += writtenThisLoop;
 leftToWrite -= writtenThisLoop;
 
 if (writtenThisLoop < writeThisLoop) {



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



svn commit: r1530418 - /tomcat/trunk/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java

2013-10-08 Thread markt
Author: markt
Date: Tue Oct  8 20:56:49 2013
New Revision: 1530418

URL: http://svn.apache.org/r1530418
Log:
Clear the handler then close the connection so the handler gets to the the 
exception that caused the problem rather than any exception that may happen 
during close.

Modified:

tomcat/trunk/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java

Modified: 
tomcat/trunk/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java?rev=1530418&r1=1530417&r2=1530418&view=diff
==
--- 
tomcat/trunk/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
 (original)
+++ 
tomcat/trunk/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
 Tue Oct  8 20:56:49 2013
@@ -89,18 +89,18 @@ public class WsRemoteEndpointImplServer 
 }
 if (complete) {
 wsWriteTimeout.unregister(this);
+clearHandler(null);
 if (close) {
 close();
 }
-clearHandler(null);
 break;
 }
 }
 
 } catch (IOException ioe) {
 wsWriteTimeout.unregister(this);
-close();
 clearHandler(ioe);
+close();
 }
 if (!complete) {
 // Async write is in progress



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



svn commit: r1530421 - /tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java

2013-10-08 Thread markt
Author: markt
Date: Tue Oct  8 21:03:15 2013
New Revision: 1530421

URL: http://svn.apache.org/r1530421
Log:
Fix infinite loop issue triggered by the test case for BZ 55638

Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java?rev=1530421&r1=1530420&r2=1530421&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java Tue Oct  8 
21:03:15 2013
@@ -97,7 +97,7 @@ public abstract class WsFrameBase {
 protected void processInputBuffer() throws IOException {
 while (true) {
 wsSession.updateLastActive();
-
+System.out.println("pos0 readPos [" + readPos + "] writePos [" + 
writePos + "]");
 if (state == State.NEW_FRAME) {
 if (!processInitialHeader()) {
 break;
@@ -108,17 +108,21 @@ public abstract class WsFrameBase {
 throw new IOException(sm.getString("wsFrame.closed"));
 }
 }
+System.out.println("pos1 readPos [" + readPos + "] writePos [" + 
writePos + "]");
 if (state == State.PARTIAL_HEADER) {
 if (!processRemainingHeader()) {
 break;
 }
 }
+System.out.println("pos2 readPos [" + readPos + "] writePos [" + 
writePos + "]");
 if (state == State.DATA) {
 if (!processData()) {
 break;
 }
 }
+System.out.println("pos3 readPos [" + readPos + "] writePos [" + 
writePos + "]");
 }
+System.out.println("pos4 readPos [" + readPos + "] writePos [" + 
writePos + "]");
 }
 
 
@@ -266,14 +270,16 @@ public abstract class WsFrameBase {
 
 
 private boolean processData() throws IOException {
-checkRoomPayload();
+boolean result;
 if (Util.isControl(opCode)) {
-return processDataControl();
+result = processDataControl();
 } else if (textMessage) {
-return processDataText();
+result = processDataText();
 } else {
-return processDataBinary();
+result = processDataBinary();
 }
+checkRoomPayload();
+return result;
 }
 
 



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



[Bug 55638] [websocket] Tomcat corrupts binary websocket messages when using the NIO connector

2013-10-08 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55638

Mark Thomas  changed:

   What|Removed |Added

 OS||All

--- Comment #1 from Mark Thomas  ---
All fixed in trunk. Need to test a little more before back-porting.

-- 
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: r1530423 - /tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java

2013-10-08 Thread markt
Author: markt
Date: Tue Oct  8 21:07:23 2013
New Revision: 1530423

URL: http://svn.apache.org/r1530423
Log:
Whoops. Remove the debug code.

Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java?rev=1530423&r1=1530422&r2=1530423&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java Tue Oct  8 
21:07:23 2013
@@ -97,7 +97,6 @@ public abstract class WsFrameBase {
 protected void processInputBuffer() throws IOException {
 while (true) {
 wsSession.updateLastActive();
-System.out.println("pos0 readPos [" + readPos + "] writePos [" + 
writePos + "]");
 if (state == State.NEW_FRAME) {
 if (!processInitialHeader()) {
 break;
@@ -108,21 +107,17 @@ public abstract class WsFrameBase {
 throw new IOException(sm.getString("wsFrame.closed"));
 }
 }
-System.out.println("pos1 readPos [" + readPos + "] writePos [" + 
writePos + "]");
 if (state == State.PARTIAL_HEADER) {
 if (!processRemainingHeader()) {
 break;
 }
 }
-System.out.println("pos2 readPos [" + readPos + "] writePos [" + 
writePos + "]");
 if (state == State.DATA) {
 if (!processData()) {
 break;
 }
 }
-System.out.println("pos3 readPos [" + readPos + "] writePos [" + 
writePos + "]");
 }
-System.out.println("pos4 readPos [" + readPos + "] writePos [" + 
writePos + "]");
 }
 
 
@@ -276,7 +271,7 @@ public abstract class WsFrameBase {
 } else if (textMessage) {
 result = processDataText();
 } else {
-result = processDataBinary();
+return processDataBinary();
 }
 checkRoomPayload();
 return result;



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



svn commit: r1530426 - /tomcat/trunk/webapps/examples/WEB-INF/web.xml

2013-10-08 Thread markt
Author: markt
Date: Tue Oct  8 21:11:49 2013
New Revision: 1530426

URL: http://svn.apache.org/r1530426
Log:
Add .xhtml to the welcome files for the examples webapp

Modified:
tomcat/trunk/webapps/examples/WEB-INF/web.xml

Modified: tomcat/trunk/webapps/examples/WEB-INF/web.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/web.xml?rev=1530426&r1=1530425&r2=1530426&view=diff
==
--- tomcat/trunk/webapps/examples/WEB-INF/web.xml (original)
+++ tomcat/trunk/webapps/examples/WEB-INF/web.xml Tue Oct  8 21:11:49 2013
@@ -387,4 +387,11 @@
   /servlets/nonblocking/numberwriter
 
 
+
+index.html
+index.xhtml
+index.htm
+index.jsp
+
+
 



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



RE: svn commit: r1530081 - /tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java

2013-10-08 Thread Konstantin Preißer
Hi Mark,

> -Original Message-
> From: Mark Thomas [mailto:ma...@apache.org]
> Sent: Tuesday, October 8, 2013 3:57 PM
> To: Tomcat Developers List
> Subject: Re: svn commit: r1530081 -
> /tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
> 
> 
> None. I've seem the same problem but haven't got to the bottom of it
> yet. What I do know is:
> - Tomcat doesn't send a close
> - The browser closes the connection on its own
> - Tomcat tries (and fails) to write some data and that triggers the
>   close on the Tomcat side
> 
> I'm wondering if some form of data corruption could be the trigger.
> 
> Whatever is going on, I'm fairly sure it is a different issue to BZ 55633.
> 
> I need to do some more careful analysis with Wireshark.

OK, thanks.

Note: When I tested this scenario, I got a slightly other result: For me, 
Tomcat initiated the shutdown of TCP connection. (And another issue: When/After 
this happens, if the browser tries to establishes a new Websocket connection 
(with a Upgrade: ... header) then tomcat sometimes shuts down the TCP 
connection without sending a reply).

Some more background:
I wrote a program in .Net/C# that can forward TCP connections by listening on a 
local TCP port and forwarding incoming TCP connections to a remote host. It 
logs events (local/remote connection opened, closed, aborted; data received) 
and it is able to "pause" one side of a connection (e.g. the transfer of data 
from client to server and from server to client). When pausing, it stops to 
read from the corresponding side of the TCP connections, and after resuming, 
continues to read from them.

I used it to debug the problems simulating a browser that stops to read from 
the connection and then some time later continues to read from it (instead of 
suspending the browser process).

Now, when I'm pausing the transfer from Tomcat to the browser (so that the 
other snakes stop moving) and continuing it, I can see that Tomcat initiates 
the shutdown of the TCP connection, and after that the browser aborts the 
connection. E.g. when I pause the transfer, then resume it and immediately 
pause it again, then about 1 second later one snake disappears on the other 
browser but the browser connected to the forwarder program has its Websocket 
connection still opened. When I resume the data transfer then the browser 
receives the connection shutdown and aborts the connection.
If you (or anybody else) have interest I can share the sources (and binaries) 
of the program to help debugging the problems.


Regards,
Konstantin Preißer


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



svn commit: r1530436 - /tomcat/trunk/webapps/examples/WEB-INF/web.xml

2013-10-08 Thread markt
Author: markt
Date: Tue Oct  8 21:47:15 2013
New Revision: 1530436

URL: http://svn.apache.org/r1530436
Log:
Ensure the examples webapp starts when validation is enabled.

Modified:
tomcat/trunk/webapps/examples/WEB-INF/web.xml

Modified: tomcat/trunk/webapps/examples/WEB-INF/web.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/web.xml?rev=1530436&r1=1530435&r2=1530436&view=diff
==
--- tomcat/trunk/webapps/examples/WEB-INF/web.xml (original)
+++ tomcat/trunk/webapps/examples/WEB-INF/web.xml Tue Oct  8 21:47:15 2013
@@ -369,8 +369,8 @@
 
 
 
-  nonblocking.ByteCounter
   bytecounter
+  nonblocking.ByteCounter
   true
 
 
@@ -378,8 +378,8 @@
   /servlets/nonblocking/bytecounter
 
 
-  nonblocking.NumberWriter
   numberwriter
+  nonblocking.NumberWriter
   true
 
 



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



svn commit: r1530445 - /tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java

2013-10-08 Thread markt
Author: markt
Date: Tue Oct  8 22:05:17 2013
New Revision: 1530445

URL: http://svn.apache.org/r1530445
Log:
Fix the fix in r1530423

Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java

Modified: tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java?rev=1530445&r1=1530444&r2=1530445&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java Tue Oct  8 
22:05:17 2013
@@ -271,7 +271,7 @@ public abstract class WsFrameBase {
 } else if (textMessage) {
 result = processDataText();
 } else {
-return processDataBinary();
+result = processDataBinary();
 }
 checkRoomPayload();
 return result;



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



svn commit: r1530449 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java

2013-10-08 Thread markt
Author: markt
Date: Tue Oct  8 22:32:33 2013
New Revision: 1530449

URL: http://svn.apache.org/r1530449
Log:
Clear the handler then close the connection so the handler gets to the the 
exception that caused the problem rather than any exception that may happen 
during close.

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

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1523555,1530418

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java?rev=1530449&r1=1530448&r2=1530449&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
 Tue Oct  8 22:32:33 2013
@@ -89,18 +89,18 @@ public class WsRemoteEndpointImplServer 
 }
 if (complete) {
 wsWriteTimeout.unregister(this);
+clearHandler(null);
 if (close) {
 close();
 }
-clearHandler(null);
 break;
 }
 }
 
 } catch (IOException ioe) {
 wsWriteTimeout.unregister(this);
-close();
 clearHandler(ioe);
+close();
 }
 if (!complete) {
 // Async write is in progress



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



svn commit: r1530448 - /tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java

2013-10-08 Thread markt
Author: markt
Date: Tue Oct  8 22:31:52 2013
New Revision: 1530448

URL: http://svn.apache.org/r1530448
Log:
Move comment to go with code that was moved earlier

Modified:

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java?rev=1530448&r1=1530447&r2=1530448&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/server/WsRemoteEndpointImplServer.java
 Tue Oct  8 22:31:52 2013
@@ -92,11 +92,6 @@ public class WsRemoteEndpointImplServer 
 if (close) {
 close();
 }
-// Setting the result marks this (partial) message as
-// complete which means the next one may be sent which
-// could update the value of the handler. Therefore, keep a
-// local copy before signalling the end of the (partial)
-// message.
 clearHandler(null);
 break;
 }
@@ -150,6 +145,11 @@ public class WsRemoteEndpointImplServer 
 
 
 private void clearHandler(Throwable t) {
+// Setting the result marks this (partial) message as
+// complete which means the next one may be sent which
+// could update the value of the handler. Therefore, keep a
+// local copy before signalling the end of the (partial)
+// message.
 SendHandler sh = handler;
 handler = null;
 if (sh != null) {



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



svn commit: r1530451 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/websocket/WsFrameBase.java

2013-10-08 Thread markt
Author: markt
Date: Tue Oct  8 22:34:19 2013
New Revision: 1530451

URL: http://svn.apache.org/r1530451
Log:
Fix infinite loop issue triggered by the test case for BZ 55638

Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1530421,1530423,1530445

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java?rev=1530451&r1=1530450&r2=1530451&view=diff
==
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/websocket/WsFrameBase.java Tue 
Oct  8 22:34:19 2013
@@ -97,7 +97,6 @@ public abstract class WsFrameBase {
 protected void processInputBuffer() throws IOException {
 while (true) {
 wsSession.updateLastActive();
-
 if (state == State.NEW_FRAME) {
 if (!processInitialHeader()) {
 break;
@@ -266,14 +265,16 @@ public abstract class WsFrameBase {
 
 
 private boolean processData() throws IOException {
-checkRoomPayload();
+boolean result;
 if (Util.isControl(opCode)) {
-return processDataControl();
+result = processDataControl();
 } else if (textMessage) {
-return processDataText();
+result = processDataText();
 } else {
-return processDataBinary();
+result = processDataBinary();
 }
+checkRoomPayload();
+return result;
 }
 
 



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



[Bug 55638] [websocket] Tomcat corrupts binary websocket messages when using the NIO connector

2013-10-08 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=55638

Mark Thomas  changed:

   What|Removed |Added

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

--- Comment #2 from Mark Thomas  ---
Autobahn tests pass. CI system looks OK. Changes have been back-ported to 7.0.x

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

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



[Bug 53281] Tomcat returns garbage data with HTTP/0.9 200 OK header when SSL port is accessed using http

2013-10-08 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=53281

Mark Thomas  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution|--- |INVALID

--- Comment #11 from Mark Thomas  ---
Tested with 6.0.x and confirmed that:

- connecting to the https port using http with a browser returns garbage (as
expected)
- connecting to the https port with telnet and sending a valid HTTP request
list results in garbage being returned and the connection closed (as expected)
- at no point is an HTTP/0.9 response line returned

My comment #1 from over a year ago stands.

-- 
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: r1530081 - /tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java

2013-10-08 Thread Konstantin Preißer
Mark,

> > -Original Message-
> > From: Mark Thomas [mailto:ma...@apache.org]
> > Sent: Tuesday, October 8, 2013 3:57 PM
> > To: Tomcat Developers List
> > Subject: Re: svn commit: r1530081 -
> > /tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
> >
> >
> > None. I've seem the same problem but haven't got to the bottom of it
> > yet. What I do know is:
> > - Tomcat doesn't send a close
> > - The browser closes the connection on its own
> > - Tomcat tries (and fails) to write some data and that triggers the
> >   close on the Tomcat side
> >
> > I'm wondering if some form of data corruption could be the trigger.
> >
> > Whatever is going on, I'm fairly sure it is a different issue to BZ 55633.
> >
> > I need to do some more careful analysis with Wireshark.
> 
> OK, thanks.
> 
> Note: When I tested this scenario, I got a slightly other result: For me, 
> Tomcat
> initiated the shutdown of TCP connection. (And another issue: When/After
> this happens, if the browser tries to establishes a new Websocket
> connection (with a Upgrade: ... header) then tomcat sometimes shuts down
> the TCP connection without sending a reply).

I do now see the behavior which you described, but with the NIO connector: 
There the browser is the one which closes the connection (probably due to a 
data corruption).

E.g. when redirecting IE and make it stop to read incoming data for ~ 30 
seconds, then make it to continue reading, IE will display (translated from 
german): "SCRIPT12152: WebSocket Error: Network Error 12152, The server sent an 
invalid or unknown reply" and reset the TCP connection.

When I tried this with FF, it first seemed that here Tomcat was the one which 
initiated a normal TCP shutdown, but on more debugging it seems that Firefox 
stopped at some point to process the received messages and then sent something 
like a Websocket Close message so that Tomcat closes the connection (when 
pausing the Firefox -> Tomcat connection prior to unpausing Tomcat -> Firefox 
direction, Tomcat continues to send data).

When trying with APR, I keep seeing that Tomcat initates the connection 
shutdown.

With BIO, the problems don't occur.


Hope this helps,


Regards,
Konstantin Preißer


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



Proposal for a more flexible tomcat embedding api

2013-10-08 Thread Adib Saikali
Hi,

I am a long time tomcat user over the past few months I have started to use 
embedded tomcat, in the process I have discovered a few limitations and I want 
to make the following proposal to fix these issues.

Tomcat Builder Proposal:


This proposal outlines a design for an API that will make embedding tomcat easy 
without sacrificing the ability to customize the tomcat configuration as 
provided by
 server.xml and files in /conf.

You are probably thinking that we already have Tomcat.class for making 
embedding easier. However, There are many settings that are easy to configure 
in server.xml which are not easy or not possible to configure with Tomcat.class 
for example.

  * Configuring multiple connectors 
  * Adding valves
  * Configuring a cluster
  * Defining Resources such as DataSources / Mail Sessions
  * Setting a default web.xml for tomcat
  * Setting the properties found in catalina.properties 

Bottom line is that when you want to embed tomcat with a production like custom 
configuration 
the current tomcat class does not provide enough apis to make it possible to do 
what you want. 

What I am proposing is a new embedding API under org.apache.tomcat.builder 
that will provide an embedding api with the following goals.

  * Everything that can be configured via server.xml, or catalina.properties or 
any file found
 in /conf folder can be configured via the tomcat builder api. As a user I can 
be 100% confident
 that I can programmatically control every aspect of tomcat. 

  * The API builds on the existing structure of the xml configuration and the 
existing documentation. Someone who knows how to do something with 
configuration files should be able to correctly guess how to do the same thing 
with the embedding API without having to read the Java doc or  sample code. 

  * The reference documentation for tomcat configuration should be applicable 
to the embedding api so that existing documentation does not need to be updated 
and can just be reused. 


  * One liner start that allows a default configuration of tomcat to be started 
with a single line of java code 

  * Total control start where every aspect of the configuration is customized 

Proposed Design: 

 * A fluent API that mirrors the major objects exposed via the XML elements 
example objects are 

  * ServerBuilder 
  * ServiceConfiguration
  * EngineConfiguration
  * ContextConfiguration
  * ValveConfiguration
  * ResourceConfiguration
  * ConnectorConfiguration 
  * …. Etc 

 * The fluent API will make it possible to build a graph of the configuration 
objects quickly & easily then call a build() method to get the configured 
Server object that can be started. 

* A DefaultServerConfiguration class that provides the ability to start tomcat 
with one line call using default settings as configured in the default 
server.xml that ships with tomcat.

* The API will be implemented for both Tomcat 7 and Tomcat 8

* The API will just work on top on an existing build you should be able to drop 
a tomcat-builder.jar into CATALINA_HOME\lib and have it be available

* The existing Tomcat class will not be touched. 

Simple start example Usage:

DefaultServer server = new DefaultServer();
server.deployAppDir("src/main/webapp", ).start();

Fluent Api with Customization Example:

ServerBuilder serverBuilder = new ServerBuilder();
serverBuilder.jspOn().shutdownPort(8006).shutdownString("shutdown");
Server server = serverBuilder.build();
server.start();
server.await();

Code Repo: 

https://github.com/asaikali/tomcat-builder contains a very early version of 
this API it is just work in progress after only a few hours of work there is 
enough there to get a better idea of what I am proposing.

If you are wondering why as a user why you want to embed tomcat please refer to 
my slides on this topic from. 

 * Java One 2013 - https://bitbucket.org/asaikali/javaone-tomcat-embedding
 * Toronto JUG - https://bitbucket.org/asaikali/tjug-tomcat-embedding

What I am looking for are answers to the following questions.

 1. Has anyone already done such as API?

 2. Would the tomcat committers accept an implementation of this proposal into 
the tomcat distribution ? 

 3. there still time to include such an API in tomcat 8?

 4.  Is there any chance that such a jar would be included in the core tomcat 7 
distribution as an add on jar in a future 7.x point release?

Cheers
Adib


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



[Bug 53281] Tomcat returns garbage data with HTTP/0.9 200 OK header when SSL port is accessed using http

2013-10-08 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=53281

--- Comment #12 from saurabh  ---
Created attachment 30912
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=30912&action=edit
HTTP 0.9 response from the server

I tried the identical steps that have been provided and the browser receives
garbage value with HTTP/0.9 response. I've attached the Live HTTP headers
capture of the same.

I've also tried using curl and telnet as indicated in the comments above.

Here is the output of both the commands:

[root@host ~]# curl -f http://myhost:9876
<-- blank line
Note: the blank line means the server is returning some response. Not the same
as has been indicated in the comments above.

[root@host ~]# telnet myhost 9876
Trying 10.10.10.1...
Connected to myhost (10.10.10.1).
Escape character is '^]'.
GET / HTTP/1.1

Connection closed by foreign host.

So, I tried running tcpdump to take the captures for all the three ways of
accessing the server namely Browser, Curl and Telnet and in each capture I saw
a response being received from the server.

Note: I'm using Firefox as the Browser but the behavior is consistent with IE
as well.

Note: I'm using JSSE with Tomcat for the SSL.

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