diff options
author | pasko@google.com <pasko@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-10 12:49:38 +0000 |
---|---|---|
committer | pasko@google.com <pasko@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-10 12:49:38 +0000 |
commit | 4429523aae3d7f67b0a92f348faa0d754eb018e2 (patch) | |
tree | 87c7115f19f0d6e185c56ec2bc88041a6c0ef617 /net | |
parent | 4f35c8ba46474874adfd4e492a9146443459a389 (diff) | |
download | chromium_src-4429523aae3d7f67b0a92f348faa0d754eb018e2.zip chromium_src-4429523aae3d7f67b0a92f348faa0d754eb018e2.tar.gz chromium_src-4429523aae3d7f67b0a92f348faa0d754eb018e2.tar.bz2 |
Use SCHEME_HTTP for HTTPS proxies on Android.
This makes the ProxyServer setup aligned with the Linux implementation (see
proxy_config_service_linux.cc) which never uses SCHEME_HTTPS.
BUG=162908
TEST=Set up proxy in Android WiFi settings, go to https://google.com, observe
the page gets loaded.
Review URL: https://chromiumcodereview.appspot.com/11438047
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172045 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
4 files changed, 21 insertions, 38 deletions
diff --git a/net/android/javatests/src/org/chromium/net/AndroidProxySelectorTest.java b/net/android/javatests/src/org/chromium/net/AndroidProxySelectorTest.java index 25b7c63..c705f69 100644 --- a/net/android/javatests/src/org/chromium/net/AndroidProxySelectorTest.java +++ b/net/android/javatests/src/org/chromium/net/AndroidProxySelectorTest.java @@ -234,20 +234,6 @@ public class AndroidProxySelectorTest extends InstrumentationTestCase { } /** - * Test https.proxyHost and default port. - * - * @throws Exception - */ - @SmallTest - @Feature({"AndroidWebView"}) - public void testHttpsProxyHostOnly() throws Exception { - System.setProperty("https.proxyHost", "httpproxy.com"); - checkMapping("ftp://example.com/", "DIRECT"); - checkMapping("http://example.com/", "DIRECT"); - checkMapping("https://example.com/", "PROXY httpproxy.com:443"); - } - - /** * Default http proxy is used if a scheme-specific one is not found. * * @throws Exception @@ -265,19 +251,6 @@ public class AndroidProxySelectorTest extends InstrumentationTestCase { } /** - * Check that the default proxy port is as expected. - * - * @throws Exception - */ - @SmallTest - @Feature({"AndroidWebView"}) - public void testDefaultProxyDefaultPort() throws Exception { - System.setProperty("proxyHost", "defaultproxy.com"); - checkMapping("http://example.com/", "PROXY defaultproxy.com:80"); - checkMapping("https://example.com/", "PROXY defaultproxy.com:443"); - } - - /** * SOCKS proxy is used if scheme-specific one is not found. * * @throws Exception diff --git a/net/android/tools/proxy_test_cases.py b/net/android/tools/proxy_test_cases.py index a377767..3d6e8ec 100755 --- a/net/android/tools/proxy_test_cases.py +++ b/net/android/tools/proxy_test_cases.py @@ -154,7 +154,7 @@ test_cases = [ "https.proxyPort" : "8080", }, "mappings" : { - "https://example.com/" : "HTTPS httpproxy.com:8080", + "https://example.com/" : "PROXY httpproxy.com:8080", "http://example.com/" : "DIRECT", "ftp://example.com/" : "DIRECT", } @@ -162,11 +162,14 @@ test_cases = [ { "name": "HttpsProxyHostOnly", "description" : "Test https.proxyHost and default port.", + # Chromium differs from the Android platform by connecting to port 80 for + # HTTPS connections by default, hence cpp-only. + "cpp-only" : "", "properties" : { "https.proxyHost" : "httpproxy.com", }, "mappings" : { - "https://example.com/" : "HTTPS httpproxy.com:443", + "https://example.com/" : "PROXY httpproxy.com:80", "http://example.com/" : "DIRECT", "ftp://example.com/" : "DIRECT", } @@ -221,19 +224,22 @@ test_cases = [ }, "mappings" : { "http://example.com/" : "PROXY defaultproxy.com:8080", - "https://example.com/" : "HTTPS defaultproxy.com:8080", + "https://example.com/" : "PROXY defaultproxy.com:8080", "ftp://example.com/" : "PROXY httpproxy.com:8080", } }, { "name": "DefaultProxyDefaultPort", "description" : "Check that the default proxy port is as expected.", + # Chromium differs from the Android platform by connecting to port 80 for + # HTTPS connections by default, hence cpp-only. + "cpp-only" : "", "properties" : { "proxyHost" : "defaultproxy.com", }, "mappings" : { "http://example.com/" : "PROXY defaultproxy.com:80", - "https://example.com/" : "HTTPS defaultproxy.com:443", + "https://example.com/" : "PROXY defaultproxy.com:80", } }, { @@ -310,7 +316,7 @@ class GenerateJava: if "description" in test_case: self._GenerateDescription(test_case["description"]); print " @SmallTest" - print " @Feature({\"Android-WebView\"})" + print " @Feature({\"AndroidWebView\"})" print " public void test%s() throws Exception {" % test_case["name"] self._GenerateConfiguration(test_case["properties"]) self._GenerateMappings(test_case["mappings"]) diff --git a/net/proxy/proxy_config_service_android.cc b/net/proxy/proxy_config_service_android.cc index 694898e..f48c366 100644 --- a/net/proxy/proxy_config_service_android.cc +++ b/net/proxy/proxy_config_service_android.cc @@ -118,12 +118,16 @@ void AddBypassRules(const std::string& scheme, bool GetProxyRules(const GetPropertyCallback& get_property, ProxyConfig::ProxyRules* rules) { // See libcore/luni/src/main/java/java/net/ProxySelectorImpl.java for the - // equivalent Android implementation. + // mostly equivalent Android implementation. There is one intentional + // difference: by default Chromium uses the HTTP port (80) for HTTPS + // connections via proxy. This default is identical on other platforms. + // On the opposite, Java spec suggests to use HTTPS port (443) by default (the + // default value of https.proxyPort). rules->type = ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME; rules->proxy_for_http = LookupProxy("http", get_property, ProxyServer::SCHEME_HTTP); rules->proxy_for_https = LookupProxy("https", get_property, - ProxyServer::SCHEME_HTTPS); + ProxyServer::SCHEME_HTTP); rules->proxy_for_ftp = LookupProxy("ftp", get_property, ProxyServer::SCHEME_HTTP); rules->fallback_proxy = LookupSocksProxy(get_property); diff --git a/net/proxy/proxy_config_service_android_unittest.cc b/net/proxy/proxy_config_service_android_unittest.cc index 4d31bad..b7bdb3e 100644 --- a/net/proxy/proxy_config_service_android_unittest.cc +++ b/net/proxy/proxy_config_service_android_unittest.cc @@ -265,7 +265,7 @@ TEST_F(ProxyConfigServiceAndroidTest, HttpsProxyHostAndPort) { ProxySettingsChanged(); TestMapping("ftp://example.com/", "DIRECT"); TestMapping("http://example.com/", "DIRECT"); - TestMapping("https://example.com/", "HTTPS httpproxy.com:8080"); + TestMapping("https://example.com/", "PROXY httpproxy.com:8080"); } TEST_F(ProxyConfigServiceAndroidTest, HttpsProxyHostOnly) { @@ -274,7 +274,7 @@ TEST_F(ProxyConfigServiceAndroidTest, HttpsProxyHostOnly) { ProxySettingsChanged(); TestMapping("ftp://example.com/", "DIRECT"); TestMapping("http://example.com/", "DIRECT"); - TestMapping("https://example.com/", "HTTPS httpproxy.com:443"); + TestMapping("https://example.com/", "PROXY httpproxy.com:80"); } TEST_F(ProxyConfigServiceAndroidTest, HttpProxyHostIPv6) { @@ -312,7 +312,7 @@ TEST_F(ProxyConfigServiceAndroidTest, DefaultProxyExplictPort) { ProxySettingsChanged(); TestMapping("ftp://example.com/", "PROXY httpproxy.com:8080"); TestMapping("http://example.com/", "PROXY defaultproxy.com:8080"); - TestMapping("https://example.com/", "HTTPS defaultproxy.com:8080"); + TestMapping("https://example.com/", "PROXY defaultproxy.com:8080"); } TEST_F(ProxyConfigServiceAndroidTest, DefaultProxyDefaultPort) { @@ -320,7 +320,7 @@ TEST_F(ProxyConfigServiceAndroidTest, DefaultProxyDefaultPort) { AddProperty("proxyHost", "defaultproxy.com"); ProxySettingsChanged(); TestMapping("http://example.com/", "PROXY defaultproxy.com:80"); - TestMapping("https://example.com/", "HTTPS defaultproxy.com:443"); + TestMapping("https://example.com/", "PROXY defaultproxy.com:80"); } TEST_F(ProxyConfigServiceAndroidTest, FallbackToSocks) { |