hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: svn commit: r1371171 - in /httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http: client/protocol/ conn/ impl/client/ impl/client/exec/
Date Thu, 09 Aug 2012 12:10:32 GMT
>
> If HttpSSLConnection has camel casing for "HTTP", should it not so too for
"SSL":HttpSslConnection?

Gary

On Thu, Aug 9, 2012 at 7:42 AM, <olegk@apache.org> wrote:

> Author: olegk
> Date: Thu Aug  9 11:42:19 2012
> New Revision: 1371171
>
> URL: http://svn.apache.org/viewvc?rev=1371171&view=rev
> Log:
> Replaced HttpRoutedConnection with HttpSSLConnection interface
>
> Added:
>
> httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/HttpSSLConnection.java
>   (with props)
> Modified:
>
> httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/protocol/ClientContext.java
>
> httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ManagedClientConnection.java
>
> httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultUserTokenHandler.java
>
> httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/exec/MainClientExec.java
>
> Modified:
> httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/protocol/ClientContext.java
> URL:
> http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/protocol/ClientContext.java?rev=1371171&r1=1371170&r2=1371171&view=diff
>
> ==============================================================================
> ---
> httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/protocol/ClientContext.java
> (original)
> +++
> httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/protocol/ClientContext.java
> Thu Aug  9 11:42:19 2012
> @@ -115,12 +115,4 @@ public interface ClientContext {
>       */
>      public static final String USER_TOKEN            = "http.user-token";
>
> -    /**
> -     * Attribute name of a {@link javax.net.SSLSession} object that
> represents
> -     * the actual SSL session.
> -     *
> -     * @since 4.3
> -     */
> -    public static final String SSL_SESSION           = "http.ssl-session";
> -
>  }
>
> Added:
> httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/HttpSSLConnection.java
> URL:
> http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/HttpSSLConnection.java?rev=1371171&view=auto
>
> ==============================================================================
> ---
> httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/HttpSSLConnection.java
> (added)
> +++
> httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/HttpSSLConnection.java
> Thu Aug  9 11:42:19 2012
> @@ -0,0 +1,52 @@
> +/*
> + * ====================================================================
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements.  See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership.  The ASF licenses this file
> + * to you under the Apache License, Version 2.0 (the
> + * "License"); you may not use this file except in compliance
> + * with the License.  You may obtain a copy of the License at
> + *
> + *   http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing,
> + * software distributed under the License is distributed on an
> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + * KIND, either express or implied.  See the License for the
> + * specific language governing permissions and limitations
> + * under the License.
> + * ====================================================================
> + *
> + * This software consists of voluntary contributions made by many
> + * individuals on behalf of the Apache Software Foundation.  For more
> + * information on the Apache Software Foundation, please see
> + * <http://www.apache.org/>.
> + *
> + */
> +
> +package org.apache.http.conn;
> +
> +import javax.net.ssl.SSLSession;
> +
> +import org.apache.http.HttpInetConnection;
> +
> +/**
> + * Extended interface that exposes SSL session details.
> + *
> + * @since 4.3
> + */
> +public interface HttpSSLConnection extends HttpInetConnection {
> +
> +    /**
> +     * Obtains the SSL session of the underlying connection, if any.
> +     * If this connection is open, and the underlying socket is an
> +     * {@link javax.net.ssl.SSLSocket SSLSocket}, the SSL session of
> +     * that socket is obtained. This is a potentially blocking operation.
> +     *
> +     * @return  the underlying SSL session if available,
> +     *          <code>null</code> otherwise
> +     */
> +    SSLSession getSSLSession();
> +
> +}
>
> Propchange:
> httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/HttpSSLConnection.java
>
> ------------------------------------------------------------------------------
>     svn:eol-style = native
>
> Propchange:
> httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/HttpSSLConnection.java
>
> ------------------------------------------------------------------------------
>     svn:keywords = Date Revision
>
> Propchange:
> httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/HttpSSLConnection.java
>
> ------------------------------------------------------------------------------
>     svn:mime-type = text/plain
>
> Modified:
> httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ManagedClientConnection.java
> URL:
> http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ManagedClientConnection.java?rev=1371171&r1=1371170&r2=1371171&view=diff
>
> ==============================================================================
> ---
> httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ManagedClientConnection.java
> (original)
> +++
> httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/ManagedClientConnection.java
> Thu Aug  9 11:42:19 2012
> @@ -47,7 +47,7 @@ import org.apache.http.conn.routing.Http
>   */
>  @SuppressWarnings("deprecation")
>  public interface ManagedClientConnection extends
> -    HttpClientConnection, HttpRoutedConnection, ConnectionReleaseTrigger {
> +    HttpClientConnection, HttpRoutedConnection, HttpSSLConnection,
> ConnectionReleaseTrigger {
>
>      /**
>       * Indicates whether this connection is secure.
>
> Modified:
> httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultUserTokenHandler.java
> URL:
> http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultUserTokenHandler.java?rev=1371171&r1=1371170&r2=1371171&view=diff
>
> ==============================================================================
> ---
> httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultUserTokenHandler.java
> (original)
> +++
> httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultUserTokenHandler.java
> Thu Aug  9 11:42:19 2012
> @@ -30,12 +30,15 @@ import java.security.Principal;
>
>  import javax.net.ssl.SSLSession;
>
> +import org.apache.http.HttpConnection;
>  import org.apache.http.annotation.Immutable;
>  import org.apache.http.auth.AuthScheme;
>  import org.apache.http.auth.AuthState;
>  import org.apache.http.auth.Credentials;
>  import org.apache.http.client.UserTokenHandler;
>  import org.apache.http.client.protocol.ClientContext;
> +import org.apache.http.conn.HttpSSLConnection;
> +import org.apache.http.protocol.ExecutionContext;
>  import org.apache.http.protocol.HttpContext;
>
>  /**
> @@ -71,9 +74,13 @@ public class DefaultUserTokenHandler imp
>          }
>
>          if (userPrincipal == null) {
> -            SSLSession sslsession = (SSLSession)
> context.getAttribute(ClientContext.SSL_SESSION);
> -            if (sslsession != null) {
> -                userPrincipal = sslsession.getLocalPrincipal();
> +            HttpConnection conn = (HttpConnection) context.getAttribute(
> +                    ExecutionContext.HTTP_CONNECTION);
> +            if (conn instanceof HttpSSLConnection) {
> +                SSLSession sslsession = ((HttpSSLConnection)
> conn).getSSLSession();
> +                if (sslsession != null) {
> +                    userPrincipal = sslsession.getLocalPrincipal();
> +                }
>              }
>          }
>
>
> Modified:
> httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/exec/MainClientExec.java
> URL:
> http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/exec/MainClientExec.java?rev=1371171&r1=1371170&r2=1371171&view=diff
>
> ==============================================================================
> ---
> httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/exec/MainClientExec.java
> (original)
> +++
> httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/exec/MainClientExec.java
> Thu Aug  9 11:42:19 2012
> @@ -221,7 +221,6 @@ public class MainClientExec implements C
>          }
>
>          context.setAttribute(ExecutionContext.HTTP_CONNECTION,
> managedConn);
> -        context.setAttribute(ClientContext.SSL_SESSION,
> managedConn.getSSLSession());
>
>          if (HttpConnectionParams.isStaleCheckingEnabled(params)) {
>              // validate connection
>
>
>


-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message