hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1530010 [31/38] - in /httpcomponents/site: ./ httpcomponents-asyncclient-4.0.x/ httpcomponents-client-4.2.x/ httpcomponents-client-4.3.x/ httpcomponents-client-4.3.x/fluent-hc/ httpcomponents-client-4.3.x/fluent-hc/apidocs/ httpcomponents-...
Date Mon, 07 Oct 2013 17:52:46 GMT
Modified: httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/routing/package-frame.html
URL: http://svn.apache.org/viewvc/httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/routing/package-frame.html?rev=1530010&r1=1530009&r2=1530010&view=diff
==============================================================================
--- httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/routing/package-frame.html (original)
+++ httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/routing/package-frame.html Mon Oct  7 17:52:27 2013
@@ -3,7 +3,7 @@
 <html xml:lang="en" lang="en">
 	<head>
 		<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
-		<title>Apache HttpClient 4.3 Reference Package org.apache.http.conn.routing</title>
+		<title>Apache HttpClient 4.3.1 Reference Package org.apache.http.conn.routing</title>
 		<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="style" />
 	</head>
 	<body>

Modified: httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/routing/package-summary.html
URL: http://svn.apache.org/viewvc/httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/routing/package-summary.html?rev=1530010&r1=1530009&r2=1530010&view=diff
==============================================================================
--- httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/routing/package-summary.html (original)
+++ httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/routing/package-summary.html Mon Oct  7 17:52:27 2013
@@ -3,7 +3,7 @@
 <html xml:lang="en" lang="en">
 	<head>
 		<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
-		<title>Apache HttpClient 4.3 Reference Package org.apache.http.conn.routing</title>
+		<title>Apache HttpClient 4.3.1 Reference Package org.apache.http.conn.routing</title>
 		<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="style" />
 	</head>
 	<body>

Modified: httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/scheme/package-frame.html
URL: http://svn.apache.org/viewvc/httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/scheme/package-frame.html?rev=1530010&r1=1530009&r2=1530010&view=diff
==============================================================================
--- httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/scheme/package-frame.html (original)
+++ httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/scheme/package-frame.html Mon Oct  7 17:52:27 2013
@@ -3,7 +3,7 @@
 <html xml:lang="en" lang="en">
 	<head>
 		<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
-		<title>Apache HttpClient 4.3 Reference Package org.apache.http.conn.scheme</title>
+		<title>Apache HttpClient 4.3.1 Reference Package org.apache.http.conn.scheme</title>
 		<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="style" />
 	</head>
 	<body>

Modified: httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/scheme/package-summary.html
URL: http://svn.apache.org/viewvc/httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/scheme/package-summary.html?rev=1530010&r1=1530009&r2=1530010&view=diff
==============================================================================
--- httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/scheme/package-summary.html (original)
+++ httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/scheme/package-summary.html Mon Oct  7 17:52:27 2013
@@ -3,7 +3,7 @@
 <html xml:lang="en" lang="en">
 	<head>
 		<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
-		<title>Apache HttpClient 4.3 Reference Package org.apache.http.conn.scheme</title>
+		<title>Apache HttpClient 4.3.1 Reference Package org.apache.http.conn.scheme</title>
 		<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="style" />
 	</head>
 	<body>

Modified: httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/socket/package-frame.html
URL: http://svn.apache.org/viewvc/httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/socket/package-frame.html?rev=1530010&r1=1530009&r2=1530010&view=diff
==============================================================================
--- httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/socket/package-frame.html (original)
+++ httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/socket/package-frame.html Mon Oct  7 17:52:27 2013
@@ -3,7 +3,7 @@
 <html xml:lang="en" lang="en">
 	<head>
 		<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
-		<title>Apache HttpClient 4.3 Reference Package org.apache.http.conn.socket</title>
+		<title>Apache HttpClient 4.3.1 Reference Package org.apache.http.conn.socket</title>
 		<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="style" />
 	</head>
 	<body>

Modified: httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/socket/package-summary.html
URL: http://svn.apache.org/viewvc/httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/socket/package-summary.html?rev=1530010&r1=1530009&r2=1530010&view=diff
==============================================================================
--- httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/socket/package-summary.html (original)
+++ httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/socket/package-summary.html Mon Oct  7 17:52:27 2013
@@ -3,7 +3,7 @@
 <html xml:lang="en" lang="en">
 	<head>
 		<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
-		<title>Apache HttpClient 4.3 Reference Package org.apache.http.conn.socket</title>
+		<title>Apache HttpClient 4.3.1 Reference Package org.apache.http.conn.socket</title>
 		<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="style" />
 	</head>
 	<body>

Modified: httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/ssl/AbstractVerifier.html
URL: http://svn.apache.org/viewvc/httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/ssl/AbstractVerifier.html?rev=1530010&r1=1530009&r2=1530010&view=diff
==============================================================================
--- httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/ssl/AbstractVerifier.html (original)
+++ httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/ssl/AbstractVerifier.html Mon Oct  7 17:52:27 2013
@@ -211,188 +211,199 @@
 <a class="jxr_linenumber" name="201" href="#201">201</a>             <em class="jxr_comment">// action.  It also can't be [*.co.uk] or [*.co.jp] or</em>
 <a class="jxr_linenumber" name="202" href="#202">202</a>             <em class="jxr_comment">// [*.org.uk], etc...</em>
 <a class="jxr_linenumber" name="203" href="#203">203</a>             <strong class="jxr_keyword">final</strong> String parts[] = cn.split(<span class="jxr_string">"&#92;&#92;."</span>);
