< prev index next >

src/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.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.security.Principal; import java.util.Map;
*** 77,90 **** 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, Proxy p, Handler handler) throws IOException { // HttpsURLConnectionOldImpl(URL u, Proxy p, Handler handler) throws IOException { ! super(u); delegate = new DelegateHttpsURLConnection(url, p, handler, this); } // NOTE: introduced for plugin // subclass needs to overwrite this to set delegate to --- 78,99 ---- 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, Proxy p, Handler handler) throws IOException { // HttpsURLConnectionOldImpl(URL u, Proxy p, Handler handler) throws IOException { ! super(checkURL(u)); delegate = new DelegateHttpsURLConnection(url, p, handler, this); } // NOTE: introduced for plugin // subclass needs to overwrite this to set delegate to
< prev index next >