Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2210877 | 7u2 | Robert Mckenna | P3 | Closed | Fixed | b08 |
JDK-2210876 | 6u30 | Robert Mckenna | P3 | Closed | Fixed | b08 |
JDK-2210878 | 5.0u33 | Robert Mckenna | P3 | Closed | Fixed | b08 |
FULL PRODUCT VERSION :
java version "1.5.0_14"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
Java HotSpot(TM) Client VM (build 1.5.0_14-b03, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
When using HttpsUrlConnection in in conjunction with authenticated proxies, an endless recursion can occur when the proxy reacts unexpected. See coding below.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the coding supplied, the ProxyConnect class first.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
ProxyTest should fail cleanly.
ACTUAL -
StackOverFlowError
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;
/**
* TODO_DOC add type comment
* <p/>
* @author Richard Birenheide (D035816)
*/
public class ProxyConnect {
/**
* TODO_DOC add method comment
* <p/>
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
ServerSocket ss = new ServerSocket(9000);
while (true) {
Socket s = ss.accept();
InputStream is = s.getInputStream();
byte[] buffer = new byte[10000];
is.read(buffer);
System.out.println(new String(buffer));
// Thread.sleep(10000);
s.getOutputStream().write("HTTP/1.1 407\nProxy-Authenticate:Basic realm=\"WallyWorld\"\n\n".getBytes());
s.close();
s = ss.accept();
is = s.getInputStream();
buffer = new byte[10000];
is.read(buffer);
System.out.println(new String(buffer));
// Thread.sleep(10000);
// s.getOutputStream().write("HTTP/1.0 407 \n\n".getBytes());
s.close();
}
}
}
---------------------------------------------------------------------------------------------------
import java.net.Authenticator;
import java.net.InetSocketAddress;
import java.net.PasswordAuthentication;
import java.net.Proxy;
import java.net.URL;
import javax.net.ssl.HttpsURLConnection;
/**
* TODO_DOC add type comment
* <p/>
* @author Richard Birenheide (D035816)
*/
public class ProxyTest {
/**
* TODO_DOC add method comment
* <p/>
* @param args
*/
public static void main(String[] args) throws Exception {
URL url = new URL("https://localhost:80");
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
System.out.println("Called");
return new PasswordAuthentication("Test", "Test".toCharArray());
}
});
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("localhost", 9000)));
conn.setAllowUserInteraction(true);
conn.setUseCaches(false);
conn.addRequestProperty("Proxy-Authorization", "blabla");
conn.connect();
}
}
---------- END SOURCE ----------
java version "1.5.0_14"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
Java HotSpot(TM) Client VM (build 1.5.0_14-b03, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
When using HttpsUrlConnection in in conjunction with authenticated proxies, an endless recursion can occur when the proxy reacts unexpected. See coding below.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the coding supplied, the ProxyConnect class first.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
ProxyTest should fail cleanly.
ACTUAL -
StackOverFlowError
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;
/**
* TODO_DOC add type comment
* <p/>
* @author Richard Birenheide (D035816)
*/
public class ProxyConnect {
/**
* TODO_DOC add method comment
* <p/>
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
ServerSocket ss = new ServerSocket(9000);
while (true) {
Socket s = ss.accept();
InputStream is = s.getInputStream();
byte[] buffer = new byte[10000];
is.read(buffer);
System.out.println(new String(buffer));
// Thread.sleep(10000);
s.getOutputStream().write("HTTP/1.1 407\nProxy-Authenticate:Basic realm=\"WallyWorld\"\n\n".getBytes());
s.close();
s = ss.accept();
is = s.getInputStream();
buffer = new byte[10000];
is.read(buffer);
System.out.println(new String(buffer));
// Thread.sleep(10000);
// s.getOutputStream().write("HTTP/1.0 407 \n\n".getBytes());
s.close();
}
}
}
---------------------------------------------------------------------------------------------------
import java.net.Authenticator;
import java.net.InetSocketAddress;
import java.net.PasswordAuthentication;
import java.net.Proxy;
import java.net.URL;
import javax.net.ssl.HttpsURLConnection;
/**
* TODO_DOC add type comment
* <p/>
* @author Richard Birenheide (D035816)
*/
public class ProxyTest {
/**
* TODO_DOC add method comment
* <p/>
* @param args
*/
public static void main(String[] args) throws Exception {
URL url = new URL("https://localhost:80");
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
System.out.println("Called");
return new PasswordAuthentication("Test", "Test".toCharArray());
}
});
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("localhost", 9000)));
conn.setAllowUserInteraction(true);
conn.setUseCaches(false);
conn.addRequestProperty("Proxy-Authorization", "blabla");
conn.connect();
}
}
---------- END SOURCE ----------
- backported by
-
JDK-2210876 StackOverFlow with authenticated Proxy tunnels
-
- Closed
-
-
JDK-2210877 StackOverFlow with authenticated Proxy tunnels
-
- Closed
-
-
JDK-2210878 StackOverFlow with authenticated Proxy tunnels
-
- Closed
-
- relates to
-
JDK-7100135 Two HttpsURLConnection tests fail (regression)
-
- Resolved
-