-<a class="jxr_linenumber" name="204" href="#204">204</a>             <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">boolean</strong> doWildcard = parts.length &gt;= 3 &amp;&amp;
-<a class="jxr_linenumber" name="205" href="#205">205</a>                                  parts[0].endsWith(<span class="jxr_string">"*"</span>) &amp;&amp;
-<a class="jxr_linenumber" name="206" href="#206">206</a>                                  acceptableCountryWildcard(cn) &amp;&amp;
-<a class="jxr_linenumber" name="207" href="#207">207</a>                                  !isIPAddress(host);
-<a class="jxr_linenumber" name="208" href="#208">208</a> 
-<a class="jxr_linenumber" name="209" href="#209">209</a>             <strong class="jxr_keyword">if</strong>(doWildcard) {
-<a class="jxr_linenumber" name="210" href="#210">210</a>                 <strong class="jxr_keyword">final</strong> String firstpart = parts[0];
-<a class="jxr_linenumber" name="211" href="#211">211</a>                 <strong class="jxr_keyword">if</strong> (firstpart.length() &gt; 1) { <em class="jxr_comment">// e.g. server*</em>
-<a class="jxr_linenumber" name="212" href="#212">212</a>                     <strong class="jxr_keyword">final</strong> String prefix = firstpart.substring(0, firstpart.length() - 1); <em class="jxr_comment">// e.g. server</em>
-<a class="jxr_linenumber" name="213" href="#213">213</a>                     <strong class="jxr_keyword">final</strong> String suffix = cn.substring(firstpart.length()); <em class="jxr_comment">// skip wildcard part from cn</em>
-<a class="jxr_linenumber" name="214" href="#214">214</a>                     <strong class="jxr_keyword">final</strong> String hostSuffix = hostName.substring(prefix.length()); <em class="jxr_comment">// skip wildcard part from host</em>
-<a class="jxr_linenumber" name="215" href="#215">215</a>                     match = hostName.startsWith(prefix) &amp;&amp; hostSuffix.endsWith(suffix);
-<a class="jxr_linenumber" name="216" href="#216">216</a>                 } <strong class="jxr_keyword">else</strong> {
-<a class="jxr_linenumber" name="217" href="#217">217</a>                     match = hostName.endsWith(cn.substring(1));
-<a class="jxr_linenumber" name="218" href="#218">218</a>                 }
-<a class="jxr_linenumber" name="219" href="#219">219</a>                 <strong class="jxr_keyword">if</strong>(match &amp;&amp; strictWithSubDomains) {
-<a class="jxr_linenumber" name="220" href="#220">220</a>                     <em class="jxr_comment">// If we're in strict mode, then [*.foo.com] is not</em>
-<a class="jxr_linenumber" name="221" href="#221">221</a>                     <em class="jxr_comment">// allowed to match [a.b.foo.com]</em>
-<a class="jxr_linenumber" name="222" href="#222">222</a>                     match = countDots(hostName) == countDots(cn);
-<a class="jxr_linenumber" name="223" href="#223">223</a>                 }
-<a class="jxr_linenumber" name="224" href="#224">224</a>             } <strong class="jxr_keyword">else</strong> {
-<a class="jxr_linenumber" name="225" href="#225">225</a>                 match = hostName.equals(normaliseIPv6Address(cn));
-<a class="jxr_linenumber" name="226" href="#226">226</a>             }
-<a class="jxr_linenumber" name="227" href="#227">227</a>             <strong class="jxr_keyword">if</strong>(match) {
-<a class="jxr_linenumber" name="228" href="#228">228</a>                 <strong class="jxr_keyword">break</strong>;
-<a class="jxr_linenumber" name="229" href="#229">229</a>             }
-<a class="jxr_linenumber" name="230" href="#230">230</a>         }
-<a class="jxr_linenumber" name="231" href="#231">231</a>         <strong class="jxr_keyword">if</strong>(!match) {
-<a class="jxr_linenumber" name="232" href="#232">232</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> SSLException(<span class="jxr_string">"hostname in certificate didn't match: &lt;"</span> + host + <span class="jxr_string">"&gt; !="</span> + buf);
-<a class="jxr_linenumber" name="233" href="#233">233</a>         }
-<a class="jxr_linenumber" name="234" href="#234">234</a>     }
-<a class="jxr_linenumber" name="235" href="#235">235</a> 
-<a class="jxr_linenumber" name="236" href="#236">236</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">boolean</strong> acceptableCountryWildcard(<strong class="jxr_keyword">final</strong> String cn) {
-<a class="jxr_linenumber" name="237" href="#237">237</a>         <strong class="jxr_keyword">final</strong> String parts[] = cn.split(<span class="jxr_string">"&#92;&#92;."</span>);
-<a class="jxr_linenumber" name="238" href="#238">238</a>         <strong class="jxr_keyword">if</strong> (parts.length != 3 || parts[2].length() != 2) {
-<a class="jxr_linenumber" name="239" href="#239">239</a>             <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">true</strong>; <em class="jxr_comment">// it's not an attempt to wildcard a 2TLD within a country code</em>
-<a class="jxr_linenumber" name="240" href="#240">240</a>         }
-<a class="jxr_linenumber" name="241" href="#241">241</a>         <strong class="jxr_keyword">return</strong> Arrays.binarySearch(BAD_COUNTRY_2LDS, parts[1]) &lt; 0;
-<a class="jxr_linenumber" name="242" href="#242">242</a>     }
-<a class="jxr_linenumber" name="243" href="#243">243</a> 
-<a class="jxr_linenumber" name="244" href="#244">244</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> String[] getCNs(<strong class="jxr_keyword">final</strong> X509Certificate cert) {
-<a class="jxr_linenumber" name="245" href="#245">245</a>         <strong class="jxr_keyword">final</strong> LinkedList&lt;String&gt; cnList = <strong class="jxr_keyword">new</strong> LinkedList&lt;String&gt;();
-<a class="jxr_linenumber" name="246" href="#246">246</a>         <em class="jxr_comment">/*</em>
-<a class="jxr_linenumber" name="247" href="#247">247</a> <em class="jxr_comment">          Sebastian Hauer's original StrictSSLProtocolSocketFactory used</em>
-<a class="jxr_linenumber" name="248" href="#248">248</a> <em class="jxr_comment">          getName() and had the following comment:</em>
-<a class="jxr_linenumber" name="249" href="#249">249</a> 
-<a class="jxr_linenumber" name="250" href="#250">250</a> <em class="jxr_comment">                Parses a X.500 distinguished name for the value of the</em>
-<a class="jxr_linenumber" name="251" href="#251">251</a> <em class="jxr_comment">                "Common Name" field.  This is done a bit sloppy right</em>
-<a class="jxr_linenumber" name="252" href="#252">252</a> <em class="jxr_comment">                 now and should probably be done a bit more according to</em>
-<a class="jxr_linenumber" name="253" href="#253">253</a> <em class="jxr_comment">                &lt;code&gt;RFC 2253&lt;/code&gt;.</em>
+<a class="jxr_linenumber" name="204" href="#204">204</a>             <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">boolean</strong> doWildcard =
+<a class="jxr_linenumber" name="205" href="#205">205</a>                     parts.length &gt;= 3 &amp;&amp; parts[0].endsWith(<span class="jxr_string">"*"</span>) &amp;&amp;
+<a class="jxr_linenumber" name="206" href="#206">206</a>                     validCountryWildcard(cn) &amp;&amp; !isIPAddress(host);
+<a class="jxr_linenumber" name="207" href="#207">207</a> 
+<a class="jxr_linenumber" name="208" href="#208">208</a>             <strong class="jxr_keyword">if</strong>(doWildcard) {
+<a class="jxr_linenumber" name="209" href="#209">209</a>                 <strong class="jxr_keyword">final</strong> String firstpart = parts[0];
+<a class="jxr_linenumber" name="210" href="#210">210</a>                 <strong class="jxr_keyword">if</strong> (firstpart.length() &gt; 1) { <em class="jxr_comment">// e.g. server*</em>
+<a class="jxr_linenumber" name="211" href="#211">211</a>                     <strong class="jxr_keyword">final</strong> String prefix = firstpart.substring(0, firstpart.length() - 1); <em class="jxr_comment">// e.g. server</em>
+<a class="jxr_linenumber" name="212" href="#212">212</a>                     <strong class="jxr_keyword">final</strong> String suffix = cn.substring(firstpart.length()); <em class="jxr_comment">// skip wildcard part from cn</em>
+<a class="jxr_linenumber" name="213" href="#213">213</a>                     <strong class="jxr_keyword">final</strong> String hostSuffix = hostName.substring(prefix.length()); <em class="jxr_comment">// skip wildcard part from host</em>
+<a class="jxr_linenumber" name="214" href="#214">214</a>                     match = hostName.startsWith(prefix) &amp;&amp; hostSuffix.endsWith(suffix);
+<a class="jxr_linenumber" name="215" href="#215">215</a>                 } <strong class="jxr_keyword">else</strong> {
+<a class="jxr_linenumber" name="216" href="#216">216</a>                     match = hostName.endsWith(cn.substring(1));
+<a class="jxr_linenumber" name="217" href="#217">217</a>                 }
+<a class="jxr_linenumber" name="218" href="#218">218</a>                 <strong class="jxr_keyword">if</strong>(match &amp;&amp; strictWithSubDomains) {
+<a class="jxr_linenumber" name="219" href="#219">219</a>                     <em class="jxr_comment">// If we're in strict mode, then [*.foo.com] is not</em>
+<a class="jxr_linenumber" name="220" href="#220">220</a>                     <em class="jxr_comment">// allowed to match [a.b.foo.com]</em>
+<a class="jxr_linenumber" name="221" href="#221">221</a>                     match = countDots(hostName) == countDots(cn);
+<a class="jxr_linenumber" name="222" href="#222">222</a>                 }
+<a class="jxr_linenumber" name="223" href="#223">223</a>             } <strong class="jxr_keyword">else</strong> {
+<a class="jxr_linenumber" name="224" href="#224">224</a>                 match = hostName.equals(normaliseIPv6Address(cn));
+<a class="jxr_linenumber" name="225" href="#225">225</a>             }
+<a class="jxr_linenumber" name="226" href="#226">226</a>             <strong class="jxr_keyword">if</strong>(match) {
+<a class="jxr_linenumber" name="227" href="#227">227</a>                 <strong class="jxr_keyword">break</strong>;
+<a class="jxr_linenumber" name="228" href="#228">228</a>             }
+<a class="jxr_linenumber" name="229" href="#229">229</a>         }
+<a class="jxr_linenumber" name="230" href="#230">230</a>         <strong class="jxr_keyword">if</strong>(!match) {
+<a class="jxr_linenumber" name="231" href="#231">231</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> SSLException(<span class="jxr_string">"hostname in certificate didn't match: &lt;"</span> + host + <span class="jxr_string">"&gt; !="</span> + buf);
+<a class="jxr_linenumber" name="232" href="#232">232</a>         }
+<a class="jxr_linenumber" name="233" href="#233">233</a>     }
+<a class="jxr_linenumber" name="234" href="#234">234</a> 
+<a class="jxr_linenumber" name="235" href="#235">235</a>     <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="236" href="#236">236</a> <em class="jxr_javadoccomment">     * @deprecated (4.3.1) should not be a part of public APIs.</em>
+<a class="jxr_linenumber" name="237" href="#237">237</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="238" href="#238">238</a>     @Deprecated
+<a class="jxr_linenumber" name="239" href="#239">239</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">boolean</strong> acceptableCountryWildcard(<strong class="jxr_keyword">final</strong> String cn) {
+<a class="jxr_linenumber" name="240" href="#240">240</a>         <strong class="jxr_keyword">final</strong> String parts[] = cn.split(<span class="jxr_string">"&#92;&#92;."</span>);
+<a class="jxr_linenumber" name="241" href="#241">241</a>         <strong class="jxr_keyword">if</strong> (parts.length != 3 || parts[2].length() != 2) {
+<a class="jxr_linenumber" name="242" href="#242">242</a>             <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">true</strong>; <em class="jxr_comment">// it's not an attempt to wildcard a 2TLD within a country code</em>
+<a class="jxr_linenumber" name="243" href="#243">243</a>         }
+<a class="jxr_linenumber" name="244" href="#244">244</a>         <strong class="jxr_keyword">return</strong> Arrays.binarySearch(BAD_COUNTRY_2LDS, parts[1]) &lt; 0;
+<a class="jxr_linenumber" name="245" href="#245">245</a>     }
+<a class="jxr_linenumber" name="246" href="#246">246</a> 
+<a class="jxr_linenumber" name="247" href="#247">247</a>     <strong class="jxr_keyword">boolean</strong> validCountryWildcard(<strong class="jxr_keyword">final</strong> String cn) {
+<a class="jxr_linenumber" name="248" href="#248">248</a>         <strong class="jxr_keyword">final</strong> String parts[] = cn.split(<span class="jxr_string">"&#92;&#92;."</span>);
+<a class="jxr_linenumber" name="249" href="#249">249</a>         <strong class="jxr_keyword">if</strong> (parts.length != 3 || parts[2].length() != 2) {
+<a class="jxr_linenumber" name="250" href="#250">250</a>             <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">true</strong>; <em class="jxr_comment">// it's not an attempt to wildcard a 2TLD within a country code</em>
+<a class="jxr_linenumber" name="251" href="#251">251</a>         }
+<a class="jxr_linenumber" name="252" href="#252">252</a>         <strong class="jxr_keyword">return</strong> Arrays.binarySearch(BAD_COUNTRY_2LDS, parts[1]) &lt; 0;
+<a class="jxr_linenumber" name="253" href="#253">253</a>     }
 <a class="jxr_linenumber" name="254" href="#254">254</a> 
-<a class="jxr_linenumber" name="255" href="#255">255</a> <em class="jxr_comment">           I've noticed that toString() seems to do a better job than</em>
-<a class="jxr_linenumber" name="256" href="#256">256</a> <em class="jxr_comment">           getName() on these X500Principal objects, so I'm hoping that</em>
-<a class="jxr_linenumber" name="257" href="#257">257</a> <em class="jxr_comment">           addresses Sebastian's concern.</em>
-<a class="jxr_linenumber" name="258" href="#258">258</a> 
-<a class="jxr_linenumber" name="259" href="#259">259</a> <em class="jxr_comment">           For example, getName() gives me this:</em>
-<a class="jxr_linenumber" name="260" href="#260">260</a> <em class="jxr_comment">           1.2.840.113549.1.9.1=#16166a756c6975736461766965734063756362632e636f6d</em>
-<a class="jxr_linenumber" name="261" href="#261">261</a> 
-<a class="jxr_linenumber" name="262" href="#262">262</a> <em class="jxr_comment">           whereas toString() gives me this:</em>
-<a class="jxr_linenumber" name="263" href="#263">263</a> <em class="jxr_comment">           EMAILADDRESS=juliusdavies@cucbc.com</em>
-<a class="jxr_linenumber" name="264" href="#264">264</a> 
-<a class="jxr_linenumber" name="265" href="#265">265</a> <em class="jxr_comment">           Looks like toString() even works with non-ascii domain names!</em>
-<a class="jxr_linenumber" name="266" href="#266">266</a> <em class="jxr_comment">           I tested it with "&amp;#x82b1;&amp;#x5b50;.co.jp" and it worked fine.</em>
-<a class="jxr_linenumber" name="267" href="#267">267</a> <em class="jxr_comment">        */</em>
-<a class="jxr_linenumber" name="268" href="#268">268</a> 
-<a class="jxr_linenumber" name="269" href="#269">269</a>         <strong class="jxr_keyword">final</strong> String subjectPrincipal = cert.getSubjectX500Principal().toString();
-<a class="jxr_linenumber" name="270" href="#270">270</a>         <strong class="jxr_keyword">final</strong> StringTokenizer st = <strong class="jxr_keyword">new</strong> StringTokenizer(subjectPrincipal, <span class="jxr_string">",+"</span>);
-<a class="jxr_linenumber" name="271" href="#271">271</a>         <strong class="jxr_keyword">while</strong>(st.hasMoreTokens()) {
-<a class="jxr_linenumber" name="272" href="#272">272</a>             <strong class="jxr_keyword">final</strong> String tok = st.nextToken().trim();
-<a class="jxr_linenumber" name="273" href="#273">273</a>             <strong class="jxr_keyword">if</strong> (tok.length() &gt; 3) {
-<a class="jxr_linenumber" name="274" href="#274">274</a>                 <strong class="jxr_keyword">if</strong> (tok.substring(0, 3).equalsIgnoreCase(<span class="jxr_string">"CN="</span>)) {
-<a class="jxr_linenumber" name="275" href="#275">275</a>                     cnList.add(tok.substring(3));
-<a class="jxr_linenumber" name="276" href="#276">276</a>                 }
-<a class="jxr_linenumber" name="277" href="#277">277</a>             }
-<a class="jxr_linenumber" name="278" href="#278">278</a>         }
-<a class="jxr_linenumber" name="279" href="#279">279</a>         <strong class="jxr_keyword">if</strong>(!cnList.isEmpty()) {
-<a class="jxr_linenumber" name="280" href="#280">280</a>             <strong class="jxr_keyword">final</strong> String[] cns = <strong class="jxr_keyword">new</strong> String[cnList.size()];
-<a class="jxr_linenumber" name="281" href="#281">281</a>             cnList.toArray(cns);
-<a class="jxr_linenumber" name="282" href="#282">282</a>             <strong class="jxr_keyword">return</strong> cns;
-<a class="jxr_linenumber" name="283" href="#283">283</a>         } <strong class="jxr_keyword">else</strong> {
-<a class="jxr_linenumber" name="284" href="#284">284</a>             <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong>;
-<a class="jxr_linenumber" name="285" href="#285">285</a>         }
-<a class="jxr_linenumber" name="286" href="#286">286</a>     }
-<a class="jxr_linenumber" name="287" href="#287">287</a> 
-<a class="jxr_linenumber" name="288" href="#288">288</a>     <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="289" href="#289">289</a> <em class="jxr_javadoccomment">     * Extracts the array of SubjectAlt DNS or IP names from an X509Certificate.</em>
-<a class="jxr_linenumber" name="290" href="#290">290</a> <em class="jxr_javadoccomment">     * Returns null if there aren't any.</em>
-<a class="jxr_linenumber" name="291" href="#291">291</a> <em class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="292" href="#292">292</a> <em class="jxr_javadoccomment">     * @param cert X509Certificate</em>
-<a class="jxr_linenumber" name="293" href="#293">293</a> <em class="jxr_javadoccomment">     * @param hostname</em>
-<a class="jxr_linenumber" name="294" href="#294">294</a> <em class="jxr_javadoccomment">     * @return Array of SubjectALT DNS or IP names stored in the certificate.</em>
-<a class="jxr_linenumber" name="295" href="#295">295</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="296" href="#296">296</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> String[] getSubjectAlts(
-<a class="jxr_linenumber" name="297" href="#297">297</a>             <strong class="jxr_keyword">final</strong> X509Certificate cert, <strong class="jxr_keyword">final</strong> String hostname) {
-<a class="jxr_linenumber" name="298" href="#298">298</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> subjectType;
-<a class="jxr_linenumber" name="299" href="#299">299</a>         <strong class="jxr_keyword">if</strong> (isIPAddress(hostname)) {
-<a class="jxr_linenumber" name="300" href="#300">300</a>             subjectType = 7;
-<a class="jxr_linenumber" name="301" href="#301">301</a>         } <strong class="jxr_keyword">else</strong> {
-<a class="jxr_linenumber" name="302" href="#302">302</a>             subjectType = 2;
-<a class="jxr_linenumber" name="303" href="#303">303</a>         }
-<a class="jxr_linenumber" name="304" href="#304">304</a> 
-<a class="jxr_linenumber" name="305" href="#305">305</a>         <strong class="jxr_keyword">final</strong> LinkedList&lt;String&gt; subjectAltList = <strong class="jxr_keyword">new</strong> LinkedList&lt;String&gt;();
-<a class="jxr_linenumber" name="306" href="#306">306</a>         Collection&lt;List&lt;?&gt;&gt; c = <strong class="jxr_keyword">null</strong>;
-<a class="jxr_linenumber" name="307" href="#307">307</a>         <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="308" href="#308">308</a>             c = cert.getSubjectAlternativeNames();
-<a class="jxr_linenumber" name="309" href="#309">309</a>         }
-<a class="jxr_linenumber" name="310" href="#310">310</a>         <strong class="jxr_keyword">catch</strong>(<strong class="jxr_keyword">final</strong> CertificateParsingException cpe) {
-<a class="jxr_linenumber" name="311" href="#311">311</a>         }
-<a class="jxr_linenumber" name="312" href="#312">312</a>         <strong class="jxr_keyword">if</strong>(c != <strong class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="313" href="#313">313</a>             <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">final</strong> List&lt;?&gt; aC : c) {
-<a class="jxr_linenumber" name="314" href="#314">314</a>                 <strong class="jxr_keyword">final</strong> List&lt;?&gt; list = aC;
-<a class="jxr_linenumber" name="315" href="#315">315</a>                 <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> type = ((Integer) list.get(0)).intValue();
-<a class="jxr_linenumber" name="316" href="#316">316</a>                 <strong class="jxr_keyword">if</strong> (type == subjectType) {
-<a class="jxr_linenumber" name="317" href="#317">317</a>                     <strong class="jxr_keyword">final</strong> String s = (String) list.get(1);
-<a class="jxr_linenumber" name="318" href="#318">318</a>                     subjectAltList.add(s);
-<a class="jxr_linenumber" name="319" href="#319">319</a>                 }
-<a class="jxr_linenumber" name="320" href="#320">320</a>             }
-<a class="jxr_linenumber" name="321" href="#321">321</a>         }
-<a class="jxr_linenumber" name="322" href="#322">322</a>         <strong class="jxr_keyword">if</strong>(!subjectAltList.isEmpty()) {
-<a class="jxr_linenumber" name="323" href="#323">323</a>             <strong class="jxr_keyword">final</strong> String[] subjectAlts = <strong class="jxr_keyword">new</strong> String[subjectAltList.size()];
-<a class="jxr_linenumber" name="324" href="#324">324</a>             subjectAltList.toArray(subjectAlts);
-<a class="jxr_linenumber" name="325" href="#325">325</a>             <strong class="jxr_keyword">return</strong> subjectAlts;
-<a class="jxr_linenumber" name="326" href="#326">326</a>         } <strong class="jxr_keyword">else</strong> {
-<a class="jxr_linenumber" name="327" href="#327">327</a>             <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong>;
-<a class="jxr_linenumber" name="328" href="#328">328</a>         }
-<a class="jxr_linenumber" name="329" href="#329">329</a>     }
-<a class="jxr_linenumber" name="330" href="#330">330</a> 
-<a class="jxr_linenumber" name="331" href="#331">331</a>     <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="332" href="#332">332</a> <em class="jxr_javadoccomment">     * Extracts the array of SubjectAlt DNS names from an X509Certificate.</em>
-<a class="jxr_linenumber" name="333" href="#333">333</a> <em class="jxr_javadoccomment">     * Returns null if there aren't any.</em>
-<a class="jxr_linenumber" name="334" href="#334">334</a> <em class="jxr_javadoccomment">     * &lt;p/&gt;</em>
-<a class="jxr_linenumber" name="335" href="#335">335</a> <em class="jxr_javadoccomment">     * Note:  Java doesn't appear able to extract international characters</em>
-<a class="jxr_linenumber" name="336" href="#336">336</a> <em class="jxr_javadoccomment">     * from the SubjectAlts.  It can only extract international characters</em>
-<a class="jxr_linenumber" name="337" href="#337">337</a> <em class="jxr_javadoccomment">     * from the CN field.</em>
-<a class="jxr_linenumber" name="338" href="#338">338</a> <em class="jxr_javadoccomment">     * &lt;p/&gt;</em>
-<a class="jxr_linenumber" name="339" href="#339">339</a> <em class="jxr_javadoccomment">     * (Or maybe the version of OpenSSL I'm using to test isn't storing the</em>
-<a class="jxr_linenumber" name="340" href="#340">340</a> <em class="jxr_javadoccomment">     * international characters correctly in the SubjectAlts?).</em>
-<a class="jxr_linenumber" name="341" href="#341">341</a> <em class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="342" href="#342">342</a> <em class="jxr_javadoccomment">     * @param cert X509Certificate</em>
-<a class="jxr_linenumber" name="343" href="#343">343</a> <em class="jxr_javadoccomment">     * @return Array of SubjectALT DNS names stored in the certificate.</em>
-<a class="jxr_linenumber" name="344" href="#344">344</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="345" href="#345">345</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> String[] getDNSSubjectAlts(<strong class="jxr_keyword">final</strong> X509Certificate cert) {
-<a class="jxr_linenumber" name="346" href="#346">346</a>         <strong class="jxr_keyword">return</strong> getSubjectAlts(cert, <strong class="jxr_keyword">null</strong>);
-<a class="jxr_linenumber" name="347" href="#347">347</a>     }
-<a class="jxr_linenumber" name="348" href="#348">348</a> 
-<a class="jxr_linenumber" name="349" href="#349">349</a>     <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="350" href="#350">350</a> <em class="jxr_javadoccomment">     * Counts the number of dots "." in a string.</em>
-<a class="jxr_linenumber" name="351" href="#351">351</a> <em class="jxr_javadoccomment">     * @param s  string to count dots from</em>
-<a class="jxr_linenumber" name="352" href="#352">352</a> <em class="jxr_javadoccomment">     * @return  number of dots</em>
-<a class="jxr_linenumber" name="353" href="#353">353</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="354" href="#354">354</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">int</strong> countDots(<strong class="jxr_keyword">final</strong> String s) {
-<a class="jxr_linenumber" name="355" href="#355">355</a>         <strong class="jxr_keyword">int</strong> count = 0;
-<a class="jxr_linenumber" name="356" href="#356">356</a>         <strong class="jxr_keyword">for</strong>(<strong class="jxr_keyword">int</strong> i = 0; i &lt; s.length(); i++) {
-<a class="jxr_linenumber" name="357" href="#357">357</a>             <strong class="jxr_keyword">if</strong>(s.charAt(i) == '.') {
-<a class="jxr_linenumber" name="358" href="#358">358</a>                 count++;
-<a class="jxr_linenumber" name="359" href="#359">359</a>             }
-<a class="jxr_linenumber" name="360" href="#360">360</a>         }
-<a class="jxr_linenumber" name="361" href="#361">361</a>         <strong class="jxr_keyword">return</strong> count;
-<a class="jxr_linenumber" name="362" href="#362">362</a>     }
-<a class="jxr_linenumber" name="363" href="#363">363</a> 
-<a class="jxr_linenumber" name="364" href="#364">364</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">boolean</strong> isIPAddress(<strong class="jxr_keyword">final</strong> String hostname) {
-<a class="jxr_linenumber" name="365" href="#365">365</a>         <strong class="jxr_keyword">return</strong> hostname != <strong class="jxr_keyword">null</strong> &amp;&amp;
-<a class="jxr_linenumber" name="366" href="#366">366</a>             (InetAddressUtils.isIPv4Address(hostname) ||
-<a class="jxr_linenumber" name="367" href="#367">367</a>                     InetAddressUtils.isIPv6Address(hostname));
-<a class="jxr_linenumber" name="368" href="#368">368</a>     }
-<a class="jxr_linenumber" name="369" href="#369">369</a> 
-<a class="jxr_linenumber" name="370" href="#370">370</a>     <em class="jxr_comment">/*</em>
-<a class="jxr_linenumber" name="371" href="#371">371</a> <em class="jxr_comment">     * Check if hostname is IPv6, and if so, convert to standard format.</em>
-<a class="jxr_linenumber" name="372" href="#372">372</a> <em class="jxr_comment">     */</em>
-<a class="jxr_linenumber" name="373" href="#373">373</a>     <strong class="jxr_keyword">private</strong> String normaliseIPv6Address(<strong class="jxr_keyword">final</strong> String hostname) {
-<a class="jxr_linenumber" name="374" href="#374">374</a>         <strong class="jxr_keyword">if</strong> (hostname == <strong class="jxr_keyword">null</strong> || !InetAddressUtils.isIPv6Address(hostname)) {
-<a class="jxr_linenumber" name="375" href="#375">375</a>             <strong class="jxr_keyword">return</strong> hostname;
-<a class="jxr_linenumber" name="376" href="#376">376</a>         }
-<a class="jxr_linenumber" name="377" href="#377">377</a>         <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="378" href="#378">378</a>             <strong class="jxr_keyword">final</strong> InetAddress inetAddress = InetAddress.getByName(hostname);
-<a class="jxr_linenumber" name="379" href="#379">379</a>             <strong class="jxr_keyword">return</strong> inetAddress.getHostAddress();
-<a class="jxr_linenumber" name="380" href="#380">380</a>         } <strong class="jxr_keyword">catch</strong> (UnknownHostException uhe) { <em class="jxr_comment">// Should not happen, because we check for IPv6 address above</em>
-<a class="jxr_linenumber" name="381" href="#381">381</a>             log.error(<span class="jxr_string">"Unexpected error converting "</span>+hostname, uhe);
-<a class="jxr_linenumber" name="382" href="#382">382</a>             <strong class="jxr_keyword">return</strong> hostname;
-<a class="jxr_linenumber" name="383" href="#383">383</a>         }
-<a class="jxr_linenumber" name="384" href="#384">384</a>     }
-<a class="jxr_linenumber" name="385" href="#385">385</a> }
+<a class="jxr_linenumber" name="255" href="#255">255</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> String[] getCNs(<strong class="jxr_keyword">final</strong> X509Certificate cert) {
+<a class="jxr_linenumber" name="256" href="#256">256</a>         <strong class="jxr_keyword">final</strong> LinkedList&lt;String&gt; cnList = <strong class="jxr_keyword">new</strong> LinkedList&lt;String&gt;();
+<a class="jxr_linenumber" name="257" href="#257">257</a>         <em class="jxr_comment">/*</em>
+<a class="jxr_linenumber" name="258" href="#258">258</a> <em class="jxr_comment">          Sebastian Hauer's original StrictSSLProtocolSocketFactory used</em>
+<a class="jxr_linenumber" name="259" href="#259">259</a> <em class="jxr_comment">          getName() and had the following comment:</em>
+<a class="jxr_linenumber" name="260" href="#260">260</a> 
+<a class="jxr_linenumber" name="261" href="#261">261</a> <em class="jxr_comment">                Parses a X.500 distinguished name for the value of the</em>
+<a class="jxr_linenumber" name="262" href="#262">262</a> <em class="jxr_comment">                "Common Name" field.  This is done a bit sloppy right</em>
+<a class="jxr_linenumber" name="263" href="#263">263</a> <em class="jxr_comment">                 now and should probably be done a bit more according to</em>
+<a class="jxr_linenumber" name="264" href="#264">264</a> <em class="jxr_comment">                &lt;code&gt;RFC 2253&lt;/code&gt;.</em>
+<a class="jxr_linenumber" name="265" href="#265">265</a> 
+<a class="jxr_linenumber" name="266" href="#266">266</a> <em class="jxr_comment">           I've noticed that toString() seems to do a better job than</em>
+<a class="jxr_linenumber" name="267" href="#267">267</a> <em class="jxr_comment">           getName() on these X500Principal objects, so I'm hoping that</em>
+<a class="jxr_linenumber" name="268" href="#268">268</a> <em class="jxr_comment">           addresses Sebastian's concern.</em>
+<a class="jxr_linenumber" name="269" href="#269">269</a> 
+<a class="jxr_linenumber" name="270" href="#270">270</a> <em class="jxr_comment">           For example, getName() gives me this:</em>
+<a class="jxr_linenumber" name="271" href="#271">271</a> <em class="jxr_comment">           1.2.840.113549.1.9.1=#16166a756c6975736461766965734063756362632e636f6d</em>
+<a class="jxr_linenumber" name="272" href="#272">272</a> 
+<a class="jxr_linenumber" name="273" href="#273">273</a> <em class="jxr_comment">           whereas toString() gives me this:</em>
+<a class="jxr_linenumber" name="274" href="#274">274</a> <em class="jxr_comment">           EMAILADDRESS=juliusdavies@cucbc.com</em>
+<a class="jxr_linenumber" name="275" href="#275">275</a> 
+<a class="jxr_linenumber" name="276" href="#276">276</a> <em class="jxr_comment">           Looks like toString() even works with non-ascii domain names!</em>
+<a class="jxr_linenumber" name="277" href="#277">277</a> <em class="jxr_comment">           I tested it with "&amp;#x82b1;&amp;#x5b50;.co.jp" and it worked fine.</em>
+<a class="jxr_linenumber" name="278" href="#278">278</a> <em class="jxr_comment">        */</em>
+<a class="jxr_linenumber" name="279" href="#279">279</a> 
+<a class="jxr_linenumber" name="280" href="#280">280</a>         <strong class="jxr_keyword">final</strong> String subjectPrincipal = cert.getSubjectX500Principal().toString();
+<a class="jxr_linenumber" name="281" href="#281">281</a>         <strong class="jxr_keyword">final</strong> StringTokenizer st = <strong class="jxr_keyword">new</strong> StringTokenizer(subjectPrincipal, <span class="jxr_string">",+"</span>);
+<a class="jxr_linenumber" name="282" href="#282">282</a>         <strong class="jxr_keyword">while</strong>(st.hasMoreTokens()) {
+<a class="jxr_linenumber" name="283" href="#283">283</a>             <strong class="jxr_keyword">final</strong> String tok = st.nextToken().trim();
+<a class="jxr_linenumber" name="284" href="#284">284</a>             <strong class="jxr_keyword">if</strong> (tok.length() &gt; 3) {
+<a class="jxr_linenumber" name="285" href="#285">285</a>                 <strong class="jxr_keyword">if</strong> (tok.substring(0, 3).equalsIgnoreCase(<span class="jxr_string">"CN="</span>)) {
+<a class="jxr_linenumber" name="286" href="#286">286</a>                     cnList.add(tok.substring(3));
+<a class="jxr_linenumber" name="287" href="#287">287</a>                 }
+<a class="jxr_linenumber" name="288" href="#288">288</a>             }
+<a class="jxr_linenumber" name="289" href="#289">289</a>         }
+<a class="jxr_linenumber" name="290" href="#290">290</a>         <strong class="jxr_keyword">if</strong>(!cnList.isEmpty()) {
+<a class="jxr_linenumber" name="291" href="#291">291</a>             <strong class="jxr_keyword">final</strong> String[] cns = <strong class="jxr_keyword">new</strong> String[cnList.size()];
+<a class="jxr_linenumber" name="292" href="#292">292</a>             cnList.toArray(cns);
+<a class="jxr_linenumber" name="293" href="#293">293</a>             <strong class="jxr_keyword">return</strong> cns;
+<a class="jxr_linenumber" name="294" href="#294">294</a>         } <strong class="jxr_keyword">else</strong> {
+<a class="jxr_linenumber" name="295" href="#295">295</a>             <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong>;
+<a class="jxr_linenumber" name="296" href="#296">296</a>         }
+<a class="jxr_linenumber" name="297" href="#297">297</a>     }
+<a class="jxr_linenumber" name="298" href="#298">298</a> 
+<a class="jxr_linenumber" name="299" href="#299">299</a>     <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="300" href="#300">300</a> <em class="jxr_javadoccomment">     * Extracts the array of SubjectAlt DNS or IP names from an X509Certificate.</em>
+<a class="jxr_linenumber" name="301" href="#301">301</a> <em class="jxr_javadoccomment">     * Returns null if there aren't any.</em>
+<a class="jxr_linenumber" name="302" href="#302">302</a> <em class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="303" href="#303">303</a> <em class="jxr_javadoccomment">     * @param cert X509Certificate</em>
+<a class="jxr_linenumber" name="304" href="#304">304</a> <em class="jxr_javadoccomment">     * @param hostname</em>
+<a class="jxr_linenumber" name="305" href="#305">305</a> <em class="jxr_javadoccomment">     * @return Array of SubjectALT DNS or IP names stored in the certificate.</em>
+<a class="jxr_linenumber" name="306" href="#306">306</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="307" href="#307">307</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> String[] getSubjectAlts(
+<a class="jxr_linenumber" name="308" href="#308">308</a>             <strong class="jxr_keyword">final</strong> X509Certificate cert, <strong class="jxr_keyword">final</strong> String hostname) {
+<a class="jxr_linenumber" name="309" href="#309">309</a>         <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> subjectType;
+<a class="jxr_linenumber" name="310" href="#310">310</a>         <strong class="jxr_keyword">if</strong> (isIPAddress(hostname)) {
+<a class="jxr_linenumber" name="311" href="#311">311</a>             subjectType = 7;
+<a class="jxr_linenumber" name="312" href="#312">312</a>         } <strong class="jxr_keyword">else</strong> {
+<a class="jxr_linenumber" name="313" href="#313">313</a>             subjectType = 2;
+<a class="jxr_linenumber" name="314" href="#314">314</a>         }
+<a class="jxr_linenumber" name="315" href="#315">315</a> 
+<a class="jxr_linenumber" name="316" href="#316">316</a>         <strong class="jxr_keyword">final</strong> LinkedList&lt;String&gt; subjectAltList = <strong class="jxr_keyword">new</strong> LinkedList&lt;String&gt;();
+<a class="jxr_linenumber" name="317" href="#317">317</a>         Collection&lt;List&lt;?&gt;&gt; c = <strong class="jxr_keyword">null</strong>;
+<a class="jxr_linenumber" name="318" href="#318">318</a>         <strong class="jxr_keyword">try</strong> {
+<a class="jxr_linenumber" name="319" href="#319">319</a>             c = cert.getSubjectAlternativeNames();
+<a class="jxr_linenumber" name="320" href="#320">320</a>         }
+<a class="jxr_linenumber" name="321" href="#321">321</a>         <strong class="jxr_keyword">catch</strong>(<strong class="jxr_keyword">final</strong> CertificateParsingException cpe) {
+<a class="jxr_linenumber" name="322" href="#322">322</a>         }
+<a class="jxr_linenumber" name="323" href="#323">323</a>         <strong class="jxr_keyword">if</strong>(c != <strong class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="324" href="#324">324</a>             <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">final</strong> List&lt;?&gt; aC : c) {
+<a class="jxr_linenumber" name="325" href="#325">325</a>                 <strong class="jxr_keyword">final</strong> List&lt;?&gt; list = aC;
+<a class="jxr_linenumber" name="326" href="#326">326</a>                 <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> type = ((Integer) list.get(0)).intValue();
+<a class="jxr_linenumber" name="327" href="#327">327</a>                 <strong class="jxr_keyword">if</strong> (type == subjectType) {
+<a class="jxr_linenumber" name="328" href="#328">328</a>                     <strong class="jxr_keyword">final</strong> String s = (String) list.get(1);
+<a class="jxr_linenumber" name="329" href="#329">329</a>                     subjectAltList.add(s);
+<a class="jxr_linenumber" name="330" href="#330">330</a>                 }
+<a class="jxr_linenumber" name="331" href="#331">331</a>             }
+<a class="jxr_linenumber" name="332" href="#332">332</a>         }
+<a class="jxr_linenumber" name="333" href="#333">333</a>         <strong class="jxr_keyword">if</strong>(!subjectAltList.isEmpty()) {
+<a class="jxr_linenumber" name="334" href="#334">334</a>             <strong class="jxr_keyword">final</strong> String[] subjectAlts = <strong class="jxr_keyword">new</strong> String[subjectAltList.size()];
+<a class="jxr_linenumber" name="335" href="#335">335</a>             subjectAltList.toArray(subjectAlts);
+<a class="jxr_linenumber" name="336" href="#336">336</a>             <strong class="jxr_keyword">return</strong> subjectAlts;
+<a class="jxr_linenumber" name="337" href="#337">337</a>         } <strong class="jxr_keyword">else</strong> {
+<a class="jxr_linenumber" name="338" href="#338">338</a>             <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong>;
+<a class="jxr_linenumber" name="339" href="#339">339</a>         }
+<a class="jxr_linenumber" name="340" href="#340">340</a>     }
+<a class="jxr_linenumber" name="341" href="#341">341</a> 
+<a class="jxr_linenumber" name="342" href="#342">342</a>     <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="343" href="#343">343</a> <em class="jxr_javadoccomment">     * Extracts the array of SubjectAlt DNS names from an X509Certificate.</em>
+<a class="jxr_linenumber" name="344" href="#344">344</a> <em class="jxr_javadoccomment">     * Returns null if there aren't any.</em>
+<a class="jxr_linenumber" name="345" href="#345">345</a> <em class="jxr_javadoccomment">     * &lt;p/&gt;</em>
+<a class="jxr_linenumber" name="346" href="#346">346</a> <em class="jxr_javadoccomment">     * Note:  Java doesn't appear able to extract international characters</em>
+<a class="jxr_linenumber" name="347" href="#347">347</a> <em class="jxr_javadoccomment">     * from the SubjectAlts.  It can only extract international characters</em>
+<a class="jxr_linenumber" name="348" href="#348">348</a> <em class="jxr_javadoccomment">     * from the CN field.</em>
+<a class="jxr_linenumber" name="349" href="#349">349</a> <em class="jxr_javadoccomment">     * &lt;p/&gt;</em>
+<a class="jxr_linenumber" name="350" href="#350">350</a> <em class="jxr_javadoccomment">     * (Or maybe the version of OpenSSL I'm using to test isn't storing the</em>
+<a class="jxr_linenumber" name="351" href="#351">351</a> <em class="jxr_javadoccomment">     * international characters correctly in the SubjectAlts?).</em>
+<a class="jxr_linenumber" name="352" href="#352">352</a> <em class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="353" href="#353">353</a> <em class="jxr_javadoccomment">     * @param cert X509Certificate</em>
+<a class="jxr_linenumber" name="354" href="#354">354</a> <em class="jxr_javadoccomment">     * @return Array of SubjectALT DNS names stored in the certificate.</em>
+<a class="jxr_linenumber" name="355" href="#355">355</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="356" href="#356">356</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> String[] getDNSSubjectAlts(<strong class="jxr_keyword">final</strong> X509Certificate cert) {
+<a class="jxr_linenumber" name="357" href="#357">357</a>         <strong class="jxr_keyword">return</strong> getSubjectAlts(cert, <strong class="jxr_keyword">null</strong>);
+<a class="jxr_linenumber" name="358" href="#358">358</a>     }
+<a class="jxr_linenumber" name="359" href="#359">359</a> 
+<a class="jxr_linenumber" name="360" href="#360">360</a>     <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="361" href="#361">361</a> <em class="jxr_javadoccomment">     * Counts the number of dots "." in a string.</em>
+<a class="jxr_linenumber" name="362" href="#362">362</a> <em class="jxr_javadoccomment">     * @param s  string to count dots from</em>
+<a class="jxr_linenumber" name="363" href="#363">363</a> <em class="jxr_javadoccomment">     * @return  number of dots</em>
+<a class="jxr_linenumber" name="364" href="#364">364</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="365" href="#365">365</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">int</strong> countDots(<strong class="jxr_keyword">final</strong> String s) {
+<a class="jxr_linenumber" name="366" href="#366">366</a>         <strong class="jxr_keyword">int</strong> count = 0;
+<a class="jxr_linenumber" name="367" href="#367">367</a>         <strong class="jxr_keyword">for</strong>(<strong class="jxr_keyword">int</strong> i = 0; i &lt; s.length(); i++) {
+<a class="jxr_linenumber" name="368" href="#368">368</a>             <strong class="jxr_keyword">if</strong>(s.charAt(i) == '.') {
+<a class="jxr_linenumber" name="369" href="#369">369</a>                 count++;
+<a class="jxr_linenumber" name="370" href="#370">370</a>             }
+<a class="jxr_linenumber" name="371" href="#371">371</a>         }
+<a class="jxr_linenumber" name="372" href="#372">372</a>         <strong class="jxr_keyword">return</strong> count;
+<a class="jxr_linenumber" name="373" href="#373">373</a>     }
+<a class="jxr_linenumber" name="374" href="#374">374</a> 
+<a class="jxr_linenumber" name="375" href="#375">375</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">boolean</strong> isIPAddress(<strong class="jxr_keyword">final</strong> String hostname) {
+<a class="jxr_linenumber" name="376" href="#376">376</a>         <strong class="jxr_keyword">return</strong> hostname != <strong class="jxr_keyword">null</strong> &amp;&amp;
+<a class="jxr_linenumber" name="377" href="#377">377</a>             (InetAddressUtils.isIPv4Address(hostname) ||
+<a class="jxr_linenumber" name="378" href="#378">378</a>                     InetAddressUtils.isIPv6Address(hostname));
+<a class="jxr_linenumber" name="379" href="#379">379</a>     }
+<a class="jxr_linenumber" name="380" href="#380">380</a> 
+<a class="jxr_linenumber" name="381" href="#381">381</a>     <em class="jxr_comment">/*</em>
+<a class="jxr_linenumber" name="382" href="#382">382</a> <em class="jxr_comment">     * Check if hostname is IPv6, and if so, convert to standard format.</em>
+<a class="jxr_linenumber" name="383" href="#383">383</a> <em class="jxr_comment">     */</em>
+<a class="jxr_linenumber" name="384" href="#384">384</a>     <strong class="jxr_keyword">private</strong> String normaliseIPv6Address(<strong class="jxr_keyword">final</strong> String hostname) {
+<a class="jxr_linenumber" name="385" href="#385">385</a>         <strong class="jxr_keyword">if</strong> (hostname == <strong class="jxr_keyword">null</strong> || !InetAddressUtils.isIPv6Address(hostname)) {
+<a class="jxr_linenumber" name="386" href="#386">386</a>             <strong class="jxr_keyword">return</strong> hostname;
+<a class="jxr_linenumber" name="387" href="#387">387</a>         }
+<a class="jxr_linenumber" name="388" href="#388">388</a>         <strong class="jxr_keyword">try</strong> {
+<a class="jxr_linenumber" name="389" href="#389">389</a>             <strong class="jxr_keyword">final</strong> InetAddress inetAddress = InetAddress.getByName(hostname);
+<a class="jxr_linenumber" name="390" href="#390">390</a>             <strong class="jxr_keyword">return</strong> inetAddress.getHostAddress();
+<a class="jxr_linenumber" name="391" href="#391">391</a>         } <strong class="jxr_keyword">catch</strong> (UnknownHostException uhe) { <em class="jxr_comment">// Should not happen, because we check for IPv6 address above</em>
+<a class="jxr_linenumber" name="392" href="#392">392</a>             log.error(<span class="jxr_string">"Unexpected error converting "</span>+hostname, uhe);
+<a class="jxr_linenumber" name="393" href="#393">393</a>             <strong class="jxr_keyword">return</strong> hostname;
+<a class="jxr_linenumber" name="394" href="#394">394</a>         }
+<a class="jxr_linenumber" name="395" href="#395">395</a>     }
+<a class="jxr_linenumber" name="396" href="#396">396</a> }
 </pre>
 <hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
 </html>

