You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by fh...@apache.org on 2008/11/11 22:22:22 UTC

svn commit: r713174 - in /tomcat/tc6.0.x/trunk: STATUS.txt java/org/apache/catalina/connector/CoyoteAdapter.java java/org/apache/catalina/connector/Request.java

Author: fhanik
Date: Tue Nov 11 13:22:17 2008
New Revision: 713174

URL: http://svn.apache.org/viewvc?rev=713174&view=rev
Log:
Add fix for Comet

Modified:
    tomcat/tc6.0.x/trunk/STATUS.txt
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/Request.java

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=713174&r1=713173&r2=713174&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Tue Nov 11 13:22:17 2008
@@ -42,13 +42,6 @@
              and seems impossible to anticipate):
              https://issues.apache.org/bugzilla/show_bug.cgi?id=36155#c17
 
-* Fix comet behavior
-  Invoke READ when there is a body and make sure END is called if CometEvent.close is called during an invokation
-  http://svn.apache.org/viewvc?rev=677473&view=rev
-  +1: fhanik, funkman, pero
-   0: remm: no idea if it's better or worse (the fact that it's been closed is visible)
-  -1: 
-
 * Fix issue where the first request for a deleted JSPs returns as if the JSP
   still exists.
   http://svn.apache.org/viewvc?view=rev&revision=683969

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java?rev=713174&r1=713173&r2=713174&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java Tue Nov 11 13:22:17 2008
@@ -206,6 +206,13 @@
                     connector.getContainer().getPipeline().getFirst().event(request, response, request.getEvent());
                 }
                 if (response.isClosed() || !request.isComet()) {
+                    if (status==SocketStatus.OPEN) {
+                        //CometEvent.close was called during an event.
+                        request.getEvent().setEventType(CometEvent.EventType.END);
+                        request.getEvent().setEventSubType(null);
+                        error = true;
+                        connector.getContainer().getPipeline().getFirst().event(request, response, request.getEvent());
+                    }
                     res.action(ActionCode.ACTION_COMET_END, null);
                 } else if (!error && read && request.getAvailable()) {
                     // If this was a read and not all bytes have been read, or if no data
@@ -287,7 +294,7 @@
 
                 if (request.isComet()) {
                     if (!response.isClosed() && !response.isError()) {
-                        if (request.getAvailable()) {
+                        if (request.getAvailable() || (request.getContentLength() > 0 && (!request.isParametersParsed()))) {
                             // Invoke a read event right away if there are available bytes
                             if (event(req, res, SocketStatus.OPEN)) {
                                 comet = true;

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/Request.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/Request.java?rev=713174&r1=713173&r2=713174&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/Request.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/Request.java Tue Nov 11 13:22:17 2008
@@ -2248,6 +2248,12 @@
         this.comet = comet;
     }
 
+    /**
+     * return true if we have parsed parameters
+     */
+    public boolean isParametersParsed() {
+        return parametersParsed;
+    }    
     
     /**
      * Return true if bytes are available.



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