hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject [26/35] httpcomponents-core git commit: HTTPCORE-283: Workaround for a bug causing termination of the I/O reactor in case of exception thrown by NHttpServiceHandler#requestReceived or NHttpClientHandler#responseReceived methods. A more comprehensive fix
Date Tue, 09 May 2017 20:03:55 GMT
HTTPCORE-283: Workaround for a bug causing termination of the I/O reactor in case of exception
thrown by NHttpServiceHandler#requestReceived or NHttpClientHandler#responseReceived methods.
A more comprehensive fix for the bug applied to the (4.2 branch)

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.1.x@1209164
13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/d53511fd
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/d53511fd
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/d53511fd

Branch: refs/heads/4.1.x
Commit: d53511fdd67708a824b5956b8c538081fe7fd943
Parents: 2480204
Author: Oleg Kalnichevski <olegk@apache.org>
Authored: Thu Dec 1 17:31:09 2011 +0000
Committer: Oleg Kalnichevski <olegk@apache.org>
Committed: Thu Dec 1 17:31:09 2011 +0000

----------------------------------------------------------------------
 RELEASE_NOTES.txt                                              | 5 +++++
 .../org/apache/http/impl/nio/DefaultNHttpClientConnection.java | 6 ++++++
 .../org/apache/http/impl/nio/DefaultNHttpServerConnection.java | 6 ++++++
 3 files changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d53511fd/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index a5148fb..cf2dadf 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -1,6 +1,11 @@
 Changes since 4.1.3
 -------------------
 
+* [HTTPCORE-283] Workaround for a bug causing termination of the I/O reactor in case of exception

+  thrown by NHttpServiceHandler#requestReceived or NHttpClientHandler#responseReceived
+  methods. A more comprehensive fix for the bug applied to the (4.2 branch).
+  Contributed by Oleg Kalnichevski <olegk at apache.org>
+
 * [HTTPCORE-281] ResponseConnControl protocol interceptor does not correctly populate connection
   persistence control headers when sending a HTTP/1.1 response message in response to a HTTP/1.0

   request message.

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d53511fd/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
b/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
index 78bd87f..d1036da 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
@@ -162,6 +162,9 @@ public class DefaultNHttpClientConnection
                         this.connMetrics.incrementResponseCount();
                     }
                     handler.responseReceived(this);
+                    if (this.session.isClosed()) {
+                        return;
+                    }
                     if (this.contentDecoder == null) {
                         resetInput();
                     }
@@ -172,6 +175,9 @@ public class DefaultNHttpClientConnection
             }
             if (this.contentDecoder != null) {
                 handler.inputReady(this, this.contentDecoder);
+                if (this.session.isClosed()) {
+                    return;
+                }
                 if (this.contentDecoder.isCompleted()) {
                     // Response entity received
                     // Ready to receive a new response

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/d53511fd/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java
b/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java
index 7064b62..2c0fe25 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java
@@ -161,6 +161,9 @@ public class DefaultNHttpServerConnection
                     }
                     this.connMetrics.incrementRequestCount();
                     handler.requestReceived(this);
+                    if (this.session.isClosed()) {
+                        return;
+                    }
                     if (this.contentDecoder == null) {
                         // No request entity is expected
                         // Ready to receive a new request
@@ -173,6 +176,9 @@ public class DefaultNHttpServerConnection
             }
             if (this.contentDecoder != null) {
                 handler.inputReady(this, this.contentDecoder);
+                if (this.session.isClosed()) {
+                    return;
+                }
                 if (this.contentDecoder.isCompleted()) {
                     // Request entity received
                     // Ready to receive a new request


Mime
View raw message