Modified: httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/ssl/BrowserCompatHostnameVerifier.html
URL: http://svn.apache.org/viewvc/httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/ssl/BrowserCompatHostnameVerifier.html?rev=1530010&r1=1530009&r2=1530010&view=diff
==============================================================================
--- httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/ssl/BrowserCompatHostnameVerifier.html (original)
+++ httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/ssl/BrowserCompatHostnameVerifier.html Mon Oct  7 17:52:27 2013
@@ -65,11 +65,16 @@
 <a class="jxr_linenumber" name="55" href="#55">55</a>      }
 <a class="jxr_linenumber" name="56" href="#56">56</a>  
 <a class="jxr_linenumber" name="57" href="#57">57</a>      @Override
-<a class="jxr_linenumber" name="58" href="#58">58</a>      <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">final</strong> String toString() {
-<a class="jxr_linenumber" name="59" href="#59">59</a>          <strong class="jxr_keyword">return</strong> <span class="jxr_string">"BROWSER_COMPATIBLE"</span>;
+<a class="jxr_linenumber" name="58" href="#58">58</a>      <strong class="jxr_keyword">boolean</strong> validCountryWildcard(<strong class="jxr_keyword">final</strong> String cn) {
+<a class="jxr_linenumber" name="59" href="#59">59</a>          <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">true</strong>;
 <a class="jxr_linenumber" name="60" href="#60">60</a>      }
 <a class="jxr_linenumber" name="61" href="#61">61</a>  
