[Mono-dev] HttpListener

Greg Young gregoryyoung1 at gmail.com
Sun Apr 26 13:43:31 UTC 2015


This is the code handling the prefixes its here
https://github.com/mono/mono/blob/master/mcs/class/System/System.Net/EndPointManager.cs#L43

There is quite a bit of odd code around this in general. I understand
much of it is trying to reach compliance with MS but ...

On Sun, Apr 26, 2015 at 4:40 PM, Miguel de Icaza <miguel at xamarin.com> wrote:
> Hello Greg,
>
> Is that in HttpListener, or somewhere else?
>
> Miguel
>
> On Fri, Apr 24, 2015 at 12:41 PM, Greg Young <gregoryyoung1 at gmail.com>
> wrote:
>>
>> Here is some of the code in question:
>>
>> IPAddress addr;
>> if (host == "*")
>>     addr = IPAddress.Any;
>> else if (IPAddress.TryParse(host, out addr) == false){
>>     try {
>>         IPHostEntry iphost = Dns.GetHostByName(host);
>>        if (iphost != null)
>>             addr = iphost.AddressList[0];
>>        else
>>             addr = IPAddress.Any;
>>    } catch {
>>         addr = IPAddress.Any;
>>    }
>> }
>>
>> On Fri, Apr 24, 2015 at 7:29 PM, Greg Young <gregoryyoung1 at gmail.com>
>> wrote:
>> > I have been going through a bunch of this code lately after seeing
>> > many ... interesting behaviours. I understand that much of the derp in
>> > this code is due to not having IIS and MS having an IIS centric API
>> > but wow. Some gems I have found...
>> >
>> > 1) synchronous dns calls being made...
>> > 2) I want to listen on 192.168.0.1:1234 but I want to support a host
>> > header of whateverdomain can't resolve whatever domain then bind
>> > listeners to all ips on machine.
>> > 3) Same as above but dns entry has multiple ips it resovles to [0]
>> > doesnt match see #2
>> > 4) Anything at all to do with elastic ips
>> > 5) Exceptions thrown to calling code with http status codes in them (I
>> > think this is ms legacy but is a pretty biog wtf)
>> > 6) failure parsing ip address says bind all interfaces on machine (huh?)
>> >
>> > Perhaps it makes sense to expose a "Microsoft Http Compatibility
>> > Layer" and then have a "Sane API if you want to use it"
>> >
>> > I dont mind putting some time in on these but is this even worthwhile
>> > or is the plan to just burn this code with fire and move to something
>> > sane in general?
>> >
>> > Cheers,
>> >
>> > Greg
>> > --
>> > Studying for the Turing test
>>
>>
>>
>> --
>> Studying for the Turing test
>> _______________________________________________
>> Mono-devel-list mailing list
>> Mono-devel-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>



-- 
Studying for the Turing test


More information about the Mono-devel-list mailing list