< prev index next >
src/share/classes/com/sun/net/ssl/internal/www/protocol/https/HttpsURLConnectionOldImpl.java
Print this page
rev 12536 : 8176751: Better URL connections
Reviewed-by: chegar, michaelm, rhalade, rpatil, vtewari
*** 36,45 ****
--- 36,46 ----
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 javax.net.ssl.*;
import java.security.Permission;
import java.util.Map;
import java.util.List;
*** 73,86 ****
// HttpsURLConnectionImpl(URL u, Handler handler) throws IOException {
HttpsURLConnectionOldImpl(URL u, Handler handler) throws IOException {
this(u, null, handler);
}
// 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);
delegate = new DelegateHttpsURLConnection(url, p, handler, this);
}
/**
* Create a new HttpClient object, bypassing the cache of
--- 74,95 ----
// HttpsURLConnectionImpl(URL u, Handler handler) throws IOException {
HttpsURLConnectionOldImpl(URL u, Handler handler) throws IOException {
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(checkURL(u));
delegate = new DelegateHttpsURLConnection(url, p, handler, this);
}
/**
* Create a new HttpClient object, bypassing the cache of
< prev index next >