Merge pull request #135 from davidburhans/master
Port 443 is also a default port and should be excluded from the Host header on WebSocket requests for compatibility reasons
This commit is contained in:
commit
a4cb03f8da
@ -133,7 +133,12 @@ namespace WebSocketSharp
|
|||||||
var headers = req.Headers;
|
var headers = req.Headers;
|
||||||
headers["Upgrade"] = "websocket";
|
headers["Upgrade"] = "websocket";
|
||||||
headers["Connection"] = "Upgrade";
|
headers["Connection"] = "Upgrade";
|
||||||
headers["Host"] = uri.Port == 80 ? uri.DnsSafeHost : uri.Authority;
|
var port = uri.Port;
|
||||||
|
var scheme = uri.Scheme;
|
||||||
|
bool isDefaultPort = (port == 80 && scheme == "ws") || (port == 443 && scheme == "wss");
|
||||||
|
// only include port in host header if it is non-default
|
||||||
|
// https://tools.ietf.org/html/rfc6455#page-17
|
||||||
|
headers["Host"] = isDefaultPort ? uri.DnsSafeHost : uri.Authority;
|
||||||
|
|
||||||
return req;
|
return req;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user