36 // package com.sun.net.ssl.internal.www.protocol.https; |
36 // package com.sun.net.ssl.internal.www.protocol.https; |
37 |
37 |
38 import java.net.URL; |
38 import java.net.URL; |
39 import java.net.Proxy; |
39 import java.net.Proxy; |
40 import java.net.ProtocolException; |
40 import java.net.ProtocolException; |
|
41 import java.net.MalformedURLException; |
41 import java.io.*; |
42 import java.io.*; |
42 import java.net.Authenticator; |
43 import java.net.Authenticator; |
43 import javax.net.ssl.*; |
44 import javax.net.ssl.*; |
44 import java.security.Permission; |
45 import java.security.Permission; |
45 import java.security.Principal; |
46 import java.security.Principal; |
78 HttpsURLConnectionImpl(URL u, Handler handler) throws IOException { |
79 HttpsURLConnectionImpl(URL u, Handler handler) throws IOException { |
79 // HttpsURLConnectionOldImpl(URL u, Handler handler) throws IOException { |
80 // HttpsURLConnectionOldImpl(URL u, Handler handler) throws IOException { |
80 this(u, null, handler); |
81 this(u, null, handler); |
81 } |
82 } |
82 |
83 |
|
84 static URL checkURL(URL u) throws IOException { |
|
85 if (u != null) { |
|
86 if (u.toExternalForm().indexOf('\n') > -1) { |
|
87 throw new MalformedURLException("Illegal character in URL"); |
|
88 } |
|
89 } |
|
90 return u; |
|
91 } |
83 // For both copies of the file, uncomment one line and comment the other |
92 // For both copies of the file, uncomment one line and comment the other |
84 HttpsURLConnectionImpl(URL u, Proxy p, Handler handler) throws IOException { |
93 HttpsURLConnectionImpl(URL u, Proxy p, Handler handler) throws IOException { |
85 // HttpsURLConnectionOldImpl(URL u, Proxy p, Handler handler) throws IOException { |
94 // HttpsURLConnectionOldImpl(URL u, Proxy p, Handler handler) throws IOException { |
86 super(u); |
95 super(checkURL(u)); |
87 delegate = new DelegateHttpsURLConnection(url, p, handler, this); |
96 delegate = new DelegateHttpsURLConnection(url, p, handler, this); |
88 } |
97 } |
89 |
98 |
90 // NOTE: introduced for plugin |
99 // NOTE: introduced for plugin |
91 // subclass needs to overwrite this to set delegate to |
100 // subclass needs to overwrite this to set delegate to |