[Tomcat Wiki] Update of "FAQ/KnownIssues" by Jörgen Rydenius
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Tomcat Wiki" for change notification. The "FAQ/KnownIssues" page has been changed by Jörgen Rydenius: http://wiki.apache.org/tomcat/FAQ/KnownIssues?action=diff&rev1=7&rev2=8 Comment: Added a small comment about PD4ML, see reference in https://issues.apache.org/bugzilla/show_bug.cgi?id=52697 <> An alternative would be to write the Image contents to a ByteArrayOutputStream, and using its writeTo() method to write the contents to the Servlet's Response. However that would require some additional memory, as the contents have to be buffered. + '''Are there any other corresponding cases of this bug?''' + + The PDF generating software module PD4ML has had a corresponding problem when calling the render() methods in class org.zefer.pd4ml.PD4ML with response.getOutputStream() as argument. That causes the response stream to be closed from a finalizer() method of a class called PD4Device. When using an Apache/Tomcat connector, this unexpected stream close from the finalizer thread has occationally caused responses to be sent to wrong requestor (request/response mix up). The workarounds described above for ImageIO works perfectly in this case too. A general way to protect the response output streams from misbehaving web applications is to set the system property org.apache.catalina.connector.RECYCLE_FACADES=true, since that makes Tomcat create new stream instances for each request (of course at the cost of performance). + <> + <> + PD4ML has fixed this bug in their latest releases, but sites using older versions of the library can still be affected. + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: [VOTE] Release Apache Tomcat 7.0.26
2012/2/18 Mark Thomas : > The proposed Apache Tomcat 7.0.26 release is now available for voting. > > It can be obtained from: > https://dist.apache.org/repos/dist/dev/tomcat/tomcat-7/v7.0.26/ > The Maven staging repo is: > https://repository.apache.org/content/repositories/orgapachetomcat-020/ > The svn tag is: > http://svn.apache.org/repos/asf/tomcat/tc7.0.x/tags/TOMCAT_7_0_26/ > > The proposed 7.0.26 release is: > [ ] Broken - do not release > [X] Stable - go ahead and release as 7.0.26 Stable > +1 Tested by my simple test applications. There is no problem. -- Keiichi.Fujino - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1291155 - /tomcat/tc5.5.x/trunk/STATUS.txt
Author: kfujino Date: Mon Feb 20 09:01:18 2012 New Revision: 1291155 URL: http://svn.apache.org/viewvc?rev=1291155&view=rev Log: vote Modified: tomcat/tc5.5.x/trunk/STATUS.txt Modified: tomcat/tc5.5.x/trunk/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/STATUS.txt?rev=1291155&r1=1291154&r2=1291155&view=diff == --- tomcat/tc5.5.x/trunk/STATUS.txt (original) +++ tomcat/tc5.5.x/trunk/STATUS.txt Mon Feb 20 09:01:18 2012 @@ -40,5 +40,5 @@ PATCHES PROPOSED TO BACKPORT: * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=52677 Filters need to implement Filter http://people.apache.org/~markt/patches/2012-02-17-bug52677-tc5.patch - +1: markt, kkolinko + +1: markt, kkolinko, kfujino -1: - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: WebSocket progress report
On 20/02/2012 02:55, Petr Praus wrote: > Hi Mark, > I noticed you wrote a websocket test client, I haven't looked at it > extensively It won't take long to look at - it is a very simple client. > but I wanted to ask - have you considered using Autobahn for > testing? It's rather extensive opensource websocket testing suite. I haven't. I just took a quick look. Looks like a nice tool. My test client is intended to be something we can run in the unit tests to look at very specific issues. It isn't intended to be a general WebSocket client, nor to test the full range of functionality. I think Autobhan is something we would run separately - a bit like we do with the WebDAV test suite and the TCKs. > It already contains a lot of stuff we need to test including fragmentation > testing. Yep, it looks really good. I dread to think how many failures we'd get with the current code :) What we can do is to provide the necessary servlet that AutoBahn needs to talk to as part of the examples web app. That way, anyone can run the test suite with minimal effort. > On Fri, Feb 17, 2012 at 14:50, Mark Thomas wrote: > >> On 16/02/2012 04:01, Petr Praus wrote: >>> Hello, attached is our patch. It applies cleanly on top of current trunk >>> rev. 1244719. It has rudimentary support for fragmentation (callback >>> after last frame), supports close messages and ping/pong. Sorry for not >>> sending a patchset but I thought it wouldn't really make sense, since >>> there were quite a lot of back and forth changes. Let me know if I >>> should send a patchset instead. >> >> The final diff is fine to work with from my point of view. >> >>> >>> (Jonathan's summary) >>> "Echoing fragments. Close messages. Pings/pongs. >>> >>> Just barely works. :) Fragmentation support is very limited: a mere >>> callback when last frame received. >> >> Repeating what I already wrote in BZ on fragmentation so there is a >> complete set of review comments in one place >> >> I am extremely reluctant to apply the current fragmentation patch. It >> relies on buffering individual fragments and - given the maximum >> fragment size - that is simply not going to scale. This is why the >> current API is built on streams and does not buffer unless the message >> based API is used. >> >> I'd like to fully explore the possibility of supporting fragments >> without using buffering before starting down that path. >> > > I understand your concern, the main idea was that the logic that pertains > only to a single frame and the information about the frame itself should be > encapsulated there. What about letting the client code know there's a new > frame before we begin reading the data but still keep the frames > encapsulated in WebSocketFrame? Getting fragmentation support working with streams was easier than I expected. Essentially, just pushing the frame header processing code down into the InputStream was all that was required. I prefer the approach where the client gets one notification per 'message' rather than per frame. Need up is handling the control messages. Mark - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1291261 - /tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java
Author: markt Date: Mon Feb 20 13:58:42 2012 New Revision: 1291261 URL: http://svn.apache.org/viewvc?rev=1291261&view=rev Log: Fix problem observed running Autobahn WebSocket test suite. If an error occurs, an UpgradeProcessor could be added to the HttpProcessor pool leading to the failure of the subsequent request. Modified: tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java Modified: tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java?rev=1291261&r1=1291260&r2=1291261&view=diff == --- tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java (original) +++ tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java Mon Feb 20 13:58:42 2012 @@ -30,6 +30,7 @@ import javax.management.MalformedObjectN import javax.management.ObjectName; import org.apache.coyote.http11.upgrade.UpgradeInbound; +import org.apache.coyote.http11.upgrade.UpgradeProcessor; import org.apache.juli.logging.Log; import org.apache.tomcat.util.ExceptionUtils; import org.apache.tomcat.util.modeler.Registry; @@ -614,7 +615,10 @@ public abstract class AbstractProtocol i // less-than-verbose logs. getLog().error(sm.getString("ajpprotocol.proto.error"), e); } -release(socket, processor, true, false); +// Don't try to add upgrade processors back into the pool +if (!(processor instanceof UpgradeProcessor)) { +release(socket, processor, true, false); +} return SocketState.CLOSED; } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
DO NOT REPLY [Bug 52714] New: SSLProtocol with TLSv1+SSLv3 or SSLv3+TLSv1 does not work APR based Apache Tomcat Native 1.2.22
https://issues.apache.org/bugzilla/show_bug.cgi?id=52714 Bug #: 52714 Summary: SSLProtocol with TLSv1+SSLv3 or SSLv3+TLSv1 does not work APR based Apache Tomcat Native 1.2.22 Product: Tomcat Native Version: 1.1.22 Platform: Sun OS/Version: Solaris Status: NEW Severity: blocker Priority: P2 Component: Library AssignedTo: dev@tomcat.apache.org ReportedBy: marcmanth...@yahoo.com Classification: Unclassified Referring to http://svn.apache.org/viewvc/tomcat/native/branches/1.1.x/native/src/sslcontext.c?r1=1149279&view=log there something thats broke that does not support TLSv1+SSLv3. Tomcat Version 6.0.35 APR Details : INFO: Loaded APR based Apache Tomcat Native library 1.1.22. Feb 19, 2012 10:22:55 PM org.apache.catalina.core.AprLifecycleListener init INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true]. Tomcat Server.xml Error noticed in logs: -- Feb 19, 2012 10:22:57 PM org.apache.coyote.http11.Http11AprProtocol init SEVERE: Error initializing endpoint java.lang.Exception: An invalid value [TLSv1+SSLv3] was provided for the SSLProtocol attribute at org.apache.tomcat.util.net.AprEndpoint.init(AprEndpoint.java:724) at org.apache.coyote.http11.Http11AprProtocol.init(Http11AprProtocol.java:107) at org.apache.catalina.connector.Connector.initialize(Connector.java:1049) at org.apache.catalina.core.StandardService.initialize(StandardService.java:703) at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:838) at org.apache.catalina.startup.Catalina.load(Catalina.java:538) at org.apache.catalina.startup.Catalina.load(Catalina.java:562) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:261) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) Feb 19, 2012 10:22:57 PM org.apache.catalina.core.StandardService initialize SEVERE: Failed to initialize connector [Connector[HTTP/1.1-30002]] LifecycleException: Protocol handler initialization failed: java.lang.Exception: An invalid value [TLSv1+SSLv3] was provided for the SSLProtocol attribute at org.apache.catalina.connector.Connector.initialize(Connector.java:1051) at org.apache.catalina.core.StandardService.initialize(StandardService.java:703) at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:838) at org.apache.catalina.startup.Catalina.load(Catalina.java:538) at org.apache.catalina.startup.Catalina.load(Catalina.java:562) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:261) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) Feb 19, 2012 10:22:57 PM org.apache.coyote.ajp.AjpAprProtocol init Is there a work around to this issue. -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1291338 - /tomcat/maven-plugin/trunk/src/site/apt/executable-war-jar.apt.vm
Author: olamy Date: Mon Feb 20 16:10:52 2012 New Revision: 1291338 URL: http://svn.apache.org/viewvc?rev=1291338&view=rev Log: clarify mandatory packaging of project for executable war plugin Modified: tomcat/maven-plugin/trunk/src/site/apt/executable-war-jar.apt.vm Modified: tomcat/maven-plugin/trunk/src/site/apt/executable-war-jar.apt.vm URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/src/site/apt/executable-war-jar.apt.vm?rev=1291338&r1=1291337&r2=1291338&view=diff == --- tomcat/maven-plugin/trunk/src/site/apt/executable-war-jar.apt.vm (original) +++ tomcat/maven-plugin/trunk/src/site/apt/executable-war-jar.apt.vm Mon Feb 20 16:10:52 2012 @@ -32,12 +32,14 @@ Build an Executable War/Jar This is only supported with the tomcat7 plugin. + <> Your project must have packaging pom or war. + * Additional Artifact to your war module +-- ... - war + war or pom ... ... - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
DO NOT REPLY [Bug 52714] SSLProtocol with TLSv1+SSLv3 or SSLv3+TLSv1 does not work APR based Apache Tomcat Native 1.2.22
https://issues.apache.org/bugzilla/show_bug.cgi?id=52714 Rainer Jung changed: What|Removed |Added Status|NEW |RESOLVED Resolution||INVALID --- Comment #1 from Rainer Jung 2012-02-20 17:16:06 UTC --- No that code was not broken by the change you cited. That change reverted an addition that was not needed. The feature to support all combinations of SSLv2, SSLv3 and TLSv1 is tracked as BZ 51477. The feature was realized by a combination of patches applied to tcnative 1.1 (first released in 1.1.22) and Tomcat 7 (first released in 7.0.19). The feature is neither documented nor available in TC 6. You might opt for a backport in BZ 51477. Bugzilla is not a support forum. If you want to discuss this further, please use the Tomcat users list. Thanks Rainer -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1291390 - /tomcat/tc6.0.x/trunk/STATUS.txt
Author: rjung Date: Mon Feb 20 17:54:14 2012 New Revision: 1291390 URL: http://svn.apache.org/viewvc?rev=1291390&view=rev 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=1291390&r1=1291389&r2=1291390&view=diff == --- tomcat/tc6.0.x/trunk/STATUS.txt (original) +++ tomcat/tc6.0.x/trunk/STATUS.txt Mon Feb 20 17:54:14 2012 @@ -128,6 +128,14 @@ PATCHES PROPOSED TO BACKPORT: +1: markt, kfujino -1: +* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51477 + Support all SSL/TLS protocol combinations in APR connector. + trunk/TC7 (applies clean except for docs): +http://svn.apache.org/viewvc?rev=1145209&view=rev + TC 6 patch: + http://people.apache.org/~rjung/patches/tc6-apr-all-sslprotocol-r1145209.patch + +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
DO NOT REPLY [Bug 51477] Support all protocol combinations in SSLProtocol of APR Connector
https://issues.apache.org/bugzilla/show_bug.cgi?id=51477 --- Comment #19 from Rainer Jung 2012-02-20 17:54:40 UTC --- Change also proposed for Tomcat 6. -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
DO NOT REPLY [Bug 52714] SSLProtocol with TLSv1+SSLv3 or SSLv3+TLSv1 does not work APR based Apache Tomcat Native 1.2.22
https://issues.apache.org/bugzilla/show_bug.cgi?id=52714 --- Comment #2 from Rainer Jung 2012-02-20 17:55:24 UTC --- Adding this to TC 6 has been proposed by me today. Backport will happen if enough other committers agree. -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
DO NOT REPLY [Bug 52717] New: APR endpoint doesn't handle IPv6 link-local addresses well
https://issues.apache.org/bugzilla/show_bug.cgi?id=52717 Bug #: 52717 Summary: APR endpoint doesn't handle IPv6 link-local addresses well Product: Tomcat Native Version: unspecified Platform: PC OS/Version: Linux Status: NEW Severity: major Priority: P2 Component: Library AssignedTo: dev@tomcat.apache.org ReportedBy: rachmatow...@jboss.com Classification: Unclassified APREndppoint has two issues with the handling of IPv6 link local addresses: (i) if an IPv6 link local address without a zone id is specified, no default value is provided, so that initialization fails with the following error (example if from startup of JBoss AS7.1.0.Final): 11:01:29,185 ERROR [org.apache.coyote.http11.Http11AprProtocol] (MSC service thread 1-6) Error initializing endpoint: java.lang.Exception: Socket bind failed: [22] Invalid argument at org.apache.tomcat.util.net.AprEndpoint.init(AprEndpoint.java:578) [jbossweb-7.0.10.Final.jar:] This is due to trying to create a socket using a link-local address while at the same time not specifying a zoneid. (ii) APR does not rsolve a passed interface id (e.g. lo, eth0, ...) to the corresponding zone id (0, 1, 2, ...) -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1291432 - in /tomcat/trunk/java/org/apache/catalina/websocket: MessageInbound.java WsOutbound.java
Author: markt Date: Mon Feb 20 20:32:34 2012 New Revision: 1291432 URL: http://svn.apache.org/viewvc?rev=1291432&view=rev Log: Improve handling of larger messages Modified: tomcat/trunk/java/org/apache/catalina/websocket/MessageInbound.java tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java Modified: tomcat/trunk/java/org/apache/catalina/websocket/MessageInbound.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/MessageInbound.java?rev=1291432&r1=1291431&r2=1291432&view=diff == --- tomcat/trunk/java/org/apache/catalina/websocket/MessageInbound.java (original) +++ tomcat/trunk/java/org/apache/catalina/websocket/MessageInbound.java Mon Feb 20 20:32:34 2012 @@ -24,8 +24,10 @@ import java.nio.CharBuffer; public abstract class MessageInbound extends StreamInbound { -// TODO: Make buffer sizes configurable -// TODO: Allow buffers to expand +// 2MB - like maxPostSize +private int byteBufferMaxSize = 2097152; +private int charBufferMaxSize = 2097152; + ByteBuffer bb = ByteBuffer.allocate(8192); CharBuffer cb = CharBuffer.allocate(8192); @@ -34,6 +36,9 @@ public abstract class MessageInbound ext int read = 0; while (read > -1) { bb.position(bb.position() + read); +if (bb.remaining() == 0) { +resizeByteBuffer(); +} read = is.read(bb.array(), bb.position(), bb.remaining()); } bb.flip(); @@ -46,6 +51,9 @@ public abstract class MessageInbound ext int read = 0; while (read > -1) { cb.position(cb.position() + read); +if (cb.remaining() == 0) { +resizeCharBuffer(); +} read = r.read(cb.array(), cb.position(), cb.remaining()); } cb.limit(cb.position()); @@ -54,6 +62,60 @@ public abstract class MessageInbound ext cb.clear(); } +private void resizeByteBuffer() throws IOException { +int maxSize = getByteBufferMaxSize(); +if (bb.limit() >= maxSize) { +// TODO i18n +throw new IOException("Buffer not big enough for message"); +} + +long newSize = bb.limit() * 2; +if (newSize > maxSize) { +newSize = maxSize; +} + +// Cast is safe. newSize < maxSize and maxSize is an int +ByteBuffer newBuffer = ByteBuffer.allocate((int) newSize); +bb.rewind(); +newBuffer.put(bb); +bb = newBuffer; +} + +private void resizeCharBuffer() throws IOException { +int maxSize = getCharBufferMaxSize(); +if (cb.limit() >= maxSize) { +// TODO i18n +throw new IOException("Buffer not big enough for message"); +} + +long newSize = cb.limit() * 2; +if (newSize > maxSize) { +newSize = maxSize; +} + +// Cast is safe. newSize < maxSize and maxSize is an int +CharBuffer newBuffer = CharBuffer.allocate((int) newSize); +cb.rewind(); +newBuffer.put(cb); +cb = newBuffer; +} + +public int getByteBufferMaxSize() { +return byteBufferMaxSize; +} + +public void setByteBufferMaxSize(int byteBufferMaxSize) { +this.byteBufferMaxSize = byteBufferMaxSize; +} + +public int getCharBufferMaxSize() { +return charBufferMaxSize; +} + +public void setCharBufferMaxSize(int charBufferMaxSize) { +this.charBufferMaxSize = charBufferMaxSize; +} + protected abstract void onBinaryMessage(ByteBuffer message) throws IOException; protected abstract void onTextMessage(CharBuffer message) Modified: tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java?rev=1291432&r1=1291431&r2=1291432&view=diff == --- tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java (original) +++ tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java Mon Feb 20 20:32:34 2012 @@ -25,7 +25,7 @@ import org.apache.tomcat.util.buf.B2CCon public class WsOutbound { -private static final int DEFAULT_BUFFER_SIZE = 2048; +private static final int DEFAULT_BUFFER_SIZE = 8192; private UpgradeOutbound upgradeOutbound; private ByteBuffer bb; @@ -37,9 +37,7 @@ public class WsOutbound { public WsOutbound(UpgradeOutbound upgradeOutbound) { this.upgradeOutbound = upgradeOutbound; // TODO: Make buffer size configurable -// Byte buffer needs to be 4* char buffer to be sure that char buffer -// can always we written into Byte buffer -this.bb = ByteBuffer.allocate(DEFAULT_BUFFER_SIZE * 4); +this.bb = ByteBuffer.allocate(DEFAULT_BUFFER_SI
svn commit: r1291433 - in /tomcat/trunk: java/org/apache/catalina/websocket/WsOutbound.java webapps/examples/WEB-INF/classes/websocket/EchoMessage.java
Author: markt Date: Mon Feb 20 20:33:30 2012 New Revision: 1291433 URL: http://svn.apache.org/viewvc?rev=1291433&view=rev Log: Buffers should be ready when passed in. App should call flip() as required. Need to support output of larger frames for message API. Modified: tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/EchoMessage.java Modified: tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java?rev=1291433&r1=1291432&r2=1291433&view=diff == --- tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java (original) +++ tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java Mon Feb 20 20:33:30 2012 @@ -123,9 +123,6 @@ public class WsOutbound { protected void doWriteBinary(ByteBuffer buffer, boolean finalFragment) throws IOException { -// Prepare to write -buffer.flip(); - // Work out the first byte int first = 0x00; if (finalFragment) { @@ -141,13 +138,24 @@ public class WsOutbound { // Continuation frame is OpCode 0 upgradeOutbound.write(first); -// Note: buffer will never be more than 2^16 in length if (buffer.limit() < 126) { upgradeOutbound.write(buffer.limit()); -} else { +} else if (buffer.limit() < 65536) { upgradeOutbound.write(126); upgradeOutbound.write(buffer.limit() >>> 8); upgradeOutbound.write(buffer.limit() & 0xFF); +} else { +// Will never be more than 2^31-1 +upgradeOutbound.write(127); +upgradeOutbound.write(0); +upgradeOutbound.write(0); +upgradeOutbound.write(0); +upgradeOutbound.write(0); +upgradeOutbound.write(buffer.limit() >>> 24); +upgradeOutbound.write(buffer.limit() >>> 16); +upgradeOutbound.write(buffer.limit() >>> 8); +upgradeOutbound.write(buffer.limit() & 0xFF); + } // Write the content @@ -167,10 +175,9 @@ public class WsOutbound { protected void doWriteText(CharBuffer buffer, boolean finalFragment) throws IOException { -buffer.flip(); - do { B2CConverter.UTF_8.newEncoder().encode(buffer, bb, true); +bb.flip(); if (buffer.hasRemaining()) { doWriteBinary(bb, false); } else { Modified: tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/EchoMessage.java URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/EchoMessage.java?rev=1291433&r1=1291432&r2=1291433&view=diff == --- tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/EchoMessage.java (original) +++ tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/EchoMessage.java Mon Feb 20 20:33:30 2012 @@ -38,13 +38,11 @@ public class EchoMessage extends WebSock @Override protected void onBinaryMessage(ByteBuffer message) throws IOException { -message.position(message.limit()); getOutbound().writeBinaryMessage(message); } @Override protected void onTextMessage(CharBuffer message) throws IOException { -message.position(message.limit()); getOutbound().writeTextMessage(message); } } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: WebSocket progress report
On 20/02/2012 10:04, Mark Thomas wrote: > On 20/02/2012 02:55, Petr Praus wrote: >> but I wanted to ask - have you considered using Autobahn for >> testing? It's rather extensive opensource websocket testing suite. > > I haven't. I just took a quick look. Looks like a nice tool. My test > client is intended to be something we can run in the unit tests to look > at very specific issues. It isn't intended to be a general WebSocket > client, nor to test the full range of functionality. I think Autobhan is > something we would run separately - a bit like we do with the WebDAV > test suite and the TCKs. I've been looking at this today and so far, my experience has been very good. Thanks for the tip. It has been really useful. I now have all the framing tests passing but the message close is currently unclean. Next step will be to fix that by adding support for close. Mark - 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-trunk
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/2762 Buildbot URL: http://ci.apache.org/ Buildslave for this Build: bb-vm_ubuntu Build Reason: scheduler Build Source Stamp: [branch tomcat/trunk] 1291433 Blamelist: markt BUILD FAILED: failed compile_1 sincerely, -The Buildbot
Re: WebSocket progress report
I'm glad to hear that. BTW, Jonathan quite significantly overhauled our implementation over the weekend. The WebSocketFrame no longer buffers data but just stores a reference to inputstream from which the data can be read by the client code receiving the frame. This is not exactly what you originally implemented but I think it's conceptually the same. In the future it would desirable to shield client code from the WebSocketFrame itself and just provide streams. I personally think of WebSocketFrame as being more useful to internal protocol logic than client code which very often does not care about most of the stuff captured in the frame, just the data. I added some fixes yesterday and the code now passes all Autobahn tests including proper closes and close status codes. The only exception are UTF-8-related tests which require reading whole payload and checking that its valid UTF-8. Unfortunately it's no longer easily mergeable with current trunk because of your fragmentation changes on Friday, but if you would be willing to look at it anyway, it's available in our GitHub repository: https://github.com/praus/tomcat (the repository is a fork of the official github apache/tomcat mirror). Petr On Mon, Feb 20, 2012 at 14:35, Mark Thomas wrote: > On 20/02/2012 10:04, Mark Thomas wrote: > > On 20/02/2012 02:55, Petr Praus wrote: > >> but I wanted to ask - have you considered using Autobahn for > >> testing? It's rather extensive opensource websocket testing suite. > > > > I haven't. I just took a quick look. Looks like a nice tool. My test > > client is intended to be something we can run in the unit tests to look > > at very specific issues. It isn't intended to be a general WebSocket > > client, nor to test the full range of functionality. I think Autobhan is > > something we would run separately - a bit like we do with the WebDAV > > test suite and the TCKs. > > I've been looking at this today and so far, my experience has been very > good. Thanks for the tip. It has been really useful. > > I now have all the framing tests passing but the message close is > currently unclean. Next step will be to fix that by adding support for > close. > > Mark > > - > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org > For additional commands, e-mail: dev-h...@tomcat.apache.org > >
svn commit: r1291477 - /tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java
Author: markt Date: Mon Feb 20 22:02:39 2012 New Revision: 1291477 URL: http://svn.apache.org/viewvc?rev=1291477&view=rev Log: Fix the other place where an UpgradeProcessor could end up in the processor cache Modified: tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java Modified: tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java?rev=1291477&r1=1291476&r2=1291477&view=diff == --- tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java (original) +++ tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java Mon Feb 20 22:02:39 2012 @@ -593,7 +593,9 @@ public abstract class AbstractProtocol i upgradePoll(socket, processor); } else { // Connection closed. OK to recycle the processor. -release(socket, processor, true, false); +if (!(processor instanceof UpgradeProcessor)) { +release(socket, processor, true, false); +} } return state; } catch(java.net.SocketException e) { - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1291479 - /tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java
Author: markt Date: Mon Feb 20 22:03:18 2012 New Revision: 1291479 URL: http://svn.apache.org/viewvc?rev=1291479&view=rev Log: Process mask as unsigned int. Based on ideas in a larger patch by Petr Praus, Jonathan Drake & Slávka Modified: tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java Modified: tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java?rev=1291479&r1=1291478&r2=1291479&view=diff == --- tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java (original) +++ tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java Mon Feb 20 22:03:18 2012 @@ -26,7 +26,7 @@ public class WsInputStream extends java. private UpgradeProcessor processor; private WsFrameHeader wsFrameHeader; private long payloadLength = -1; -private byte[] mask = new byte[4]; +private int[] mask = new int[4]; private long remaining; @@ -70,7 +70,9 @@ public class WsInputStream extends java. } remaining = payloadLength; -processor.read(mask); +for (int j = 0; j < mask.length; j++) { +mask[j] = processor.read() & 0xFF; +} } public WsFrameHeader getFrameHeader() { @@ -100,6 +102,9 @@ public class WsInputStream extends java. read++; int masked = processor.read(); +if(masked == -1) { +return -1; +} return masked ^ mask[(int) ((read - 1) % 4)]; } } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1291480 - in /tomcat/trunk/java/org/apache/catalina/websocket: StreamInbound.java WsOutbound.java
Author: markt Date: Mon Feb 20 22:03:57 2012 New Revision: 1291480 URL: http://svn.apache.org/viewvc?rev=1291480&view=rev Log: Add close message support. Modified: tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java Modified: tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java?rev=1291480&r1=1291479&r2=1291480&view=diff == --- tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java (original) +++ tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java Mon Feb 20 22:03:57 2012 @@ -20,6 +20,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; +import java.nio.ByteBuffer; import org.apache.coyote.http11.upgrade.UpgradeInbound; import org.apache.coyote.http11.upgrade.UpgradeOutbound; @@ -62,6 +63,9 @@ public abstract class StreamInbound impl InputStreamReader r = new InputStreamReader(wsIs, B2CConverter.UTF_8); onTextData(r); +} else if (opCode == Constants.OPCODE_CLOSE){ +doClose(wsIs); +return SocketState.CLOSED; } else { // TODO i18n throw new IOException("OpCode " + opCode + " not supported"); @@ -69,6 +73,30 @@ public abstract class StreamInbound impl return SocketState.UPGRADED; } +private void doClose(InputStream is) throws IOException { +// Control messages have a max size of 125 bytes +ByteBuffer data = ByteBuffer.allocate(125); + +int status1 = is.read(); +int status2 = 0; +System.out.println("" + status1); +if (status1 != -1) { +status1 = status1 << 8; +status2 = is.read(); +System.out.println("" + status2); +status1 = status1 + status2; +int read = 0; +while (read > -1) { +data.position(data.position() + read); +read = is.read(data.array(), data.position(), data.remaining()); +} +} else { +status1 = 0; +} +data.flip(); +getOutbound().close(status1, data); +} + protected abstract void onBinaryData(InputStream is) throws IOException; protected abstract void onTextData(Reader r) throws IOException; Modified: tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java?rev=1291480&r1=1291479&r2=1291480&view=diff == --- tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java (original) +++ tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java Mon Feb 20 22:03:57 2012 @@ -30,6 +30,7 @@ public class WsOutbound { private UpgradeOutbound upgradeOutbound; private ByteBuffer bb; private CharBuffer cb; +private boolean closed = false; protected Boolean text = null; protected boolean firstFrame = true; @@ -110,16 +111,32 @@ public class WsOutbound { } -public void close() throws IOException { +public void close(int status, ByteBuffer data) throws IOException { +// TODO Think about threading requirements for writing. This is not +// currently thread safe and writing almost certainly needs to be. +if (closed) { +return; +} +closed = true; + doFlush(true); -// TODO: Send a close message +upgradeOutbound.write(0x88); +if (status == 0) { +upgradeOutbound.write(0); +} else { +upgradeOutbound.write(2 + data.limit()); +upgradeOutbound.write(status >>> 8); +upgradeOutbound.write(status); +upgradeOutbound.write(data.array(), 0, data.limit()); +} +upgradeOutbound.flush(); + bb = null; cb = null; upgradeOutbound = null; } - protected void doWriteBinary(ByteBuffer buffer, boolean finalFragment) throws IOException { - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: WebSocket progress report
On 20/02/2012 21:28, Petr Praus wrote: > I'm glad to hear that. > > BTW, Jonathan quite significantly overhauled our implementation over the > weekend. The WebSocketFrame no longer buffers data but just stores a > reference to inputstream from which the data can be read by the client code > receiving the frame. This is not exactly what you originally implemented > but I think it's conceptually the same. That sounds much better (I haven't looked at the code in detail). > In the future it would desirable to > shield client code from the WebSocketFrame itself and just provide streams. Indeed. That is how the current implementation in trunk works. > I personally think of WebSocketFrame as being more useful to internal > protocol logic than client code which very often does not care about most > of the stuff captured in the frame, just the data. Agree completely. > I added some fixes yesterday and the code now passes all Autobahn tests > including proper closes and close status codes. Very nice. That is better than the current trunk can manage. > The only exception are > UTF-8-related tests which require reading whole payload and checking that > its valid UTF-8. Haven't looked too hard at those yet. Assuming Java can tell the UTF-8 is invalid then handling that should be easy. > Unfortunately it's no longer easily mergeable with current trunk because of > your fragmentation changes on Friday, but if you would be willing to look > at it anyway, it's available in our GitHub repository: > https://github.com/praus/tomcat (the repository is a fork of the official > github apache/tomcat mirror). That is pretty much inevitable when you have a large patch and one of the main reasons I am trying to keep to small incremental changes in trunk. There are some of those trunk changes (I am thinking of AbstractProcessor) that you'll need to pull into your fork. I am borrowing from your fork where I can and am providing credit in the commit message so you can see what I have used. You'll also get credit in the changelog along with the other folks that have contributed code to the WebSocket impl. Based on progress today, things should move along pretty quickly. Next step is to get ping/pong working. Mark > > Petr > > On Mon, Feb 20, 2012 at 14:35, Mark Thomas wrote: > >> On 20/02/2012 10:04, Mark Thomas wrote: >>> On 20/02/2012 02:55, Petr Praus wrote: but I wanted to ask - have you considered using Autobahn for testing? It's rather extensive opensource websocket testing suite. >>> >>> I haven't. I just took a quick look. Looks like a nice tool. My test >>> client is intended to be something we can run in the unit tests to look >>> at very specific issues. It isn't intended to be a general WebSocket >>> client, nor to test the full range of functionality. I think Autobhan is >>> something we would run separately - a bit like we do with the WebDAV >>> test suite and the TCKs. >> >> I've been looking at this today and so far, my experience has been very >> good. Thanks for the tip. It has been really useful. >> >> I now have all the framing tests passing but the message close is >> currently unclean. Next step will be to fix that by adding support for >> close. >> >> Mark >> >> - >> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org >> For additional commands, e-mail: dev-h...@tomcat.apache.org >> >> > - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1291504 - /tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java
Author: markt Date: Mon Feb 20 22:53:29 2012 New Revision: 1291504 URL: http://svn.apache.org/viewvc?rev=1291504&view=rev Log: Remove the debug code I was using to figure out why the unmasking was going wrong. Modified: tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java Modified: tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java?rev=1291504&r1=1291503&r2=1291504&view=diff == --- tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java (original) +++ tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java Mon Feb 20 22:53:29 2012 @@ -77,24 +77,20 @@ public abstract class StreamInbound impl // Control messages have a max size of 125 bytes ByteBuffer data = ByteBuffer.allocate(125); -int status1 = is.read(); -int status2 = 0; -System.out.println("" + status1); -if (status1 != -1) { -status1 = status1 << 8; -status2 = is.read(); -System.out.println("" + status2); -status1 = status1 + status2; +int status = is.read(); +if (status != -1) { +status = status << 8; +status = status + is.read(); int read = 0; while (read > -1) { data.position(data.position() + read); read = is.read(data.array(), data.position(), data.remaining()); } } else { -status1 = 0; +status = 0; } data.flip(); -getOutbound().close(status1, data); +getOutbound().close(status, data); } protected abstract void onBinaryData(InputStream is) throws IOException; - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1291507 - in /tomcat/trunk/java/org/apache/catalina/websocket: StreamInbound.java WsInputStream.java WsOutbound.java
Author: markt Date: Mon Feb 20 22:54:13 2012 New Revision: 1291507 URL: http://svn.apache.org/viewvc?rev=1291507&view=rev Log: Ping/pong support Modified: tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java Modified: tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java?rev=1291507&r1=1291506&r2=1291507&view=diff == --- tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java (original) +++ tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java Mon Feb 20 22:54:13 2012 @@ -63,9 +63,20 @@ public abstract class StreamInbound impl InputStreamReader r = new InputStreamReader(wsIs, B2CConverter.UTF_8); onTextData(r); -} else if (opCode == Constants.OPCODE_CLOSE){ +} + +if (wsIs.getPayloadLength() > 125) { +getOutbound().close(1002, null); +return SocketState.CLOSED; +} + +if (opCode == Constants.OPCODE_CLOSE){ doClose(wsIs); return SocketState.CLOSED; +} else if (opCode == Constants.OPCODE_PING) { +doPing(wsIs); +} else if (opCode == Constants.OPCODE_PONG) { +doPong(wsIs); } else { // TODO i18n throw new IOException("OpCode " + opCode + " not supported"); @@ -74,8 +85,9 @@ public abstract class StreamInbound impl } private void doClose(InputStream is) throws IOException { -// Control messages have a max size of 125 bytes -ByteBuffer data = ByteBuffer.allocate(125); +// Control messages have a max size of 125 bytes. Need to try and read +// one more so we reach end of stream (less 2 for the status) +ByteBuffer data = ByteBuffer.allocate(124); int status = is.read(); if (status != -1) { @@ -93,6 +105,29 @@ public abstract class StreamInbound impl getOutbound().close(status, data); } +private void doPing(InputStream is) throws IOException { +// Control messages have a max size of 125 bytes. Need to try and read +// one more so we reach end of stream +ByteBuffer data = ByteBuffer.allocate(126); + +int read = 0; +while (read > -1) { +data.position(data.position() + read); +read = is.read(data.array(), data.position(), data.remaining()); +} + +data.flip(); +getOutbound().pong(data); +} + +private void doPong(InputStream is) throws IOException { +// Unsolicited pong - swallow it +int read = 0; +while (read > -1) { +read = is.read(); +} +} + protected abstract void onBinaryData(InputStream is) throws IOException; protected abstract void onTextData(Reader r) throws IOException; Modified: tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java?rev=1291507&r1=1291506&r2=1291507&view=diff == --- tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java (original) +++ tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java Mon Feb 20 22:54:13 2012 @@ -79,6 +79,10 @@ public class WsInputStream extends java. return wsFrameHeader; } +public long getPayloadLength() { +return payloadLength; +} + // - InputStream methods Modified: tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java?rev=1291507&r1=1291506&r2=1291507&view=diff == --- tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java (original) +++ tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java Mon Feb 20 22:54:13 2012 @@ -124,6 +124,10 @@ public class WsOutbound { upgradeOutbound.write(0x88); if (status == 0) { upgradeOutbound.write(0); +} else if (data == null) { +upgradeOutbound.write(2); +upgradeOutbound.write(status >>> 8); +upgradeOutbound.write(status); } else { upgradeOutbound.write(2 + data.limit()); upgradeOutbound.write(status >>> 8); @@ -137,6 +141,22 @@ public class WsOutbound { upgradeOutbound = null; } +public void pong(ByteBuffer data) throws IOException { +// TODO Think about threading requireme
svn commit: r1291521 - /tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java
Author: markt Date: Mon Feb 20 23:41:33 2012 New Revision: 1291521 URL: http://svn.apache.org/viewvc?rev=1291521&view=rev Log: Fix up logic Make behaviour clearer. Modified: tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java Modified: tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java?rev=1291521&r1=1291520&r2=1291521&view=diff == --- tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java (original) +++ tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java Mon Feb 20 23:41:33 2012 @@ -59,12 +59,15 @@ public abstract class StreamInbound impl if (opCode == Constants.OPCODE_BINARY) { onBinaryData(wsIs); +return SocketState.UPGRADED; } else if (opCode == Constants.OPCODE_TEXT) { InputStreamReader r = new InputStreamReader(wsIs, B2CConverter.UTF_8); onTextData(r); +return SocketState.UPGRADED; } +// Must be a control from and they have limited pay load length if (wsIs.getPayloadLength() > 125) { getOutbound().close(1002, null); return SocketState.CLOSED; @@ -75,13 +78,14 @@ public abstract class StreamInbound impl return SocketState.CLOSED; } else if (opCode == Constants.OPCODE_PING) { doPing(wsIs); +return SocketState.UPGRADED; } else if (opCode == Constants.OPCODE_PONG) { doPong(wsIs); -} else { -// TODO i18n -throw new IOException("OpCode " + opCode + " not supported"); +return SocketState.UPGRADED; } -return SocketState.UPGRADED; + +// TODO i18n +throw new IOException("OpCode " + opCode + " not supported"); } private void doClose(InputStream is) throws IOException { - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1291522 - /tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java
Author: markt Date: Mon Feb 20 23:42:13 2012 New Revision: 1291522 URL: http://svn.apache.org/viewvc?rev=1291522&view=rev Log: Ensure control frames are not fragmented Modified: tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java Modified: tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java?rev=1291522&r1=1291521&r2=1291522&view=diff == --- tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java (original) +++ tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java Mon Feb 20 23:42:13 2012 @@ -67,8 +67,10 @@ public abstract class StreamInbound impl return SocketState.UPGRADED; } -// Must be a control from and they have limited pay load length -if (wsIs.getPayloadLength() > 125) { +// Must be a control frame and control frames: +// - have a limited payload length +// - must not be fragmented +if (wsIs.getPayloadLength() > 125 || !wsIs.getFrameHeader().getFin()) { getOutbound().close(1002, null); return SocketState.CLOSED; } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1291523 - /tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java
Author: markt Date: Mon Feb 20 23:42:51 2012 New Revision: 1291523 URL: http://svn.apache.org/viewvc?rev=1291523&view=rev Log: Mask is per fragment so track position against mask per fragment. Remove some completed TODOs. Modified: tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java Modified: tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java?rev=1291523&r1=1291522&r2=1291523&view=diff == --- tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java (original) +++ tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java Mon Feb 20 23:42:51 2012 @@ -30,7 +30,7 @@ public class WsInputStream extends java. private long remaining; -private long read; +private long readThisFragment; public WsInputStream(UpgradeProcessor processor) throws IOException { this.processor = processor; @@ -43,11 +43,6 @@ public class WsInputStream extends java. // TODO: Per frame extension handling is not currently supported. -// TODO: Handle other control frames. - -// TODO: Handle control frames appearing in the middle of a multi-frame -// message - int i = processor.read(); this.wsFrameHeader = new WsFrameHeader(i); @@ -73,6 +68,8 @@ public class WsInputStream extends java. for (int j = 0; j < mask.length; j++) { mask[j] = processor.read() & 0xFF; } + +readThisFragment = 0; } public WsFrameHeader getFrameHeader() { @@ -103,12 +100,12 @@ public class WsInputStream extends java. } remaining--; -read++; +readThisFragment++; int masked = processor.read(); if(masked == -1) { return -1; } -return masked ^ mask[(int) ((read - 1) % 4)]; +return masked ^ mask[(int) ((readThisFragment - 1) % 4)]; } } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1291524 - in /tomcat/trunk/java/org/apache/catalina/websocket: StreamInbound.java WsFrameHeader.java
Author: markt Date: Mon Feb 20 23:43:30 2012 New Revision: 1291524 URL: http://svn.apache.org/viewvc?rev=1291524&view=rev Log: Modify rsv handling and complain if it is non-zero (will need to handle non-zero values for extensions). Modified: tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java tomcat/trunk/java/org/apache/catalina/websocket/WsFrameHeader.java Modified: tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java?rev=1291524&r1=1291523&r2=1291524&view=diff == --- tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java (original) +++ tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java Mon Feb 20 23:43:30 2012 @@ -54,6 +54,13 @@ public abstract class StreamInbound impl WsInputStream wsIs = new WsInputStream(processor); WsFrameHeader header = wsIs.getFrameHeader(); + +// TODO User defined extensions may define values for rsv +if (header.getRsv() > 0) { +getOutbound().close(1002, null); +return SocketState.CLOSED; +} + byte opCode = header.getOpCode(); validateOpCode(opCode); Modified: tomcat/trunk/java/org/apache/catalina/websocket/WsFrameHeader.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/WsFrameHeader.java?rev=1291524&r1=1291523&r2=1291524&view=diff == --- tomcat/trunk/java/org/apache/catalina/websocket/WsFrameHeader.java (original) +++ tomcat/trunk/java/org/apache/catalina/websocket/WsFrameHeader.java Mon Feb 20 23:43:30 2012 @@ -23,17 +23,13 @@ package org.apache.catalina.websocket; public class WsFrameHeader { private final boolean fin; -private final boolean rsv1; -private final boolean rsv2; -private final boolean rsv3; +private final int rsv; private final byte opCode; public WsFrameHeader(int b) { fin = (b & 0x80) > 0; -rsv1 = (b & 0x40) > 0; -rsv2 = (b & 0x20) > 0; -rsv3 = (b & 0x10) > 0; +rsv = (b & 0x70) >>> 4; opCode = (byte) (b & 0x0F); } @@ -42,21 +38,11 @@ public class WsFrameHeader { return fin; } -public boolean getRsv1() { -return rsv1; -} - -public boolean getRsv2() { -return rsv2; -} - -public boolean getRsv3() { -return rsv3; +public int getRsv() { +return rsv; } public byte getOpCode() { return opCode; } - - } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1291525 - /tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java
Author: markt Date: Mon Feb 20 23:44:07 2012 New Revision: 1291525 URL: http://svn.apache.org/viewvc?rev=1291525&view=rev Log: Remove unnecessary method. Better handling of unknown opcode. Modified: tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java Modified: tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java?rev=1291525&r1=1291524&r2=1291525&view=diff == --- tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java (original) +++ tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java Mon Feb 20 23:44:07 2012 @@ -62,7 +62,6 @@ public abstract class StreamInbound impl } byte opCode = header.getOpCode(); -validateOpCode(opCode); if (opCode == Constants.OPCODE_BINARY) { onBinaryData(wsIs); @@ -93,8 +92,8 @@ public abstract class StreamInbound impl return SocketState.UPGRADED; } -// TODO i18n -throw new IOException("OpCode " + opCode + " not supported"); +getOutbound().close(1002, null); +return SocketState.CLOSED; } private void doClose(InputStream is) throws IOException { @@ -143,19 +142,4 @@ public abstract class StreamInbound impl protected abstract void onBinaryData(InputStream is) throws IOException; protected abstract void onTextData(Reader r) throws IOException; - -private void validateOpCode(byte opCode) throws IOException { -switch (opCode) { -case 0: -case 1: -case 2: -case 8: -case 9: -case 10: -break; -default: -// TODO: Message -throw new IOException(); -} -} } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1291526 - /tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java
Author: markt Date: Mon Feb 20 23:44:46 2012 New Revision: 1291526 URL: http://svn.apache.org/viewvc?rev=1291526&view=rev Log: Restore a TODO Modified: tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java Modified: tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java?rev=1291526&r1=1291525&r2=1291526&view=diff == --- tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java (original) +++ tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java Mon Feb 20 23:44:46 2012 @@ -43,6 +43,8 @@ public class WsInputStream extends java. // TODO: Per frame extension handling is not currently supported. +// TODO: Handle control frames between fragments + int i = processor.read(); this.wsFrameHeader = new WsFrameHeader(i); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: WebSocket progress report
On 20/02/2012 22:19, Mark Thomas wrote: > Based on progress today, things should move along pretty quickly. > Next step is to get ping/pong working. Yep. Progress has been pretty quick. Ping/pong tests (section 2) now all pass as do sections 3 (reserved bits) and 4 (opcodes). There are a few failures in section 5 (fragmentation) and they are due to not handling control frames in the middle of fragmented messages. Hopefully fixing that will mostly just be a little refactoring - pushing more stuff down into the WsInputStream. I plan to look at that tomorrow although I need to do the 7.0.26 release first. Mark - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[GUMP@vmgump]: Project tomcat-trunk-test (in module tomcat-trunk) failed
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-trunk-test has an issue affecting its community integration. This issue affects 1 projects. The current state of this project is 'Failed', with reason 'Build Failed'. For reference only, the following projects are affected by this: - tomcat-trunk-test : Tomcat 8.x, a web server implementing Java Servlet 3.1, ... Full details are available at: http://vmgump.apache.org/gump/public/tomcat-trunk/tomcat-trunk-test/index.html That said, some information snippets are provided here. The following annotations (debug/informational/warning/error messages) were provided: -DEBUG- Dependency on tomcat-trunk-dbcp exists, no need to add for property tomcat-dbcp-src.jar. -DEBUG- Dependency on commons-daemon exists, no need to add for property commons-daemon.native.src.tgz. -DEBUG- Dependency on commons-daemon exists, no need to add for property tomcat-native.tar.gz. -DEBUG- Dependency on tomcat-trunk-dbcp exists, no need to add for property tomcat-dbcp.home. -INFO- Failed with reason build failed -INFO- Project Reports in: /srv/gump/public/workspace/tomcat-trunk/output/build/logs The following work was performed: http://vmgump.apache.org/gump/public/tomcat-trunk/tomcat-trunk-test/gump_work/build_tomcat-trunk_tomcat-trunk-test.html Work Name: build_tomcat-trunk_tomcat-trunk-test (Type: Build) Work ended in a state of : Failed Elapsed: 21 mins 15 secs Command Line: /usr/lib/jvm/java-6-openjdk/bin/java -Djava.awt.headless=true -Dbuild.sysclasspath=only org.apache.tools.ant.Main -Dgump.merge=/srv/gump/public/gump/work/merge.xml -Djunit.jar=/srv/gump/public/workspace/junit/dist/junit-21022012.jar -Dcommons-daemon.native.src.tgz=/srv/gump/public/workspace/apache-commons/daemon/dist/bin/commons-daemon-21022012-native-src.tar.gz -Dtomcat-native.tar.gz=/srv/gump/public/workspace/apache-commons/daemon/dist/bin/commons-daemon-21022012-native-src.tar.gz -Dexamples.sources.skip=true -Dtomcat-dbcp.home=/srv/gump/public/workspace/tomcat-trunk/tomcat-deps -Djdt.jar=/srv/gump/packages/eclipse/plugins/org.eclipse.jdt.core_3.4.2/jdtcore.jar -Dcommons-daemon.jar=/srv/gump/public/workspace/apache-commons/daemon/dist/commons-daemon-21022012.jar -Dtomcat-dbcp-src.jar=/srv/gump/public/workspace/tomcat-trunk/tomcat-deps/tomcat-dbcp-src.jar -Dtest.accesslog=true -Dcommons-pool.home=/srv/gump/public/workspace/commons-pool-1.x -Dcommons-dbcp.home=/ srv/gump/public/workspace/commons-dbcp-1.x -Dtomcat-dbcp.jar=/srv/gump/public/workspace/tomcat-trunk/tomcat-deps/tomcat-dbcp-21022012.jar test [Working Directory: /srv/gump/public/workspace/tomcat-trunk] CLASSPATH: /usr/lib/jvm/java-6-openjdk/lib/tools.jar:/srv/gump/public/workspace/tomcat-trunk/output/build/webapps/examples/WEB-INF/classes:/srv/gump/public/workspace/tomcat-trunk/output/testclasses:/srv/gump/public/workspace/ant/dist/lib/ant.jar:/srv/gump/public/workspace/ant/dist/lib/ant-launcher.jar:/srv/gump/public/workspace/ant/dist/lib/ant-jmf.jar:/srv/gump/public/workspace/ant/dist/lib/ant-junit.jar:/srv/gump/public/workspace/ant/dist/lib/ant-swing.jar:/srv/gump/public/workspace/ant/dist/lib/ant-apache-resolver.jar:/srv/gump/public/workspace/ant/dist/lib/ant-apache-xalan2.jar:/srv/gump/public/workspace/xml-commons/java/build/resolver.jar:/srv/gump/public/workspace/tomcat-trunk/output/build/bin/bootstrap.jar:/srv/gump/public/workspace/tomcat-trunk/output/build/bin/tomcat-juli.jar:/srv/gump/public/workspace/tomcat-trunk/output/build/lib/annotations-api.jar:/srv/gump/public/workspace/tomcat-trunk/output/build/lib/servlet-api.jar:/srv/gump/public/workspace/tomcat-trunk/outp ut/build/lib/jsp-api.jar:/srv/gump/public/workspace/tomcat-trunk/output/build/lib/el-api.jar:/srv/gump/public/workspace/tomcat-trunk/output/build/lib/catalina.jar:/srv/gump/public/workspace/tomcat-trunk/output/build/lib/catalina-ant.jar:/srv/gump/public/workspace/tomcat-trunk/output/build/lib/tomcat-coyote.jar:/srv/gump/public/workspace/tomcat-trunk/output/build/lib/jasper.jar:/srv/gump/public/workspace/tomcat-trunk/output/build/lib/jasper-el.jar:/srv/gump/public/workspace/tomcat-trunk/output/build/lib/catalina-tribes.jar:/srv/gump/public/workspace/tomcat-trunk/output/build/lib/catalina-ha.jar:/srv/gump/public/workspace/tomcat-trunk/output/build/lib/tomcat-api.jar:/srv/gump/public/workspace/tomcat-trunk/output/build/lib/tomcat-util.jar:/srv/gump/packages/javamail-1.4/mail.jar:/srv/gump/packages/javamail-1.4/lib/mailapi.jar:/srv/gump/packages/jaf-1.1ea/activation.jar:/srv/gump/packages/eclipse/plugins/org.eclipse.jdt.core_3.4.2/jdtcore.jar:/srv/gump/public/workspace/tomcat-tr unk/tomcat-deps/tomcat-dbcp-21022012.jar:/srv/gump/public/workspace/apache-commons/daemon/dist/commons-daemon-21022012.jar:/srv/gump/public/workspace/junit/dist/junit-21022012.j
svn commit: r1291636 - /tomcat/tc6.0.x/trunk/STATUS.txt
Author: mturk Date: Tue Feb 21 07:47:54 2012 New Revision: 1291636 URL: http://svn.apache.org/viewvc?rev=1291636&view=rev Log: Vote 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=1291636&r1=1291635&r2=1291636&view=diff == --- tomcat/tc6.0.x/trunk/STATUS.txt (original) +++ tomcat/tc6.0.x/trunk/STATUS.txt Tue Feb 21 07:47:54 2012 @@ -134,7 +134,7 @@ PATCHES PROPOSED TO BACKPORT: http://svn.apache.org/viewvc?rev=1145209&view=rev TC 6 patch: http://people.apache.org/~rjung/patches/tc6-apr-all-sslprotocol-r1145209.patch - +1: rjung + +1: rjung, mturk -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