01-Jul megacz HTTP.java: we no longer insert the IP into the URL.
+01-Jul megacz TinySSL.java, HTTP.java: fixed SSL-over-Proxy
+
if (!ssl) {
path = "http://" + host + ":" + port + path;
} else {
- if (Log.on) Log.log(this, "attempting to create HTTP proxied socket using proxy " + proxyHost + ":" + proxyPort);
PrintWriter pw = new PrintWriter(new OutputStreamWriter(sock.getOutputStream()));
BufferedReader br = new BufferedReader(new InputStreamReader(sock.getInputStream()));
- pw.print("CONNECT " + host + ":" + port + " HTTP/1.0\r\n\r\n");
+ pw.print("CONNECT " + host + ":" + port + " HTTP/1.1\r\n\r\n");
+ pw.flush();
String s = br.readLine();
if (s.charAt(9) != '2') throw new HTTPException("proxy refused CONNECT method: \"" + s + "\"");
while (br.readLine().length() > 0) { };
public X509CertificateStructure server_cert = null;
- public SSLOutputStream os;
- public SSLInputStream is;
+ public SSLOutputStream os = null;
+ public SSLInputStream is = null;
String hostname;
/** true iff we're using SSL_RSA_EXPORT_WITH_RC4_40_MD5 */
boolean export = false;
- public InputStream getInputStream() { return is; }
- public OutputStream getOutputStream() { return os; }
+ public InputStream getInputStream() throws IOException { return is != null ? is : super.getInputStream(); }
+ public OutputStream getOutputStream() throws IOException { return os != null ? os : super.getOutputStream(); }
public TinySSL(String host, int port) throws IOException { this(host, port, true); }
public TinySSL(String host, int port, boolean negotiateImmediately) throws IOException {