// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if SECURITY_DEP
-
using System.Collections;
using System.Collections.Generic;
namespace System.Net {
static EndPointListener GetEPListener (string host, int port, HttpListener listener, bool secure)
{
IPAddress addr;
- if (IPAddress.TryParse(host, out addr) == false)
+ if (host == "*")
addr = IPAddress.Any;
-
+ else if (IPAddress.TryParse(host, out addr) == false){
+ try {
+#pragma warning disable 618
+ IPHostEntry iphost = Dns.GetHostByName(host);
+#pragma warning restore 618
+ if (iphost != null)
+ addr = iphost.AddressList[0];
+ else
+ addr = IPAddress.Any;
+ } catch {
+ addr = IPAddress.Any;
+ }
+ }
Hashtable p = null; // Dictionary<int, EndPointListener>
if (ip_to_endpoints.ContainsKey (addr)) {
p = (Hashtable) ip_to_endpoints [addr];
if (p.ContainsKey (port)) {
epl = (EndPointListener) p [port];
} else {
- epl = new EndPointListener (addr, port, secure);
+ epl = new EndPointListener (listener, addr, port, secure);
p [port] = epl;
}
}
}
}
-#endif