Mercurial > hg > release > icedtea7-forest-2.3 > jdk
changeset 6109:ab13edf4532c
8006669: sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.sh fails on mac
Reviewed-by: alanb
author | chegar |
---|---|
date | Wed, 23 Jan 2013 14:45:44 +0000 |
parents | 4c0d2f6dd20c |
children | 9968e92494e2 |
files | test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.java test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.java |
diffstat | 2 files changed, 11 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.java Thu Dec 20 20:11:45 2012 -0800 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.java Wed Jan 23 14:45:44 2013 +0000 @@ -153,7 +153,7 @@ /* * setup up a proxy */ - setupProxy(); + SocketAddress pAddr = setupProxy(); /* * we want to avoid URLspoofCheck failures in cases where the cert @@ -163,7 +163,8 @@ new NameVerifier()); URL url = new URL("https://" + hostname+ ":" + serverPort); - HttpsURLConnection https = (HttpsURLConnection)url.openConnection(); + Proxy p = new Proxy(Proxy.Type.HTTP, pAddr); + HttpsURLConnection https = (HttpsURLConnection)url.openConnection(p); https.setDoOutput(true); https.setRequestMethod("POST"); PrintStream ps = null; @@ -200,14 +201,12 @@ } } - static void setupProxy() throws IOException { + static SocketAddress setupProxy() throws IOException { ProxyTunnelServer pserver = new ProxyTunnelServer(); // disable proxy authentication pserver.needUserAuth(false); pserver.start(); - System.setProperty("https.proxyHost", "localhost"); - System.setProperty("https.proxyPort", String.valueOf( - pserver.getPort())); + return new InetSocketAddress("localhost", pserver.getPort()); } }
--- a/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.java Thu Dec 20 20:11:45 2012 -0800 +++ b/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.java Wed Jan 23 14:45:44 2013 +0000 @@ -152,7 +152,7 @@ /* * setup up a proxy */ - setupProxy(); + SocketAddress pAddr = setupProxy(); /* * we want to avoid URLspoofCheck failures in cases where the cert @@ -162,7 +162,8 @@ new NameVerifier()); URL url = new URL("https://" + hostname + ":" + serverPort); - HttpsURLConnection https = (HttpsURLConnection)url.openConnection(); + Proxy p = new Proxy(Proxy.Type.HTTP, pAddr); + HttpsURLConnection https = (HttpsURLConnection)url.openConnection(p); https.setDoOutput(true); https.setRequestMethod("POST"); PrintStream ps = null; @@ -195,7 +196,7 @@ } } - static void setupProxy() throws IOException { + static SocketAddress setupProxy() throws IOException { ProxyTunnelServer pserver = new ProxyTunnelServer(); /* @@ -209,9 +210,8 @@ pserver.setUserAuth("Test", "test123"); pserver.start(); - System.setProperty("https.proxyHost", "localhost"); - System.setProperty("https.proxyPort", String.valueOf( - pserver.getPort())); + + return new InetSocketAddress("localhost", pserver.getPort()); } public static class TestAuthenticator extends Authenticator { @@ -220,6 +220,4 @@ "test123".toCharArray()); } } - - }