You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2007/05/16 18:58:04 UTC

svn commit: r538650 - in /jakarta/httpcomponents/httpcore/trunk: RELEASE_NOTES.txt module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java

Author: olegk
Date: Wed May 16 09:58:03 2007
New Revision: 538650

URL: http://svn.apache.org/viewvc?view=rev&rev=538650
Log:
HTTPCORE-73: Fixed bug preventing NHttpServiceHandler#responseReady and NHttpClientHandler#requestReady events from being fired if the HTTP message has no content body

Contributed by Steffen Pingel <spingel at limewire.com>
Reviewed by Oleg Kalnichevski

Modified:
    jakarta/httpcomponents/httpcore/trunk/RELEASE_NOTES.txt
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java

Modified: jakarta/httpcomponents/httpcore/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/RELEASE_NOTES.txt?view=diff&rev=538650&r1=538649&r2=538650
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/RELEASE_NOTES.txt (original)
+++ jakarta/httpcomponents/httpcore/trunk/RELEASE_NOTES.txt Wed May 16 09:58:03 2007
@@ -1,12 +1,17 @@
 Changes since 4.0 Alpha 4
 
+* [HTTPCORE-73]: Fixed bug preventing NHttpServiceHandler#responseReady and 
+  NHttpClientHandler#requestReady events from being fired if the HTTP message 
+  has no content body.
+  Contributed by Steffen Pingel <spingel at limewire.com>
+
 * [HTTPCORE-67]: Improved event listener interface
-  Oleg Kalnichevski <olegk at apache.org>
+  Contributed by Oleg Kalnichevski <olegk at apache.org>
 
 * [HTTPCORE-43]: Support for FileChannel#transferFrom() and 
   FileChannel#transferTo() methods. Direct coping from and to FileChannel is 
   expected to improve performance of file bound operations
-  Andrea Selva <selva.andre at gmail.com>
+  Contributed by Andrea Selva <selva.andre at gmail.com>
 
 * [HTTPCORE-66]: Fixed handling of HTTP HEAD methods
   Contributed by Steffen Pingel <spingel at limewire.com> and 

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java?view=diff&rev=538650&r1=538649&r2=538650
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java Wed May 16 09:58:03 2007
@@ -124,10 +124,6 @@
 
     public void produceOutput(final NHttpClientHandler handler) {
 
-        if (this.request == null && !this.closed && !this.outbuf.hasData()) {
-            handler.requestReady(this);
-        }
-        
         try {
             if (this.outbuf.hasData()) {
                 this.outbuf.flush(this.session.channel());
@@ -142,12 +138,16 @@
                         handler.outputReady(this, this.contentEncoder);
                         if (this.contentEncoder.isCompleted()) {
                             resetOutput();
-                            return;
                         }
                     }
                 }
+                
                 if (this.contentEncoder == null && !this.outbuf.hasData()) {
                     this.session.clearEvent(EventMask.WRITE);
+                    
+                    if (!this.closed) {
+                        handler.requestReady(this);
+                    }
                 }
             }
         } catch (IOException ex) {

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java?view=diff&rev=538650&r1=538649&r2=538650
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java Wed May 16 09:58:03 2007
@@ -123,11 +123,6 @@
     }
 
     public void produceOutput(final NHttpServiceHandler handler) {
-        
-        if (!this.closed && this.response == null && !this.outbuf.hasData()) {
-            handler.responseReady(this);
-        }
-        
         try {
             if (this.outbuf.hasData()) {
                 this.outbuf.flush(this.session.channel());
@@ -142,12 +137,16 @@
                         handler.outputReady(this, this.contentEncoder);
                         if (this.contentEncoder.isCompleted()) {
                             resetOutput();
-                            return;
                         }
                     }
                 }
+                
                 if (this.contentEncoder == null && !this.outbuf.hasData()) {
                     this.session.clearEvent(EventMask.WRITE);
+               
+                    if (!this.closed) {
+                        handler.responseReady(this);
+                    }
                 }
             }
         } catch (IOException ex) {