fix default port detection

This commit is contained in:
Naoyuki Kanezawa
2015-01-25 05:43:27 +09:00
parent db8528e790
commit 2dc81e00d6
3 changed files with 25 additions and 43 deletions

View File

@@ -103,7 +103,7 @@ public class Socket extends Emitter {
private boolean timestampRequests;
private boolean upgrading;
private boolean rememberUpgrade;
private int port;
/*package*/ int port;
private int policyPort;
private int prevBufferLen;
private long pingInterval;
@@ -176,6 +176,9 @@ public class Socket extends Emitter {
}
if (pieces.length > 1) {
opts.port = Integer.parseInt(pieces[pieces.length - 1]);
} else if (opts.port == -1) {
// if no port is specified manually, use the protocol default
opts.port = this.secure ? 443 : 80;
}
}
}
@@ -808,6 +811,8 @@ public class Socket extends Emitter {
filteredUpgrades.add(upgrade);
}
}
return filteredUpgrades;
}

View File

@@ -140,8 +140,8 @@ public abstract class Transport extends Emitter {
public String timestampParam;
public boolean secure;
public boolean timestampRequests;
public int port;
public int policyPort;
public int port = -1;
public int policyPort = -1;
public Map<String, String> query;
public SSLContext sslContext;
protected Socket socket;