hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1134570 - in /httpcomponents/httpcore/branches/4.1.x: ./ RELEASE_NOTES.txt httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java
Date Sat, 11 Jun 2011 11:15:25 GMT
Author: olegk
Date: Sat Jun 11 11:15:25 2011
New Revision: 1134570

URL: http://svn.apache.org/viewvc?rev=1134570&view=rev
Log:
HTTPCORE-260: Non-blocking SSL I/O session can terminate prematurely causing message body
truncation when message content is chunk coded and the connection is closed on the opposite
end

Modified:
    httpcomponents/httpcore/branches/4.1.x/   (props changed)
    httpcomponents/httpcore/branches/4.1.x/RELEASE_NOTES.txt
    httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java
    httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java

Propchange: httpcomponents/httpcore/branches/4.1.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Jun 11 11:15:25 2011
@@ -1,2 +1,2 @@
 /httpcomponents/httpcore/branches/ibm_compat_branch:755687-758898
-/httpcomponents/httpcore/trunk:1102241-1102657
+/httpcomponents/httpcore/trunk:1102241-1102657,1133031-1134569

Modified: httpcomponents/httpcore/branches/4.1.x/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.1.x/RELEASE_NOTES.txt?rev=1134570&r1=1134569&r2=1134570&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.1.x/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpcore/branches/4.1.x/RELEASE_NOTES.txt Sat Jun 11 11:15:25 2011
@@ -1,3 +1,14 @@
+Changes since 4.1.1
+-------------------
+
+* [HTTPCORE-260] Non-blocking SSL I/O session can terminate prematurely causing message body

+  truncation when message content is chunk coded and the connection is closed on the opposite
end. 
+  Contributed by Oleg Kalnichevski <olegk at apache.org>
+
+* [HTTPCORE-257] Fixed incorrect results produced by DefaultConnectionReuseStrategy when
handling 
+  response messages whose content entity has been decoded or modified by a protocol interceptor.

+  Contributed by Oleg Kalnichevski <olegk at apache.org>
+
 Release 4.1.1
 -------------------
 

Modified: httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java?rev=1134570&r1=1134569&r2=1134570&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java
(original)
+++ httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java
Sat Jun 11 11:15:25 2011
@@ -251,7 +251,6 @@ public class IOSessionImpl implements IO
     }
 
     private static void formatOps(final StringBuffer buffer, int ops) {
-        buffer.append('[');
         if ((ops & SelectionKey.OP_READ) > 0) {
             buffer.append('r');
         }
@@ -264,21 +263,29 @@ public class IOSessionImpl implements IO
         if ((ops & SelectionKey.OP_CONNECT) > 0) {
             buffer.append('c');
         }
-        buffer.append(']');
     }
 
     @Override
     public synchronized String toString() {
         StringBuffer buffer = new StringBuffer();
         buffer.append("[");
+        switch (this.status) {
+        case ACTIVE:
+            buffer.append("ACTIVE");
+            break;
+        case CLOSING:
+            buffer.append("CLOSING");
+            break;
+        case CLOSED:
+            buffer.append("CLOSED");
+            break;
+        }
+        buffer.append("][");
         if (this.key.isValid()) {
-            buffer.append("interest ops: ");
             formatOps(buffer, this.interestOpsCallback != null ?
                     this.currentEventMask : this.key.interestOps());
-            buffer.append("; ready ops: ");
+            buffer.append(":");
             formatOps(buffer, this.key.readyOps());
-        } else {
-            buffer.append("invalid");
         }
         buffer.append("]");
         return buffer.toString();

Modified: httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java?rev=1134570&r1=1134569&r2=1134570&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java
(original)
+++ httpcomponents/httpcore/branches/4.1.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java
Sat Jun 11 11:15:25 2011
@@ -156,9 +156,6 @@ public class SSLIOSession implements IOS
                 if (result.getStatus() != Status.OK) {
                     handshaking = false;
                 }
-                if (result.getStatus() == Status.CLOSED) {
-                    this.status = CLOSED;
-                }
                 break;
             case NEED_UNWRAP:
                 // Process incoming handshake data
@@ -168,12 +165,6 @@ public class SSLIOSession implements IOS
                 if (result.getStatus() != Status.OK) {
                     handshaking = false;
                 }
-                if (result.getStatus() == Status.CLOSED) {
-                    this.status = CLOSED;
-                }
-                if (result.getStatus() == Status.BUFFER_UNDERFLOW && this.endOfStream)
{
-                    this.status = CLOSED;
-                }
                 break;
             case NEED_TASK:
                 Runnable r = this.sslEngine.getDelegatedTask();
@@ -198,7 +189,8 @@ public class SSLIOSession implements IOS
     }
 
     private void updateEventMask() {
-        if (this.sslEngine.isInboundDone() && this.sslEngine.isOutboundDone()) {
+        if (this.status == CLOSING &&
+                this.sslEngine.isInboundDone() && this.sslEngine.isOutboundDone())
{
             this.status = CLOSED;
         }
         if (this.status == CLOSED) {
@@ -255,12 +247,6 @@ public class SSLIOSession implements IOS
             this.inEncrypted.compact();
 
             opStatus = result.getStatus();
-            if (opStatus == Status.CLOSED) {
-                this.status = CLOSED;
-            }
-            if (opStatus == Status.BUFFER_UNDERFLOW && this.endOfStream) {
-                this.status = CLOSED;
-            }
             if (opStatus == Status.OK) {
                 decrypted = true;
             }
@@ -351,18 +337,19 @@ public class SSLIOSession implements IOS
         }
     }
 
-    public void close() {
-        if (this.status != ACTIVE) {
+    public synchronized void close() {
+        if (this.status >= CLOSING) {
             return;
         }
         this.status = CLOSING;
-        synchronized(this) {
-            this.sslEngine.closeOutbound();
-            updateEventMask();
-        }
+        this.sslEngine.closeOutbound();
+        updateEventMask();
     }
 
-    public void shutdown() {
+    public synchronized void shutdown() {
+        if (this.status == CLOSED) {
+            return;
+        }
         this.status = CLOSED;
         this.session.shutdown();
     }
@@ -372,7 +359,7 @@ public class SSLIOSession implements IOS
     }
 
     public boolean isClosed() {
-        return this.status != ACTIVE;
+        return this.status >= CLOSING;
     }
 
     public synchronized boolean isInboundDone() {
@@ -454,8 +441,23 @@ public class SSLIOSession implements IOS
     public String toString() {
         StringBuffer buffer = new StringBuffer();
         buffer.append(this.session);
-        buffer.append("[SSL handshake status: ");
+        buffer.append("[");
+        switch (this.status) {
+        case ACTIVE:
+            buffer.append("ACTIVE");
+            break;
+        case CLOSING:
+            buffer.append("CLOSING");
+            break;
+        case CLOSED:
+            buffer.append("CLOSED");
+            break;
+        }
+        buffer.append("][");
         buffer.append(this.sslEngine.getHandshakeStatus());
+        if (this.endOfStream) {
+            buffer.append("EOF][");
+        }
         buffer.append("][");
         buffer.append(this.inEncrypted.position());
         buffer.append("][");



Mime
View raw message