Fix breaking tests after recent comet fixes
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 29 Jan 2011 19:27:07 +0000 (19:27 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 29 Jan 2011 19:27:07 +0000 (19:27 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1065091 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/coyote/http11/Http11NioProtocol.java
java/org/apache/coyote/http11/LocalStrings.properties

index 0735d80..e91fdfc 100644 (file)
@@ -17,7 +17,6 @@
 
 package org.apache.coyote.http11;
 
-import java.io.IOException;
 import java.nio.channels.SelectionKey;
 import java.nio.channels.SocketChannel;
 import java.security.AccessController;
@@ -361,23 +360,23 @@ public class Http11NioProtocol extends AbstractHttp11JsseProtocol {
                     // socket associated with the processor.
                     connections.put(socket, processor);
                     
-                    if (processor.comet) {
-                        // May receive more data from client
-                        SelectionKey key = socket.getIOChannel().keyFor(socket.getPoller().getSelector());
-                        NioEndpoint.KeyAttachment att = (NioEndpoint.KeyAttachment)socket.getAttachment(false);
-                        key.interestOps(SelectionKey.OP_READ);
-                        att.interestOps(SelectionKey.OP_READ);
-                    } else if (processor.isAsync()) {
+                    if (processor.isAsync()) {
                         NioEndpoint.KeyAttachment att = (NioEndpoint.KeyAttachment)socket.getAttachment(false);
                         att.setAsync(true);
                         // longPoll may change socket state (e.g. to trigger a
                         // complete or dispatch)
                         state = processor.asyncPostProcess();
                     } else {
-                        // Error condition. A connection in this state should
-                        // by using one of async or comet
-                        throw new IOException(sm.getString(
-                                "http11protocol.state.long.error"));
+                        // Either:
+                        //  - this is comet request
+                        //  - the request line/headers have not been completely
+                        //    read
+                        SelectionKey key = socket.getIOChannel().keyFor(
+                                socket.getPoller().getSelector());
+                        NioEndpoint.KeyAttachment att =
+                            (NioEndpoint.KeyAttachment)socket.getAttachment(false);
+                        key.interestOps(SelectionKey.OP_READ);
+                        att.interestOps(SelectionKey.OP_READ);
                     }
                 }
                 if (state == SocketState.LONG || state == SocketState.ASYNC_END) {
index 92e1933..c0c27fc 100644 (file)
@@ -20,7 +20,6 @@ http11protocol.proto.ioexception.info=IOException reading request, ignored
 http11protocol.proto.socketexception.debug=SocketException reading request
 http11protocol.proto.socketexception.info=SocketException reading request, ignored
 http11protocol.start=Starting Coyote HTTP/1.1 on {0}
-http11protocol.state.long.error=Error processing request. Socket is in the long poll state but neither Servlet 3.0+ async or Comet is being used 
 
 http11processor.regexp.error=Error parsing regular expression {0}
 http11processor.filter.unknown=Unknown filter {0}