Uploaded image for project: 'HttpComponents HttpClient'
  1. HttpComponents HttpClient
  2. HTTPCLIENT-1097

BrowserCompatHostnameVerifier and StrictHostnameVerifier should handle wildcards in SSL certificates better

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 4.1.1
    • 4.1.2
    • HttpClient (classic)
    • None

    Description

      I ran into a problem with SSL wildcard certificates in the class BrowserCompatHostnameVerifier. It handles ".example.org" fine but "server.example.org" fails to work correctly. The javadoc claims that it should behave the same way as curl and FireFox. In Firefox an SSL certificate for "server*.example.org" works fine for the host "server.example.org", using HttpClient it throws an exception.

      Here is an example test (JUnit4):

      package org.example.hb;

      import javax.net.ssl.SSLException;

      import org.apache.http.conn.ssl.BrowserCompatHostnameVerifier;
      import org.junit.Test;

      public class BrowserCompatHostnameVerifierTest {

      /**

      • Should not throw an exeption in the verify method.
      • @throws SSLException
        */
        @Test
        public void testVerifyStringStringArrayStringArray() throws SSLException
        {
        BrowserCompatHostnameVerifier hv = new BrowserCompatHostnameVerifier();
        String host = "www.example.org";
        String[] cns = {"www*.example.org"}

        ;

      hv.verify(host, cns, cns);
      }

      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            hennus2011 Hennus Bergman
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: