hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r517619 - /jakarta/httpcomponents/httpcore/trunk/module-niossl/src/main/java/org/apache/http/impl/nio/reactor/SSLIOSession.java
Date Tue, 13 Mar 2007 09:47:09 GMT
Author: olegk
Date: Tue Mar 13 02:47:08 2007
New Revision: 517619

URL: http://svn.apache.org/viewvc?view=rev&rev=517619
Log:
HTTPCORE-55: Fixed hostname verification callback invocation

Contributed by Asankha C. Perera <asankha at wso2.com>

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

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?view=diff&rev=517619&r1=517618&r2=517619
==============================================================================
--- 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
Tue Mar 13 02:47:08 2007
@@ -129,18 +129,12 @@
         }
         this.sslEngine.beginHandshake();
         doHandshake();
-
-        if (this.handler != null) {
-            this.handler.verify(
-                    this.session.getRemoteAddress(), 
-                    this.sslEngine.getSession());
-        }
     }
     
     private void doHandshake() throws SSLException {
         boolean handshaking = true;
         
-        SSLEngineResult result;
+        SSLEngineResult result = null;
         while (handshaking) {
             switch (this.sslEngine.getHandshakeStatus()) {
             case NEED_WRAP:
@@ -174,6 +168,17 @@
             case NOT_HANDSHAKING:
                 handshaking = false;
                 break;
+            }
+        }
+
+        // The SSLEngine has just finished handshaking. This value is only generated by a
call
+        // to SSLEngine.wrap()/unwrap() when that call finishes a handshake.
+        // It is never generated by SSLEngine.getHandshakeStatus(). 
+        if (result != null && result.getHandshakeStatus() == HandshakeStatus.FINISHED)
{
+            if (this.handler != null) {
+                this.handler.verify(
+                        this.session.getRemoteAddress(),
+                        this.sslEngine.getSession());
             }
         }
     }



Mime
View raw message