Loading core/java/android/net/http/SslError.java +0 −4 Original line number Diff line number Diff line Loading @@ -163,10 +163,6 @@ public class SslError { * Gets the URL associated with this object. * @return The URL, non-null. */ // TODO: When the WebView constructs an instance of this object, we // actually provide only the hostname, not the full URL. We should consider // deprecating this method, adding a new getHost() method and updating the // constructor arguments. See http://b/5410252. public String getUrl() { return mUrl; } Loading core/java/android/webkit/BrowserFrame.java +1 −7 Original line number Diff line number Diff line Loading @@ -43,7 +43,6 @@ import junit.framework.Assert; import java.io.IOException; import java.io.InputStream; import java.lang.ref.WeakReference; import java.net.URL; import java.net.URLEncoder; import java.nio.charset.Charsets; import java.security.PrivateKey; Loading Loading @@ -1171,12 +1170,7 @@ class BrowserFrame extends Handler { try { X509Certificate cert = new X509CertImpl(certDER); SslCertificate sslCert = new SslCertificate(cert); if (JniUtil.useChromiumHttpStack()) { sslError = SslError.SslErrorFromChromiumErrorCode(certError, sslCert, new URL(url).getHost()); } else { sslError = new SslError(certError, cert, url); } sslError = SslError.SslErrorFromChromiumErrorCode(certError, sslCert, url); } catch (IOException e) { // Can't get the certificate, not much to do. Log.e(LOGTAG, "Can't get the certificate from WebKit, canceling"); Loading core/java/android/webkit/SslCertLookupTable.java +23 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,9 @@ package android.webkit; import android.os.Bundle; import android.net.http.SslError; import java.net.MalformedURLException; import java.net.URL; /** * Stores the user's decision of whether to allow or deny an invalid certificate. * Loading @@ -40,14 +43,32 @@ final class SslCertLookupTable { } public void setIsAllowed(SslError sslError, boolean allow) { table.putBoolean(sslError.toString(), allow); // TODO: We should key on just the host. See http://b/5409251. String errorString = sslErrorToString(sslError); if (errorString != null) { table.putBoolean(errorString, allow); } } public boolean isAllowed(SslError sslError) { return table.getBoolean(sslError.toString()); // TODO: We should key on just the host. See http://b/5409251. String errorString = sslErrorToString(sslError); return errorString == null ? false : table.getBoolean(errorString); } public void clear() { table.clear(); } private static String sslErrorToString(SslError error) { String host; try { host = new URL(error.getUrl()).getHost(); } catch(MalformedURLException e) { return null; } return "primary error: " + error.getPrimaryError() + " certificate: " + error.getCertificate() + " on host: " + host; } } Loading
core/java/android/net/http/SslError.java +0 −4 Original line number Diff line number Diff line Loading @@ -163,10 +163,6 @@ public class SslError { * Gets the URL associated with this object. * @return The URL, non-null. */ // TODO: When the WebView constructs an instance of this object, we // actually provide only the hostname, not the full URL. We should consider // deprecating this method, adding a new getHost() method and updating the // constructor arguments. See http://b/5410252. public String getUrl() { return mUrl; } Loading
core/java/android/webkit/BrowserFrame.java +1 −7 Original line number Diff line number Diff line Loading @@ -43,7 +43,6 @@ import junit.framework.Assert; import java.io.IOException; import java.io.InputStream; import java.lang.ref.WeakReference; import java.net.URL; import java.net.URLEncoder; import java.nio.charset.Charsets; import java.security.PrivateKey; Loading Loading @@ -1171,12 +1170,7 @@ class BrowserFrame extends Handler { try { X509Certificate cert = new X509CertImpl(certDER); SslCertificate sslCert = new SslCertificate(cert); if (JniUtil.useChromiumHttpStack()) { sslError = SslError.SslErrorFromChromiumErrorCode(certError, sslCert, new URL(url).getHost()); } else { sslError = new SslError(certError, cert, url); } sslError = SslError.SslErrorFromChromiumErrorCode(certError, sslCert, url); } catch (IOException e) { // Can't get the certificate, not much to do. Log.e(LOGTAG, "Can't get the certificate from WebKit, canceling"); Loading
core/java/android/webkit/SslCertLookupTable.java +23 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,9 @@ package android.webkit; import android.os.Bundle; import android.net.http.SslError; import java.net.MalformedURLException; import java.net.URL; /** * Stores the user's decision of whether to allow or deny an invalid certificate. * Loading @@ -40,14 +43,32 @@ final class SslCertLookupTable { } public void setIsAllowed(SslError sslError, boolean allow) { table.putBoolean(sslError.toString(), allow); // TODO: We should key on just the host. See http://b/5409251. String errorString = sslErrorToString(sslError); if (errorString != null) { table.putBoolean(errorString, allow); } } public boolean isAllowed(SslError sslError) { return table.getBoolean(sslError.toString()); // TODO: We should key on just the host. See http://b/5409251. String errorString = sslErrorToString(sslError); return errorString == null ? false : table.getBoolean(errorString); } public void clear() { table.clear(); } private static String sslErrorToString(SslError error) { String host; try { host = new URL(error.getUrl()).getHost(); } catch(MalformedURLException e) { return null; } return "primary error: " + error.getPrimaryError() + " certificate: " + error.getCertificate() + " on host: " + host; } }