mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8176751: Better URL connections
Reviewed-by: chegar, michaelm, rhalade, rpatil, vtewari
This commit is contained in:
parent
f92a050948
commit
c8812e460a
3 changed files with 43 additions and 7 deletions
|
@ -38,6 +38,7 @@ package com.sun.net.ssl.internal.www.protocol.https;
|
|||
import java.net.URL;
|
||||
import java.net.Proxy;
|
||||
import java.net.ProtocolException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.io.*;
|
||||
import java.net.Authenticator;
|
||||
import javax.net.ssl.*;
|
||||
|
@ -78,10 +79,18 @@ public class HttpsURLConnectionOldImpl
|
|||
this(u, null, handler);
|
||||
}
|
||||
|
||||
static URL checkURL(URL u) throws IOException {
|
||||
if (u != null) {
|
||||
if (u.toExternalForm().indexOf('\n') > -1) {
|
||||
throw new MalformedURLException("Illegal character in URL");
|
||||
}
|
||||
}
|
||||
return u;
|
||||
}
|
||||
// For both copies of the file, uncomment one line and comment the other
|
||||
// HttpsURLConnectionImpl(URL u, Handler handler) throws IOException {
|
||||
HttpsURLConnectionOldImpl(URL u, Proxy p, Handler handler) throws IOException {
|
||||
super(u);
|
||||
super(checkURL(u));
|
||||
delegate = new DelegateHttpsURLConnection(url, p, handler, this);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue