JPProxy update - Https support

This commit is contained in:
Jindra Petk
2011-07-17 11:13:51 +02:00
parent 49a8fd03bf
commit 940a57f5d8
11 changed files with 389 additions and 291 deletions

View File

@@ -5,6 +5,15 @@ import java.net.Socket;
public class Client extends Connection
{
@Override
public void promoteToServerSSL() {
super.promoteToServerSSL();
in = new BufferedInputStream(in);
out = new BufferedOutputStream(out);
}
/**
* Create a Client from a Socket.
*/
@@ -26,7 +35,7 @@ public class Client extends Connection
Request read() throws IOException
{
Request request = new Request(this);
request.read(getInputStream());
request.read(getInputStream());
return request;
}

View File

@@ -1,5 +1,6 @@
package com.jpexs.proxy;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -8,13 +9,59 @@ import java.net.Socket;
import java.net.SocketException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLServerSocketFactory;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
class Connection
{
Socket socket = null;
InputStream in = null;
OutputStream out = null;
public void promoteToClientSSL(){
SSLSocketFactory f = (SSLSocketFactory) SSLSocketFactory.getDefault();
try {
socket = (SSLSocket) f.createSocket(socket,null,socket.getPort(),false);
in = socket.getInputStream();
out = socket.getOutputStream();
} catch (IOException ex) {
}
}
public void promoteToServerSSL(){
String ksName = "server.jks";
char ksPass[] = "ServerJKS".toCharArray();
char ctPass[] = "ServerKey".toCharArray();
try{
KeyStore ks = KeyStore.getInstance("JKS");
ks.load(new FileInputStream(ksName), ksPass);
KeyManagerFactory kmf =
KeyManagerFactory.getInstance("SunX509");
kmf.init(ks, ctPass);
SSLContext sc = SSLContext.getInstance("TLS");
sc.init(kmf.getKeyManagers(), null, null);
SSLSocketFactory sf=sc.getSocketFactory();
socket=sf.createSocket(socket,null,socket.getPort(),false);
((SSLSocket)socket).setUseClientMode(false);
}catch(Exception ex){
}
try {
in = socket.getInputStream();
out = socket.getOutputStream();
} catch (IOException ex) {
}
}
/**
* Create a Connection from a Socket.
*
@@ -81,7 +128,7 @@ class Connection
}
catch (IOException e)
{
System.out.println("Connection: " + e);
}
}
}

View File

@@ -1,6 +1,8 @@
package com.jpexs.proxy;
import java.io.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.zip.*;
import java.net.Socket;
import java.net.SocketTimeoutException;
@@ -10,6 +12,7 @@ import java.util.Calendar;
import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
import javax.net.ssl.SSLHandshakeException;
class Handler implements Runnable
{
@@ -30,11 +33,16 @@ class Handler implements Runnable
List<String> catchedContentTypes;
ReplacedListener replacedListener;
static int curId=0;
int id;
/**
* Create a Handler.
*/
Handler(Socket socket,List<Replacement> replacements, List<String> catchedContentTypes, CatchedListener catchedListener, ReplacedListener replacedListener)
{
curId++;
id=curId;
this.socket = socket;
this.replacements = replacements;
this.catchedListener = catchedListener;
@@ -72,7 +80,7 @@ class Handler implements Runnable
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
@@ -93,13 +101,16 @@ class Handler implements Runnable
}
catch (IOException e)
{
e.printStackTrace();
return;
}
try
{
boolean secure=false;
int securePort=443;
String secureServer="";
do
{
request = null;
@@ -109,18 +120,46 @@ class Handler implements Runnable
try
{
request = client.read();
if(secure){
request.addSecureHostToURL(secureServer);
}
}
catch(SSLHandshakeException she)
{
client.close();
break;
}
catch (IOException e)
{
e.printStackTrace();
break;
}
if(request.getCommand().equals("CONNECT")){
secureServer=request.getHost();
securePort=request.getPort();
if((ProxyConfig.httpsMode==ProxyConfig.HTTPS_FILTER)||((ProxyConfig.httpsMode==ProxyConfig.HTTPS_FILTERLIST)&&(ProxyConfig.enabledHttpsServers.contains(secureServer)))){
secure=true;
reply=new Reply();
reply.statusLine = "HTTP/1.0 200 Connection established";
reply.setHeaderField("Proxy-agent", ProxyConfig.appName);
try {
client.write(reply);
} catch (IOException ex) {
}
client.promoteToServerSSL();
keepAlive=true;
continue;
}
}
idle = 0;
try
{
keepAlive = processRequest();
keepAlive = processRequest(secure,secureServer,securePort);
}
catch (IOException ioe)
{
@@ -154,19 +193,18 @@ class Handler implements Runnable
error(client.getOutputStream(), reason, request);
}
//reason.printStackTrace();
}
close();
}
boolean processRequest() throws IOException
boolean processRequest(boolean secure,String secureHost,int securePort) throws IOException
{
boolean keepAlive = false;
while (reply == null)
{
boolean secure = false;
//boolean secure = false;
boolean uncompress = false;
@@ -178,14 +216,13 @@ class Handler implements Runnable
{
}
else if (request.getURL().startsWith("https://"))
else if (request.getURL().startsWith("https://")&&(secure))
{
System.out.println("Netscape keep-alive bug: " + request.getURL());
return false;
}
else if (! request.getURL().startsWith("http://"))
{
System.out.println("Unknown URL: " + request.getURL());
return false;
}
@@ -193,7 +230,7 @@ class Handler implements Runnable
if (ProxyConfig.proxyKeepAlive)
{
keepAlive = (request.containsHeaderField("Proxy-Connection")
&& request.getHeaderField("Proxy-Connection").equals("Keep-Alive"));
&& request.getHeaderField("Proxy-Connection").equals("Keep-Alive"));
}
/* Filter the request. */
@@ -202,7 +239,7 @@ class Handler implements Runnable
/* None found. Use http or https relay. */
if (secure)
{
http = createHttpsRelay();
http = createHttpsRelay(secureHost,securePort);
}
else
{
@@ -210,7 +247,7 @@ class Handler implements Runnable
}
try
{
http.sendRequest(request);
http.sendRequest(request);
if (http instanceof Http)
{
((Http)http).setTimeout(ProxyConfig.readTimeout);
@@ -257,6 +294,11 @@ class Handler implements Runnable
//filter(reply);
}
if(request.containsHeaderField("Connection")&&(request.getHeaderField("Connection").toLowerCase().equals("keep-alive"))&& reply.containsHeaderField("Connection")
&& reply.getHeaderField("Connection").equals("Keep-Alive")){
keepAlive=true;
}
reply.removeHeaderField("Proxy-Connection");
if (keepAlive && reply.containsHeaderField("Content-length"))
{
@@ -279,9 +321,9 @@ class Handler implements Runnable
if (secure)
if (http instanceof HttpsThrough)
{
Https https = (Https) http;
HttpsThrough https = (HttpsThrough) http;
int timeout = ProxyConfig.readTimeout;
client.write(reply);
@@ -344,20 +386,40 @@ class Handler implements Runnable
return keepAlive;
}
HttpRelay createHttpsRelay() throws IOException
HttpRelay createHttpsRelay(String secureHost,int securePort) throws IOException
{
HttpRelay http;
if (ProxyConfig.useHTTPSProxy)
{
http = new Https(ProxyConfig.httpsProxyHost,
ProxyConfig.httpsProxyPort,
true);
}
else
{
http = new Https(request.getHost(), request.getPort());
}
if((ProxyConfig.httpsMode==ProxyConfig.HTTPS_FILTER)||((ProxyConfig.httpsMode==ProxyConfig.HTTPS_FILTERLIST)&&(ProxyConfig.enabledHttpsServers.contains(secureHost))))
{
http=Https.open(secureHost,securePort,ProxyConfig.useHTTPSProxy);
/*http = new Http(request.getHost(),request.getPort(),ProxyConfig.useHTTPSProxy);
if(ProxyConfig.useHTTPSProxy){
Request connectReq=new Request(client);
connectReq.setCommand("CONNECT");
connectReq.setURL(secureHost+":"+securePort);
connectReq.setProtocol("HTTP/1.1");
try {
http.sendRequest(connectReq);
http.recvReply(connectReq);
} catch (RetryRequestException ex) {
}
}
((Http)http).promoteToClientSSL();*/
}else{
if(ProxyConfig.useHTTPSProxy)
{
http = new HttpsThrough(ProxyConfig.httpsProxyHost,
ProxyConfig.httpsProxyPort,
true);
}else{
http = new HttpsThrough(secureHost,securePort);
}
}
return http;
}
@@ -439,7 +501,7 @@ void processContent(boolean uncompress) throws IOException
if (in == null)
{
System.out.println("No inputstream");
return;
}
else if (uncompress)
@@ -617,13 +679,6 @@ void processContent(boolean uncompress) throws IOException
out.flush();
if (DEBUG)
{
System.out.println(currentLength + " bytes processed in "
+ ((System.currentTimeMillis() - start)
/ 1000.0) + " seconds "
+ ((int)bytesPerSecond / 1024) + " kB/s");
}
}
/**
@@ -679,12 +734,6 @@ void processContent(boolean uncompress) throws IOException
}
out.flush();
if (DEBUG)
{
System.out.println(currentLength + " bytes processed in "
+ ((System.currentTimeMillis() - start) / 1000.0) + " seconds "
+ ((int)bytesPerSecond / 1024) + " kB/s");
}
}

View File

@@ -8,7 +8,6 @@ import java.util.Vector;
class Http extends HttpConnection
{
static final boolean DEBUG = false; /* enable lots of debug output */
/* XXX - more than 1 should work now. */
static final int MAX_PENDING_REQUESTS = 1;
@@ -25,12 +24,12 @@ class Http extends HttpConnection
long idle = 0;
Vector queue = new Vector();
Http(String host, int port) throws IOException
public Http(String host, int port) throws IOException
{
this(host, port, false);
}
Http(String host, int port, boolean isProxy) throws IOException
public Http(String host, int port, boolean isProxy) throws IOException
{
super(host, port);
this.host = host;
@@ -38,7 +37,7 @@ class Http extends HttpConnection
this.proxy = isProxy;
}
Http(String host, int port, boolean isProxy,Socket sock) throws IOException
public Http(String host, int port, boolean isProxy,Socket sock) throws IOException
{
super(sock);
this.host = host;
@@ -53,14 +52,13 @@ class Http extends HttpConnection
try
{
send(request);
send(request);
}
catch (IOException e)
{
if (persistent)
{
persistent = false;
if (DEBUG) System.out.println("RETRY SEND " + request.getURL());
throw new RetryRequestException();
}
throw e;
@@ -83,7 +81,6 @@ class Http extends HttpConnection
if (closed)
{
if (DEBUG) System.out.println("RETRY CLOSED " + request.getURL());
throw new RetryRequestException();
}
@@ -96,7 +93,6 @@ class Http extends HttpConnection
if (persistent)
{
persistent = false;
if (DEBUG) System.out.println("RETRY RECV " + request.getURL());
throw new RetryRequestException();
}
throw e;
@@ -106,8 +102,6 @@ class Http extends HttpConnection
public void reallyClose()
{
persistent = false;
if (DEBUG)
System.out.println("REALLY CLOSE " + this);
close();
}
@@ -127,24 +121,21 @@ class Http extends HttpConnection
if (queue.size() > 0)
{
queue.removeElementAt(0);
if (DEBUG)
{
if (persistent)
System.out.println("DONE " + this);
else
System.out.println("CLOSE " + this);
}
notify();
}
}
private void send(Request request) throws IOException
{
if (DEBUG) System.out.println("SEND " + request.getURL());
/* Prepare HTTP/1.1 request */
request.removeHeaderField("Proxy-Connection");
request.setHeaderField("Connection", "open");
if(request.containsHeaderField("Connection")&&(request.getHeaderField("Connection").toLowerCase().equals("keep-alive"))){
//request.removeHeaderField("Connection");
}else{
request.setHeaderField("Connection", "open");
}
if (!request.containsHeaderField("Host"))
{
request.setHeaderField("Host", request.getHost());
@@ -180,8 +171,7 @@ class Http extends HttpConnection
String conn = reply.getHeaderField("Connection");
if (DEBUG) System.out.println("RECV " + reply.statusLine);
if (reply.containsHeaderField("Connection")
&& reply.getHeaderField("Connection").equals("close"))
{
@@ -205,12 +195,12 @@ class Http extends HttpConnection
return reply;
}
private boolean isBusy()
protected boolean isBusy()
{
return queue.size() >= MAX_PENDING_REQUESTS;
}
private boolean isPersistent()
protected boolean isPersistent()
{
return persistent;
}
@@ -269,7 +259,6 @@ class Http extends HttpConnection
Http http = (Http) v.elementAt(i);
if (http.idle > 0 && now - http.idle > 30000) /* 30 seconds */
{
if (DEBUG) System.out.println("IDLE " + http);
http.persistent = false;
http.close();
}
@@ -301,18 +290,15 @@ class Http extends HttpConnection
if (http != null)
{
http.idle = 0;
if (DEBUG) System.out.println("REUSE " + http);
http.idle = 0;
}
}
}
if (http == null)
{
if (DEBUG) System.out.println("OPENING " + host + ":" + port);
http = new Http(host, port, isProxy);
if (DEBUG) System.out.println("OPENED " + http);
cacheInsert(host, port, http);
cacheInsert(host, port, http);
}
return http;

View File

@@ -1,39 +1,165 @@
package com.jpexs.proxy;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
class Https extends HttpConnection {
/**
*
* @author JPEXS
*/
public class Https extends Http {
/* XXX - more than 1 should work now. */
static final int MAX_PENDING_REQUESTS = 1;
boolean proxy = false;
static Hashtable cache = new Hashtable(33);
private static Object httpLock = new Object();
Https(String host, int port) throws IOException {
super(host, port);
}
public Https(String host, int port) throws IOException
{
this(host, port, false);
}
Https(String host, int port, boolean isProxy) throws IOException {
this(host, port);
proxy = isProxy;
}
public Https(String host, int port, boolean isProxy) throws IOException
{
super(host, port,isProxy);
if(isProxy){
Request connectReq=new Request(null);
connectReq.setCommand("CONNECT");
connectReq.setURL(host+":"+port);
connectReq.setProtocol("HTTP/1.1");
try {
sendRequest(connectReq);
recvReply(connectReq);
} catch (RetryRequestException ex) {
public void sendRequest(Request request)
throws IOException, RetryRequestException {
if (proxy) {
super.sendRequest(request);
} else {
/* nothing */
}
}
}
}
promoteToClientSSL();
}
public Reply recvReply(Request request)
throws java.io.IOException, RetryRequestException {
Reply reply = new Reply(getInputStream());
if (proxy) {
reply.read();
} else {
reply.statusLine = "HTTP/1.0 200 Connection established";
reply.setHeaderField("Proxy-agent", ProxyConfig.appName);
}
private static String cacheKey(String host, int port)
{
return host.toLowerCase() + ":" + port;
}
return reply;
}
private static Vector cacheLookup(String host, int port)
{
Vector v = (Vector) cache.get(cacheKey(host, port));
return v;
}
private static boolean cacheContains(Https http)
{
Vector v = (Vector) cache.get(cacheKey(http.host, http.port));
return v != null ? v.contains(http) : false;
}
private static void cacheInsert(String host, int port, Https http)
{
String key = cacheKey(host, port);
Vector v = (Vector) cache.get(key);
if (v == null)
{
v = new Vector();
}
v.addElement(http);
cache.put(key, v);
}
private static void cacheRemove(String host, int port, Https http)
{
Vector v = (Vector) cache.get(cacheKey(host, port));
if (v != null)
{
v.removeElement(http);
if (v.isEmpty())
{
cache.remove(cacheKey(host, port));
}
}
}
private static void cacheClean()
{
long now = System.currentTimeMillis();
Enumeration e = cache.keys();
while (e.hasMoreElements())
{
Vector v = (Vector) cache.get(e.nextElement());
for (int i = 0; i < v.size(); i++)
{
Https http = (Https) v.elementAt(i);
if (http.idle > 0 && now - http.idle > 30000) /* 30 seconds */
{
http.persistent = false;
http.close();
}
}
}
}
static Https open(String host, int port, boolean isProxy)
throws IOException
{
Https http = null;
synchronized (httpLock)
{
Vector v = cacheLookup(host, port);
if (v != null)
{
for (int i = 0; i < v.size(); i++)
{
Https pick = (Https) v.elementAt(i);
/* find an http connection that isn't busy */
if (pick.isPersistent() && !pick.isBusy())
{
http = pick;
break;
}
}
if (http != null)
{
http.idle = 0;
}
}
}
if (http == null)
{
http = new Https(host, port, isProxy);
cacheInsert(host, port, http);
}
return http;
}
static Https open(String host, int port) throws IOException
{
return open(host, port, false);
}
static Enumeration enumerate()
{
Vector list = new Vector();
Enumeration e = cache.keys();
while (e.hasMoreElements())
{
Vector v = (Vector) cache.get(e.nextElement());
for (int i = 0; i < v.size(); i++)
{
list.addElement(v.elementAt(i));
}
}
return list.elements();
}
static synchronized void clean()
{
cacheClean();
}
}

View File

@@ -0,0 +1,39 @@
package com.jpexs.proxy;
import java.io.IOException;
class HttpsThrough extends HttpConnection {
boolean proxy = false;
HttpsThrough(String host, int port) throws IOException {
super(host, port);
}
HttpsThrough(String host, int port, boolean isProxy) throws IOException {
this(host, port);
proxy = isProxy;
}
public void sendRequest(Request request)
throws IOException, RetryRequestException {
if (proxy) {
super.sendRequest(request);
} else {
/* nothing */
}
}
public Reply recvReply(Request request)
throws java.io.IOException, RetryRequestException {
Reply reply = new Reply(getInputStream());
if (proxy) {
reply.read();
} else {
reply.statusLine = "HTTP/1.0 200 Connection established";
reply.setHeaderField("Proxy-agent", ProxyConfig.appName);
}
return reply;
}
}

View File

@@ -24,7 +24,7 @@ class Janitor implements Runnable
}
catch (Exception e)
{
e.printStackTrace();
}
for (Enumeration e = cleanable.elements();

View File

@@ -1,181 +0,0 @@
package com.jpexs.proxy;
import java.io.*;
import java.text.*;
import java.util.*;
import java.util.zip.*;
public class LogFile
{
private static SimpleDateFormat format;
private static String zoneString;
private String filename = null;
private long maxLogFileSize;
private int maxLogFileHistory;
static
{
format = new SimpleDateFormat("dd/MMM/yyyy:HH:mm:ss", Locale.US);
format.setTimeZone(TimeZone.getDefault());
zoneString = generateZoneString();
}
public LogFile(String filename)
{
setLogFile(filename);
maxLogFileSize = ProxyConfig.maxLogFileSize;
maxLogFileHistory = ProxyConfig.maxLogFileHistory;
}
public void setLogFile(String filename)
{
this.filename = filename;
}
/**
* calculate the local timezone offset
* for PST this is -0800
*/
private static String generateZoneString()
{
Calendar calendar = Calendar.getInstance();
int offset = calendar.get(Calendar.ZONE_OFFSET)
+ calendar.get(Calendar.DST_OFFSET);
StringBuffer buf = new StringBuffer();
if (offset < 0)
{
buf.append("-");
offset = -offset;
}
int hours = offset/(60 * 60 * 1000);
int mins = (offset%(60 * 60 * 1000)) / (60 * 1000);
if (hours < 10)
buf.append("0");
buf.append(hours);
if (mins < 10)
buf.append("0");
buf.append(mins);
return buf.toString();
}
private void gzip(File src)
{
File dst =new File(src.getAbsolutePath() + ".gz");
FileInputStream in;
GZIPOutputStream out;
byte[] buf = new byte[8192];
int n;
try
{
in = new FileInputStream(src);
out = new GZIPOutputStream(new FileOutputStream(dst), buf.length);
while ((n = in.read(buf)) >= 0)
{
out.write(buf, 0, n);
}
in.close();
out.close();
}
catch (IOException e)
{
System.out.println(e);
}
}
private void rotate(int max)
{
File f;
for (int i = max - 2; i >= 1; i--)
{
f = new File(filename + "." + i + ".gz");
if (f.exists())
{
f.renameTo(new File(filename + "." + (i+1) + ".gz"));
}
}
f = new File(filename + ".0");
if (f.exists())
{
gzip(f);
f = new File(filename + ".0.gz");
f.renameTo(new File(filename + ".1.gz"));
}
f = new File(filename);
f.renameTo(new File(filename + ".0"));
}
public synchronized void log(Request request, Reply reply)
{
int offset;
Date date;
date = new Date();
StringBuffer buf = new StringBuffer();
buf.append(request.getClient().getInetAddress().getHostAddress());
buf.append(" - - "); // ident authuser
buf.append("[");
buf.append(format.format(date));
buf.append(" ");
buf.append(zoneString);
buf.append("] \"");
buf.append(request.getRequest());
buf.append("\" ");
buf.append(reply.getStatusCode());
buf.append(" ");
int length;
try
{
length = Integer.parseInt(reply.getHeaderField("Content-length"));
}
catch (NumberFormatException e)
{
length = 0;
}
buf.append(length);
buf.append("\n");
if (!ProxyConfig.dontLogFilters)
{
for (Enumeration h = request.getLogHeaders();
h != null && h.hasMoreElements(); )
{
String header = (String)h.nextElement();
buf.append("[");
buf.append(header);
buf.append("]\n");
for (Enumeration e = request.getLogEntries(header);
e.hasMoreElements(); )
{
buf.append("* ");
buf.append(e.nextElement().toString());
buf.append("\n");
}
}
}
try
{
File file = new File(filename);
if (file.length() > maxLogFileSize)
{
rotate(maxLogFileHistory);
}
FileOutputStream out = new FileOutputStream(filename, true);
out.write(buf.toString().getBytes());
out.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
}

View File

@@ -16,8 +16,6 @@ public class Main
public static void main(String argv[])
{
List<Replacement> replacements = new ArrayList<Replacement>();
if ((new File(REPLACEMENTSFILE)).exists()) {
try {

View File

@@ -1,5 +1,8 @@
package com.jpexs.proxy;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author JPEXS
@@ -7,8 +10,6 @@ package com.jpexs.proxy;
public class ProxyConfig {
public static boolean dontLogFilters=false;
public static long maxLogFileSize=1024*5;
public static int maxLogFileHistory=500;
public static String appVersion="1.1";
public static String appName="JPProxy";
@@ -19,6 +20,14 @@ public class ProxyConfig {
public static boolean proxyKeepAlive=false;
public static boolean dontUncompress=false;
public static final int HTTPS_PASSTHRU=0;
public static final int HTTPS_FILTER=1;
public static final int HTTPS_FILTERLIST=2;
public static int httpsMode=HTTPS_PASSTHRU;
public static List<String> enabledHttpsServers=new ArrayList<String>();
public static boolean useHTTPSProxy=false;
public static String httpsProxyHost="";
public static int httpsProxyPort=0;

View File

@@ -18,6 +18,7 @@ public class Request extends Message
private Client client = null;
private Hashtable log;
private Vector logHeaders;
public boolean hadKeepalive=false;
Request(Client c)
@@ -64,7 +65,7 @@ public class Request extends Message
}
catch (NumberFormatException e)
{
System.out.println("Malformed or missing " + command + " Content-length");
}
}
}
@@ -115,6 +116,10 @@ public class Request extends Message
this.protocol = protocol;
}
public void addSecureHostToURL(String host){
url="https://"+host+url;
}
public String getHost()
{
String url = getURL();
@@ -124,6 +129,10 @@ public class Request extends Message
{
s = url.substring(7, url.indexOf('/', 7));
}
else if (url.startsWith("https://"))
{
s = url.substring(8, url.indexOf('/', 8));
}
else
{
s = url;
@@ -153,6 +162,11 @@ public class Request extends Message
{
s = url.substring(7, url.indexOf('/', 7));
}
else if (url.startsWith("https://"))
{
s = url.substring(8, url.indexOf('/', 8));
port=443;
}
else
{
s = url;
@@ -172,7 +186,7 @@ public class Request extends Message
}
catch (NumberFormatException e)
{
System.out.println("Invalid port in " + url);
}
}
return port;
@@ -262,4 +276,6 @@ public class Request extends Message
{
return log != null ? ((Vector)log.get(header)).elements() : null;
}
}