mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
Fix ports when connecting to 80/443 from non-80/443 host
This commit is contained in:
10
lib/url.js
10
lib/url.js
@@ -51,9 +51,13 @@ function url(uri, loc){
|
||||
}
|
||||
|
||||
// make sure we treat `localhost:80` and `localhost` equally
|
||||
if ((/(http|ws)/.test(obj.protocol) && 80 == obj.port) ||
|
||||
(/(http|ws)s/.test(obj.protocol) && 443 == obj.port)) {
|
||||
delete obj.port;
|
||||
if (null == obj.port) {
|
||||
if (/^(http|ws):$/.test(obj.protocol)) {
|
||||
obj.port = 80;
|
||||
}
|
||||
else if (/^(http|ws)s:$/.test(obj.protocol)) {
|
||||
obj.port = 443;
|
||||
}
|
||||
}
|
||||
|
||||
obj.path = obj.path || '/';
|
||||
|
||||
Reference in New Issue
Block a user