fix spacing. add intermediate variables

This commit is contained in:
David Burhans 2015-06-09 08:06:04 -06:00
parent c6e3e12aaf
commit ab3d3bd7b5

View File

@ -133,7 +133,11 @@ namespace WebSocketSharp
var headers = req.Headers;
headers["Upgrade"] = "websocket";
headers["Connection"] = "Upgrade";
bool isDefaultPort = (uri.Port == 80 && uri.Scheme == "ws") || (uri.Port == 443 && uri.Scheme == "wss");
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;