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 2009/05/21 15:51:46 UTC

svn commit: r777116 - in /httpcomponents/httpcore/trunk: RELEASE_NOTES.txt httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java

Author: olegk
Date: Thu May 21 13:51:46 2009
New Revision: 777116

URL: http://svn.apache.org/viewvc?rev=777116&view=rev
Log:
HTTPCORE-196: SSLIOSession now unwraps encrypted data more aggressively eliminating long pauses when receiving data over non-blocking connections

Modified:
    httpcomponents/httpcore/trunk/RELEASE_NOTES.txt
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java

Modified: httpcomponents/httpcore/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/RELEASE_NOTES.txt?rev=777116&r1=777115&r2=777116&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpcore/trunk/RELEASE_NOTES.txt Thu May 21 13:51:46 2009
@@ -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> 

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java?rev=777116&r1=777115&r2=777116&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java Thu May 21 13:51:46 2009
@@ -244,17 +244,20 @@
     
     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;
             }
         }