hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r584141 - in /jakarta/httpcomponents/httpcore/trunk: RELEASE_NOTES.txt module-niossl/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java
Date Fri, 12 Oct 2007 11:54:38 GMT
Author: olegk
Date: Fri Oct 12 04:54:37 2007
New Revision: 584141

URL: http://svn.apache.org/viewvc?rev=584141&view=rev
Log:
HTTPCORE-123: SSLSession loses buffered data, if the connection has been closed by the peer.

Contributed by Risto Reinpõld <risto.reinpold at gmail.com>
Reviewed by Oleg Kalnichevski

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

Modified: jakarta/httpcomponents/httpcore/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/RELEASE_NOTES.txt?rev=584141&r1=584140&r2=584141&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/RELEASE_NOTES.txt (original)
+++ jakarta/httpcomponents/httpcore/trunk/RELEASE_NOTES.txt Fri Oct 12 04:54:37 2007
@@ -1,3 +1,9 @@
+Changes since 4.0 Alpha 6
+
+* [HTTPCORE-123] Fixed problem with SSLSession losing buffered data, if the 
+  connection has been closed by the peer.
+  Contributed by Risto Reinpõld <risto.reinpold at gmail.com>
+
 Release 4.0 Alpha 6
 -------------------
 

Modified: jakarta/httpcomponents/httpcore/trunk/module-niossl/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-niossl/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java?rev=584141&r1=584140&r2=584141&view=diff
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-niossl/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-niossl/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java
Fri Oct 12 04:54:37 2007
@@ -271,7 +271,7 @@
         updateEventMask();
     }
     
-    private synchronized int wrap(final ByteBuffer src) throws SSLException {
+    private synchronized int writePlain(final ByteBuffer src) throws SSLException {
         if (src == null) {
             throw new IllegalArgumentException("Byte buffer may not be null");
         }
@@ -294,13 +294,10 @@
         }
     }
     
-    private synchronized int unwrap(final ByteBuffer dst) throws SSLException {
+    private synchronized int readPlain(final ByteBuffer dst) throws SSLException {
         if (dst == null) {
             throw new IllegalArgumentException("Byte buffer may not be null");
         }
-        if (this.status != ACTIVE) {
-            return -1;
-        }
         if (this.inPlain.position() > 0) {
             this.inPlain.flip();
             int n = Math.min(this.inPlain.remaining(), dst.remaining());
@@ -310,7 +307,11 @@
             this.inPlain.compact();
             return n; 
         } else {
-            return 0;
+            if (this.status == ACTIVE) {
+                return 0;
+            } else {
+                return -1;
+            }
         }
     }
     
@@ -434,11 +435,11 @@
     private class InternalByteChannel implements ByteChannel {
 
         public int write(final ByteBuffer src) throws IOException {
-            return wrap(src);
+            return writePlain(src);
         }
 
         public int read(final ByteBuffer dst) throws IOException {
-            return unwrap(dst);
+            return readPlain(dst);
         }
 
         public void close() throws IOException {



Mime
View raw message