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 2017/05/09 20:03:52 UTC

[04/22] httpcomponents-core git commit: Backported HTTPCORE-196 to 4.0.x branch

Backported HTTPCORE-196 to 4.0.x branch

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.0.x@777118 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/4e87e341
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/4e87e341
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/4e87e341

Branch: refs/heads/4.0.x
Commit: 4e87e341af5a6d0034eee7ecc79f90f4122c4190
Parents: 91ad309
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Thu May 21 13:58:05 2009 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Thu May 21 13:58:05 2009 +0000

----------------------------------------------------------------------
 RELEASE_NOTES.txt                                        |  4 ++++
 .../org/apache/http/impl/nio/reactor/SSLIOSession.java   | 11 +++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/4e87e341/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 88115e1..d68e822 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -1,6 +1,10 @@
 Changes since 4.0
 -------------------
 
+* [HTTPCORE-196] SSLIOSession now unwraps encrypted data more aggressively eliminating long
+  pauses when receiving data over non-blocking connections.  
+  Contributed by Oleg Kalnichevski <olegk at apache.org> 
+
 * [HTTPCORE-197] Fixed bug causing the non-blocking ChunkDecoder to report some data stream as 
   truncated under special conditions.
   Contributed by Denis Rogov <denrogov at gmail.com> and Oleg Kalnichevski <olegk at apache.org> 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/4e87e341/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java
index 35f4f52..beae5cb 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java
@@ -244,17 +244,20 @@ public class SSLIOSession implements IOSession, SessionBufferStatus {
     
     private boolean decryptData() throws SSLException {
         boolean decrypted = false;
-        if (this.inEncrypted.position() > 0) {
+        SSLEngineResult.Status opStatus = Status.OK;
+        while (this.inEncrypted.position() > 0 && opStatus == Status.OK) {
             this.inEncrypted.flip();
             SSLEngineResult result = this.sslEngine.unwrap(this.inEncrypted, this.inPlain);
             this.inEncrypted.compact();
-            if (result.getStatus() == Status.CLOSED) {
+            
+            opStatus = result.getStatus();
+            if (opStatus == Status.CLOSED) {
                 this.status = CLOSED;
             }
-            if (result.getStatus() == Status.BUFFER_UNDERFLOW && this.endOfStream) {
+            if (opStatus == Status.BUFFER_UNDERFLOW && this.endOfStream) {
                 this.status = CLOSED;
             }
-            if (result.getStatus() == Status.OK) {
+            if (opStatus == Status.OK) {
                 decrypted = true;
             }
         }