Fix for pull request #115, added the HttpServer (System.Net.IPAddress, int, bool) constructor

This commit is contained in:
sta
2015-07-07 17:31:33 +09:00
parent 4bc2c4d4f0
commit c10c9886ef
3 changed files with 51 additions and 2 deletions

View File

@@ -311,6 +311,8 @@ namespace WebSocketSharp.Net
return null;
var host = uri.Host;
var dns = Uri.CheckHostName (host) == UriHostNameType.Dns;
var port = uri.Port;
var path = HttpUtility.UrlDecode (uri.AbsolutePath);
var pathSlash = path[path.Length - 1] == '/' ? path : path + "/";
@@ -323,7 +325,9 @@ namespace WebSocketSharp.Net
if (ppath.Length < bestLen)
continue;
if (pref.Host != host || pref.Port != port)
var phost = pref.Host;
var pdns = Uri.CheckHostName (phost) == UriHostNameType.Dns;
if ((dns && pdns && phost != host) || pref.Port != port)
continue;
if (path.StartsWith (ppath) || pathSlash.StartsWith (ppath)) {