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/01/13 18:21:40 UTC
svn commit: r495928 - in /jakarta/httpcomponents/httpcore/trunk: ./
module-nio/src/main/java/org/apache/http/nio/impl/
Author: olegk
Date: Sat Jan 13 09:21:36 2007
New Revision: 495928
URL: http://svn.apache.org/viewvc?view=rev&rev=495928
Log:
HTTPCORE-24: Fixed bug in non-blocking connection implementations, which prevented the session buffer from being correctly flushed when the content coding process has been completed.
Contributed by Oleg Kalnichevski
Reviewed by Asankha C. Perera <asankha at wso2.com>
Modified:
jakarta/httpcomponents/httpcore/trunk/RELEASE_NOTES.txt
jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/DefaultNHttpClientConnection.java
jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/DefaultNHttpServerConnection.java
jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/NHttpConnectionBase.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=495928&r1=495927&r2=495928
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/RELEASE_NOTES.txt (original)
+++ jakarta/httpcomponents/httpcore/trunk/RELEASE_NOTES.txt Sat Jan 13 09:21:36 2007
@@ -1,6 +1,12 @@
Changes since release 4.0 Alpha 3
-------------------
+* [HTTPCORE-24] Fixed bug in non-blocking connection implementations, which
+ prevented the session buffer from being correctly flushed when the content
+ coding process has been completed.
+ Contributed by Oleg Kalnichevski <olegk at apache.org>
+
+Contributed by Asankha C. Perera <asankha at wso2.com> and Oleg Kalnichevski
* [HTTPCORE-23] Fixed threading bug in DefaultConnectingIOReactor.
Contributed by Asankha C. Perera <asankha at wso2.com>
Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/DefaultNHttpClientConnection.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/DefaultNHttpClientConnection.java?view=diff&rev=495928&r1=495927&r2=495928
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/DefaultNHttpClientConnection.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/DefaultNHttpClientConnection.java Sat Jan 13 09:21:36 2007
@@ -129,6 +129,7 @@
if (!this.outbuf.hasData()) {
if (this.closed) {
this.session.close();
+ resetOutput();
} else {
if (this.contentEncoder != null) {
handler.outputReady(this, this.contentEncoder);
@@ -137,7 +138,7 @@
}
}
}
- if (this.contentEncoder == null) {
+ if (this.contentEncoder == null && !this.outbuf.hasData()) {
this.session.clearEvent(EventMask.WRITE);
}
}
@@ -153,6 +154,7 @@
if (request == null) {
throw new IllegalArgumentException("HTTP request may not be null");
}
+ assertNotClosed();
if (this.request != null) {
throw new HttpException("Request already submitted");
}
Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/DefaultNHttpServerConnection.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/DefaultNHttpServerConnection.java?view=diff&rev=495928&r1=495927&r2=495928
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/DefaultNHttpServerConnection.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/DefaultNHttpServerConnection.java Sat Jan 13 09:21:36 2007
@@ -129,6 +129,7 @@
if (!this.outbuf.hasData()) {
if (this.closed) {
this.session.close();
+ resetOutput();
} else {
if (this.contentEncoder != null) {
handler.outputReady(this, this.contentEncoder);
@@ -137,7 +138,7 @@
}
}
}
- if (this.contentEncoder == null) {
+ if (this.contentEncoder == null && !this.outbuf.hasData()) {
this.session.clearEvent(EventMask.WRITE);
}
}
@@ -153,6 +154,7 @@
if (response == null) {
throw new IllegalArgumentException("HTTP response may not be null");
}
+ assertNotClosed();
if (this.response != null) {
throw new HttpException("Response already submitted");
}
Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/NHttpConnectionBase.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/NHttpConnectionBase.java?view=diff&rev=495928&r1=495927&r2=495928
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/NHttpConnectionBase.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/impl/NHttpConnectionBase.java Sat Jan 13 09:21:36 2007
@@ -201,6 +201,12 @@
public boolean hasBufferedOutput() {
return this.hasBufferedOutput;
}
+
+ protected void assertNotClosed() {
+ if (this.closed) {
+ throw new IllegalStateException("Connection is closed");
+ }
+ }
public void close() throws IOException {
this.closed = true;