-<a class="jxr_linenumber" name="62" href="#62">62</a>  }
+<a class="jxr_linenumber" name="62" href="#62">62</a>      @Override
+<a class="jxr_linenumber" name="63" href="#63">63</a>      <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">final</strong> String toString() {
+<a class="jxr_linenumber" name="64" href="#64">64</a>          <strong class="jxr_keyword">return</strong> <span class="jxr_string">"BROWSER_COMPATIBLE"</span>;
+<a class="jxr_linenumber" name="65" href="#65">65</a>      }
+<a class="jxr_linenumber" name="66" href="#66">66</a>  
+<a class="jxr_linenumber" name="67" href="#67">67</a>  }
 </pre>
 <hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
 </html>

Modified: httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/ssl/SSLConnectionSocketFactory.html
URL: http://svn.apache.org/viewvc/httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/ssl/SSLConnectionSocketFactory.html?rev=1530010&r1=1530009&r2=1530010&view=diff
==============================================================================
--- httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/ssl/SSLConnectionSocketFactory.html (original)
+++ httpcomponents/site/httpcomponents-client-4.3.x/httpclient/xref/org/apache/http/conn/ssl/SSLConnectionSocketFactory.html Mon Oct  7 17:52:27 2013
@@ -211,102 +211,103 @@
 <a class="jxr_linenumber" name="201" href="#201">201</a>             <strong class="jxr_keyword">final</strong> String[] supportedProtocols,
 <a class="jxr_linenumber" name="202" href="#202">202</a>             <strong class="jxr_keyword">final</strong> String[] supportedCipherSuites,
 <a class="jxr_linenumber" name="203" href="#203">203</a>             <strong class="jxr_keyword">final</strong> <a href="../../../../../org/apache/http/conn/ssl/X509HostnameVerifier.html">X509HostnameVerifier</a> hostnameVerifier) {
-<a class="jxr_linenumber" name="204" href="#204">204</a>         Args.notNull(socketfactory, <span class="jxr_string">"SSL socket factory"</span>);
-<a class="jxr_linenumber" name="205" href="#205">205</a>         <strong class="jxr_keyword">this</strong>.socketfactory = socketfactory;
-<a class="jxr_linenumber" name="206" href="#206">206</a>         <strong class="jxr_keyword">this</strong>.supportedProtocols = supportedProtocols;
-<a class="jxr_linenumber" name="207" href="#207">207</a>         <strong class="jxr_keyword">this</strong>.supportedCipherSuites = supportedCipherSuites;
-<a class="jxr_linenumber" name="208" href="#208">208</a>         <strong class="jxr_keyword">this</strong>.hostnameVerifier = hostnameVerifier;
-<a class="jxr_linenumber" name="209" href="#209">209</a>     }
-<a class="jxr_linenumber" name="210" href="#210">210</a> 
-<a class="jxr_linenumber" name="211" href="#211">211</a>     <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="212" href="#212">212</a> <em class="jxr_javadoccomment">     * Performs any custom initialization for a newly created SSLSocket</em>
-<a class="jxr_linenumber" name="213" href="#213">213</a> <em class="jxr_javadoccomment">     * (before the SSL handshake happens).</em>
-<a class="jxr_linenumber" name="214" href="#214">214</a> <em class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="215" href="#215">215</a> <em class="jxr_javadoccomment">     * The default implementation is a no-op, but could be overriden to, e.g.,</em>
-<a class="jxr_linenumber" name="216" href="#216">216</a> <em class="jxr_javadoccomment">     * call {@link javax.net.ssl.SSLSocket#setEnabledCipherSuites(String[])}.</em>
-<a class="jxr_linenumber" name="217" href="#217">217</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="218" href="#218">218</a>     <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> prepareSocket(<strong class="jxr_keyword">final</strong> SSLSocket socket) <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="219" href="#219">219</a>     }
-<a class="jxr_linenumber" name="220" href="#220">220</a> 
-<a class="jxr_linenumber" name="221" href="#221">221</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">void</strong> internalPrepareSocket(<strong class="jxr_keyword">final</strong> SSLSocket socket) <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="222" href="#222">222</a>         <strong class="jxr_keyword">if</strong> (supportedProtocols != <strong class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="223" href="#223">223</a>             socket.setEnabledProtocols(supportedProtocols);
-<a class="jxr_linenumber" name="224" href="#224">224</a>         }
-<a class="jxr_linenumber" name="225" href="#225">225</a>         <strong class="jxr_keyword">if</strong> (supportedCipherSuites != <strong class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="226" href="#226">226</a>             socket.setEnabledCipherSuites(supportedCipherSuites);
-<a class="jxr_linenumber" name="227" href="#227">227</a>         }
-<a class="jxr_linenumber" name="228" href="#228">228</a>         prepareSocket(socket);
-<a class="jxr_linenumber" name="229" href="#229">229</a>     }
-<a class="jxr_linenumber" name="230" href="#230">230</a> 
-<a class="jxr_linenumber" name="231" href="#231">231</a>     <strong class="jxr_keyword">public</strong> Socket createSocket(<strong class="jxr_keyword">final</strong> HttpContext context) <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="232" href="#232">232</a>         <strong class="jxr_keyword">final</strong> SSLSocket sock = (SSLSocket) <strong class="jxr_keyword">this</strong>.socketfactory.createSocket();
-<a class="jxr_linenumber" name="233" href="#233">233</a>         internalPrepareSocket(sock);
-<a class="jxr_linenumber" name="234" href="#234">234</a>         <strong class="jxr_keyword">return</strong> sock;
-<a class="jxr_linenumber" name="235" href="#235">235</a>     }
-<a class="jxr_linenumber" name="236" href="#236">236</a> 
-<a class="jxr_linenumber" name="237" href="#237">237</a>     <strong class="jxr_keyword">public</strong> Socket connectSocket(
-<a class="jxr_linenumber" name="238" href="#238">238</a>             <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> connectTimeout,
-<a class="jxr_linenumber" name="239" href="#239">239</a>             <strong class="jxr_keyword">final</strong> Socket socket,
-<a class="jxr_linenumber" name="240" href="#240">240</a>             <strong class="jxr_keyword">final</strong> HttpHost host,
-<a class="jxr_linenumber" name="241" href="#241">241</a>             <strong class="jxr_keyword">final</strong> InetSocketAddress remoteAddress,
-<a class="jxr_linenumber" name="242" href="#242">242</a>             <strong class="jxr_keyword">final</strong> InetSocketAddress localAddress,
-<a class="jxr_linenumber" name="243" href="#243">243</a>             <strong class="jxr_keyword">final</strong> HttpContext context) <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="244" href="#244">244</a>         Args.notNull(host, <span class="jxr_string">"HTTP host"</span>);
-<a class="jxr_linenumber" name="245" href="#245">245</a>         Args.notNull(remoteAddress, <span class="jxr_string">"Remote address"</span>);
-<a class="jxr_linenumber" name="246" href="#246">246</a>         <strong class="jxr_keyword">final</strong> Socket sock = socket != <strong class="jxr_keyword">null</strong> ? socket : createSocket(context);
-<a class="jxr_linenumber" name="247" href="#247">247</a>         <strong class="jxr_keyword">if</strong> (localAddress != <strong class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="248" href="#248">248</a>             sock.bind(localAddress);
-<a class="jxr_linenumber" name="249" href="#249">249</a>         }
-<a class="jxr_linenumber" name="250" href="#250">250</a>         <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="251" href="#251">251</a>             sock.connect(remoteAddress, connectTimeout);
-<a class="jxr_linenumber" name="252" href="#252">252</a>         } <strong class="jxr_keyword">catch</strong> (<strong class="jxr_keyword">final</strong> IOException ex) {
-<a class="jxr_linenumber" name="253" href="#253">253</a>             <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="254" href="#254">254</a>                 sock.close();
-<a class="jxr_linenumber" name="255" href="#255">255</a>             } <strong class="jxr_keyword">catch</strong> (<strong class="jxr_keyword">final</strong> IOException ignore) {
-<a class="jxr_linenumber" name="256" href="#256">256</a>             }
-<a class="jxr_linenumber" name="257" href="#257">257</a>             <strong class="jxr_keyword">throw</strong> ex;
-<a class="jxr_linenumber" name="258" href="#258">258</a>         }
-<a class="jxr_linenumber" name="259" href="#259">259</a>         <em class="jxr_comment">// Setup SSL layering if necessary</em>
-<a class="jxr_linenumber" name="260" href="#260">260</a>         <strong class="jxr_keyword">if</strong> (sock instanceof SSLSocket) {
-<a class="jxr_linenumber" name="261" href="#261">261</a>             <strong class="jxr_keyword">final</strong> SSLSocket sslsock = (SSLSocket) sock;
-<a class="jxr_linenumber" name="262" href="#262">262</a>             sslsock.startHandshake();
-<a class="jxr_linenumber" name="263" href="#263">263</a>             verifyHostname(sslsock, host.getHostName());
-<a class="jxr_linenumber" name="264" href="#264">264</a>             <strong class="jxr_keyword">return</strong> sock;
-<a class="jxr_linenumber" name="265" href="#265">265</a>         } <strong class="jxr_keyword">else</strong> {
-<a class="jxr_linenumber" name="266" href="#266">266</a>             <strong class="jxr_keyword">return</strong> createLayeredSocket(sock, host.getHostName(), remoteAddress.getPort(), context);
-<a class="jxr_linenumber" name="267" href="#267">267</a>         }
-<a class="jxr_linenumber" name="268" href="#268">268</a>     }
-<a class="jxr_linenumber" name="269" href="#269">269</a> 
-<a class="jxr_linenumber" name="270" href="#270">270</a>     <strong class="jxr_keyword">public</strong> Socket createLayeredSocket(
-<a class="jxr_linenumber" name="271" href="#271">271</a>             <strong class="jxr_keyword">final</strong> Socket socket,
-<a class="jxr_linenumber" name="272" href="#272">272</a>             <strong class="jxr_keyword">final</strong> String target,
-<a class="jxr_linenumber" name="273" href="#273">273</a>             <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> port,
-<a class="jxr_linenumber" name="274" href="#274">274</a>             <strong class="jxr_keyword">final</strong> HttpContext context) <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="275" href="#275">275</a>         <strong class="jxr_keyword">final</strong> SSLSocket sslsock = (SSLSocket) <strong class="jxr_keyword">this</strong>.socketfactory.createSocket(
-<a class="jxr_linenumber" name="276" href="#276">276</a>                 socket,
-<a class="jxr_linenumber" name="277" href="#277">277</a>                 target,
-<a class="jxr_linenumber" name="278" href="#278">278</a>                 port,
-<a class="jxr_linenumber" name="279" href="#279">279</a>                 <strong class="jxr_keyword">true</strong>);
-<a class="jxr_linenumber" name="280" href="#280">280</a>         internalPrepareSocket(sslsock);
-<a class="jxr_linenumber" name="281" href="#281">281</a>         sslsock.startHandshake();
-<a class="jxr_linenumber" name="282" href="#282">282</a>         verifyHostname(sslsock, target);
-<a class="jxr_linenumber" name="283" href="#283">283</a>         <strong class="jxr_keyword">return</strong> sslsock;
-<a class="jxr_linenumber" name="284" href="#284">284</a>     }
-<a class="jxr_linenumber" name="285" href="#285">285</a> 
-<a class="jxr_linenumber" name="286" href="#286">286</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">void</strong> verifyHostname(<strong class="jxr_keyword">final</strong> SSLSocket sslsock, <strong class="jxr_keyword">final</strong> String hostname) <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="287" href="#287">287</a>         <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.hostnameVerifier != <strong class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="288" href="#288">288</a>             <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="289" href="#289">289</a>                 <strong class="jxr_keyword">this</strong>.hostnameVerifier.verify(hostname, sslsock);
-<a class="jxr_linenumber" name="290" href="#290">290</a>                 <em class="jxr_comment">// verifyHostName() didn't blowup - good!</em>
-<a class="jxr_linenumber" name="291" href="#291">291</a>             } <strong class="jxr_keyword">catch</strong> (<strong class="jxr_keyword">final</strong> IOException iox) {
-<a class="jxr_linenumber" name="292" href="#292">292</a>                 <em class="jxr_comment">// close the socket before re-throwing the exception</em>
-<a class="jxr_linenumber" name="293" href="#293">293</a>                 <strong class="jxr_keyword">try</strong> { sslsock.close(); } <strong class="jxr_keyword">catch</strong> (<strong class="jxr_keyword">final</strong> Exception x) { <em class="jxr_comment">/*<em class="jxr_comment">ignore*/</em> }</em>
-<a class="jxr_linenumber" name="294" href="#294">294</a>                 <strong class="jxr_keyword">throw</strong> iox;
-<a class="jxr_linenumber" name="295" href="#295">295</a>             }
-<a class="jxr_linenumber" name="296" href="#296">296</a>         }
-<a class="jxr_linenumber" name="297" href="#297">297</a>     }
-<a class="jxr_linenumber" name="298" href="#298">298</a> 
-<a class="jxr_linenumber" name="299" href="#299">299</a> }
+<a class="jxr_linenumber" name="204" href="#204">204</a>         <strong class="jxr_keyword">this</strong>.socketfactory = Args.notNull(socketfactory, <span class="jxr_string">"SSL socket factory"</span>);
+<a class="jxr_linenumber" name="205" href="#205">205</a>         <strong class="jxr_keyword">this</strong>.supportedProtocols = supportedProtocols;
+<a class="jxr_linenumber" name="206" href="#206">206</a>         <strong class="jxr_keyword">this</strong>.supportedCipherSuites = supportedCipherSuites;
+<a class="jxr_linenumber" name="207" href="#207">207</a>         <strong class="jxr_keyword">this</strong>.hostnameVerifier = hostnameVerifier != <strong class="jxr_keyword">null</strong> ? hostnameVerifier : BROWSER_COMPATIBLE_HOSTNAME_VERIFIER;
+<a class="jxr_linenumber" name="208" href="#208">208</a>     }
+<a class="jxr_linenumber" name="209" href="#209">209</a> 
+<a class="jxr_linenumber" name="210" href="#210">210</a>     <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="211" href="#211">211</a> <em class="jxr_javadoccomment">     * Performs any custom initialization for a newly created SSLSocket</em>
+<a class="jxr_linenumber" name="212" href="#212">212</a> <em class="jxr_javadoccomment">     * (before the SSL handshake happens).</em>
+<a class="jxr_linenumber" name="213" href="#213">213</a> <em class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="214" href="#214">214</a> <em class="jxr_javadoccomment">     * The default implementation is a no-op, but could be overriden to, e.g.,</em>
+<a class="jxr_linenumber" name="215" href="#215">215</a> <em class="jxr_javadoccomment">     * call {@link javax.net.ssl.SSLSocket#setEnabledCipherSuites(String[])}.</em>
+<a class="jxr_linenumber" name="216" href="#216">216</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="217" href="#217">217</a>     <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> prepareSocket(<strong class="jxr_keyword">final</strong> SSLSocket socket) <strong class="jxr_keyword">throws</strong> IOException {
+<a class="jxr_linenumber" name="218" href="#218">218</a>     }
+<a class="jxr_linenumber" name="219" href="#219">219</a> 
+<a class="jxr_linenumber" name="220" href="#220">220</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">void</strong> internalPrepareSocket(<strong class="jxr_keyword">final</strong> SSLSocket socket) <strong class="jxr_keyword">throws</strong> IOException {
+<a class="jxr_linenumber" name="221" href="#221">221</a>         <strong class="jxr_keyword">if</strong> (supportedProtocols != <strong class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="222" href="#222">222</a>             socket.setEnabledProtocols(supportedProtocols);
+<a class="jxr_linenumber" name="223" href="#223">223</a>         }
+<a class="jxr_linenumber" name="224" href="#224">224</a>         <strong class="jxr_keyword">if</strong> (supportedCipherSuites != <strong class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="225" href="#225">225</a>             socket.setEnabledCipherSuites(supportedCipherSuites);
+<a class="jxr_linenumber" name="226" href="#226">226</a>         }
+<a class="jxr_linenumber" name="227" href="#227">227</a>         prepareSocket(socket);
+<a class="jxr_linenumber" name="228" href="#228">228</a>     }
+<a class="jxr_linenumber" name="229" href="#229">229</a> 
+<a class="jxr_linenumber" name="230" href="#230">230</a>     <strong class="jxr_keyword">public</strong> Socket createSocket(<strong class="jxr_keyword">final</strong> HttpContext context) <strong class="jxr_keyword">throws</strong> IOException {
+<a class="jxr_linenumber" name="231" href="#231">231</a>         <strong class="jxr_keyword">final</strong> SSLSocket sock = (SSLSocket) <strong class="jxr_keyword">this</strong>.socketfactory.createSocket();
+<a class="jxr_linenumber" name="232" href="#232">232</a>         internalPrepareSocket(sock);
+<a class="jxr_linenumber" name="233" href="#233">233</a>         <strong class="jxr_keyword">return</strong> sock;
+<a class="jxr_linenumber" name="234" href="#234">234</a>     }
+<a class="jxr_linenumber" name="235" href="#235">235</a> 
+<a class="jxr_linenumber" name="236" href="#236">236</a>     <strong class="jxr_keyword">public</strong> Socket connectSocket(
+<a class="jxr_linenumber" name="237" href="#237">237</a>             <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> connectTimeout,
+<a class="jxr_linenumber" name="238" href="#238">238</a>             <strong class="jxr_keyword">final</strong> Socket socket,
+<a class="jxr_linenumber" name="239" href="#239">239</a>             <strong class="jxr_keyword">final</strong> HttpHost host,
+<a class="jxr_linenumber" name="240" href="#240">240</a>             <strong class="jxr_keyword">final</strong> InetSocketAddress remoteAddress,
+<a class="jxr_linenumber" name="241" href="#241">241</a>             <strong class="jxr_keyword">final</strong> InetSocketAddress localAddress,
+<a class="jxr_linenumber" name="242" href="#242">242</a>             <strong class="jxr_keyword">final</strong> HttpContext context) <strong class="jxr_keyword">throws</strong> IOException {
+<a class="jxr_linenumber" name="243" href="#243">243</a>         Args.notNull(host, <span class="jxr_string">"HTTP host"</span>);
+<a class="jxr_linenumber" name="244" href="#244">244</a>         Args.notNull(remoteAddress, <span class="jxr_string">"Remote address"</span>);
+<a class="jxr_linenumber" name="245" href="#245">245</a>         <strong class="jxr_keyword">final</strong> Socket sock = socket != <strong class="jxr_keyword">null</strong> ? socket : createSocket(context);
+<a class="jxr_linenumber" name="246" href="#246">246</a>         <strong class="jxr_keyword">if</strong> (localAddress != <strong class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="247" href="#247">247</a>             sock.bind(localAddress);
+<a class="jxr_linenumber" name="248" href="#248">248</a>         }
+<a class="jxr_linenumber" name="249" href="#249">249</a>         <strong class="jxr_keyword">try</strong> {
+<a class="jxr_linenumber" name="250" href="#250">250</a>             sock.connect(remoteAddress, connectTimeout);
+<a class="jxr_linenumber" name="251" href="#251">251</a>         } <strong class="jxr_keyword">catch</strong> (<strong class="jxr_keyword">final</strong> IOException ex) {
+<a class="jxr_linenumber" name="252" href="#252">252</a>             <strong class="jxr_keyword">try</strong> {
+<a class="jxr_linenumber" name="253" href="#253">253</a>                 sock.close();
+<a class="jxr_linenumber" name="254" href="#254">254</a>             } <strong class="jxr_keyword">catch</strong> (<strong class="jxr_keyword">final</strong> IOException ignore) {
+<a class="jxr_linenumber" name="255" href="#255">255</a>             }
+<a class="jxr_linenumber" name="256" href="#256">256</a>             <strong class="jxr_keyword">throw</strong> ex;
+<a class="jxr_linenumber" name="257" href="#257">257</a>         }
+<a class="jxr_linenumber" name="258" href="#258">258</a>         <em class="jxr_comment">// Setup SSL layering if necessary</em>
+<a class="jxr_linenumber" name="259" href="#259">259</a>         <strong class="jxr_keyword">if</strong> (sock instanceof SSLSocket) {
+<a class="jxr_linenumber" name="260" href="#260">260</a>             <strong class="jxr_keyword">final</strong> SSLSocket sslsock = (SSLSocket) sock;
+<a class="jxr_linenumber" name="261" href="#261">261</a>             sslsock.startHandshake();
+<a class="jxr_linenumber" name="262" href="#262">262</a>             verifyHostname(sslsock, host.getHostName());
+<a class="jxr_linenumber" name="263" href="#263">263</a>             <strong class="jxr_keyword">return</strong> sock;
+<a class="jxr_linenumber" name="264" href="#264">264</a>         } <strong class="jxr_keyword">else</strong> {
+<a class="jxr_linenumber" name="265" href="#265">265</a>             <strong class="jxr_keyword">return</strong> createLayeredSocket(sock, host.getHostName(), remoteAddress.getPort(), context);
+<a class="jxr_linenumber" name="266" href="#266">266</a>         }
+<a class="jxr_linenumber" name="267" href="#267">267</a>     }
+<a class="jxr_linenumber" name="268" href="#268">268</a> 
+<a class="jxr_linenumber" name="269" href="#269">269</a>     <strong class="jxr_keyword">public</strong> Socket createLayeredSocket(
+<a class="jxr_linenumber" name="270" href="#270">270</a>             <strong class="jxr_keyword">final</strong> Socket socket,
+<a class="jxr_linenumber" name="271" href="#271">271</a>             <strong class="jxr_keyword">final</strong> String target,
+<a class="jxr_linenumber" name="272" href="#272">272</a>             <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> port,
+<a class="jxr_linenumber" name="273" href="#273">273</a>             <strong class="jxr_keyword">final</strong> HttpContext context) <strong class="jxr_keyword">throws</strong> IOException {
+<a class="jxr_linenumber" name="274" href="#274">274</a>         <strong class="jxr_keyword">final</strong> SSLSocket sslsock = (SSLSocket) <strong class="jxr_keyword">this</strong>.socketfactory.createSocket(
+<a class="jxr_linenumber" name="275" href="#275">275</a>                 socket,
+<a class="jxr_linenumber" name="276" href="#276">276</a>                 target,
+<a class="jxr_linenumber" name="277" href="#277">277</a>                 port,
+<a class="jxr_linenumber" name="278" href="#278">278</a>                 <strong class="jxr_keyword">true</strong>);
+<a class="jxr_linenumber" name="279" href="#279">279</a>         internalPrepareSocket(sslsock);
+<a class="jxr_linenumber" name="280" href="#280">280</a>         sslsock.startHandshake();
+<a class="jxr_linenumber" name="281" href="#281">281</a>         verifyHostname(sslsock, target);
+<a class="jxr_linenumber" name="282" href="#282">282</a>         <strong class="jxr_keyword">return</strong> sslsock;
+<a class="jxr_linenumber" name="283" href="#283">283</a>     }
+<a class="jxr_linenumber" name="284" href="#284">284</a> 
+<a class="jxr_linenumber" name="285" href="#285">285</a>     <a href="../../../../../org/apache/http/conn/ssl/X509HostnameVerifier.html">X509HostnameVerifier</a> getHostnameVerifier() {
+<a class="jxr_linenumber" name="286" href="#286">286</a>         <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">this</strong>.hostnameVerifier;
+<a class="jxr_linenumber" name="287" href="#287">287</a>     }
+<a class="jxr_linenumber" name="288" href="#288">288</a> 
+<a class="jxr_linenumber" name="289" href="#289">289</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">void</strong> verifyHostname(<strong class="jxr_keyword">final</strong> SSLSocket sslsock, <strong class="jxr_keyword">final</strong> String hostname) <strong class="jxr_keyword">throws</strong> IOException {
+<a class="jxr_linenumber" name="290" href="#290">290</a>         <strong class="jxr_keyword">try</strong> {
+<a class="jxr_linenumber" name="291" href="#291">291</a>             <strong class="jxr_keyword">this</strong>.hostnameVerifier.verify(hostname, sslsock);
+<a class="jxr_linenumber" name="292" href="#292">292</a>             <em class="jxr_comment">// verifyHostName() didn't blowup - good!</em>
+<a class="jxr_linenumber" name="293" href="#293">293</a>         } <strong class="jxr_keyword">catch</strong> (<strong class="jxr_keyword">final</strong> IOException iox) {
+<a class="jxr_linenumber" name="294" href="#294">294</a>             <em class="jxr_comment">// close the socket before re-throwing the exception</em>
+<a class="jxr_linenumber" name="295" href="#295">295</a>             <strong class="jxr_keyword">try</strong> { sslsock.close(); } <strong class="jxr_keyword">catch</strong> (<strong class="jxr_keyword">final</strong> Exception x) { <em class="jxr_comment">/*<em class="jxr_comment">ignore*/</em> }</em>
+<a class="jxr_linenumber" name="296" href="#296">296</a>             <strong class="jxr_keyword">throw</strong> iox;
+<a class="jxr_linenumber" name="297" href="#297">297</a>         }
+<a class="jxr_linenumber" name="298" href="#298">298</a>     }
+<a class="jxr_linenumber" name="299" href="#299">299</a> 
+<a class="jxr_linenumber" name="300" href="#300">300</a> }
 </pre>
 <hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
 </html>



Mime
View raw message