Modified a few for EndPointManager.cs

This commit is contained in:
sta 2015-02-18 17:16:42 +09:00
parent 168c550370
commit 196a316141

View File

@ -87,7 +87,7 @@ namespace WebSocketSharp.Net
if (pref.Path.IndexOf ("//", StringComparison.Ordinal) != -1) if (pref.Path.IndexOf ("//", StringComparison.Ordinal) != -1)
throw new HttpListenerException (400, "Invalid path."); // TODO: Code? throw new HttpListenerException (400, "Invalid path."); // TODO: Code?
// listens on all the interfaces if host name cannot be parsed by IPAddress. // Listens on all the interfaces if host name cannot be parsed by IPAddress.
var epl = getEndPointListener (pref.Host, pref.Port, httpListener, pref.IsSecure); var epl = getEndPointListener (pref.Host, pref.Port, httpListener, pref.IsSecure);
epl.AddPrefix (pref, httpListener); epl.AddPrefix (pref, httpListener);
} }
@ -133,9 +133,7 @@ namespace WebSocketSharp.Net
else if (!IPAddress.TryParse (host, out addr)) { else if (!IPAddress.TryParse (host, out addr)) {
try { try {
var iphost = Dns.GetHostEntry (host); var iphost = Dns.GetHostEntry (host);
addr = iphost != null addr = iphost != null ? iphost.AddressList[0] : IPAddress.Any;
? iphost.AddressList[0]
: IPAddress.Any;
} }
catch { catch {
addr = IPAddress.Any; addr = IPAddress.Any;