8006669: sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.sh fails on mac
Reviewed-by: alanb
This commit is contained in:
parent
3b0f760747
commit
12e480040a
@ -153,7 +153,7 @@ public class PostThruProxy {
|
|||||||
/*
|
/*
|
||||||
* setup up a proxy
|
* setup up a proxy
|
||||||
*/
|
*/
|
||||||
setupProxy();
|
SocketAddress pAddr = setupProxy();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* we want to avoid URLspoofCheck failures in cases where the cert
|
* we want to avoid URLspoofCheck failures in cases where the cert
|
||||||
@ -163,7 +163,8 @@ public class PostThruProxy {
|
|||||||
new NameVerifier());
|
new NameVerifier());
|
||||||
URL url = new URL("https://" + hostname+ ":" + serverPort);
|
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.setDoOutput(true);
|
||||||
https.setRequestMethod("POST");
|
https.setRequestMethod("POST");
|
||||||
PrintStream ps = null;
|
PrintStream ps = null;
|
||||||
@ -200,14 +201,12 @@ public class PostThruProxy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setupProxy() throws IOException {
|
static SocketAddress setupProxy() throws IOException {
|
||||||
ProxyTunnelServer pserver = new ProxyTunnelServer();
|
ProxyTunnelServer pserver = new ProxyTunnelServer();
|
||||||
|
|
||||||
// disable proxy authentication
|
// disable proxy authentication
|
||||||
pserver.needUserAuth(false);
|
pserver.needUserAuth(false);
|
||||||
pserver.start();
|
pserver.start();
|
||||||
System.setProperty("https.proxyHost", "localhost");
|
return new InetSocketAddress("localhost", pserver.getPort());
|
||||||
System.setProperty("https.proxyPort", String.valueOf(
|
|
||||||
pserver.getPort()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,7 @@ public class PostThruProxyWithAuth {
|
|||||||
/*
|
/*
|
||||||
* setup up a proxy
|
* setup up a proxy
|
||||||
*/
|
*/
|
||||||
setupProxy();
|
SocketAddress pAddr = setupProxy();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* we want to avoid URLspoofCheck failures in cases where the cert
|
* we want to avoid URLspoofCheck failures in cases where the cert
|
||||||
@ -162,7 +162,8 @@ public class PostThruProxyWithAuth {
|
|||||||
new NameVerifier());
|
new NameVerifier());
|
||||||
URL url = new URL("https://" + hostname + ":" + serverPort);
|
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.setDoOutput(true);
|
||||||
https.setRequestMethod("POST");
|
https.setRequestMethod("POST");
|
||||||
PrintStream ps = null;
|
PrintStream ps = null;
|
||||||
@ -195,7 +196,7 @@ public class PostThruProxyWithAuth {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setupProxy() throws IOException {
|
static SocketAddress setupProxy() throws IOException {
|
||||||
ProxyTunnelServer pserver = new ProxyTunnelServer();
|
ProxyTunnelServer pserver = new ProxyTunnelServer();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -209,9 +210,8 @@ public class PostThruProxyWithAuth {
|
|||||||
pserver.setUserAuth("Test", "test123");
|
pserver.setUserAuth("Test", "test123");
|
||||||
|
|
||||||
pserver.start();
|
pserver.start();
|
||||||
System.setProperty("https.proxyHost", "localhost");
|
|
||||||
System.setProperty("https.proxyPort", String.valueOf(
|
return new InetSocketAddress("localhost", pserver.getPort());
|
||||||
pserver.getPort()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TestAuthenticator extends Authenticator {
|
public static class TestAuthenticator extends Authenticator {
|
||||||
@ -220,6 +220,4 @@ public class PostThruProxyWithAuth {
|
|||||||
"test123".toCharArray());
|
"test123".toCharArray());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user