-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EmbedIO Dual-Stack Localhost Listener Causes Empty Replies #576
Comments
So, finally came back to this and think I figured out the problem. When binding to Because, however, we are also registering to As a result, the server steps through (Of note, while exploring this, I came across issue #165 which had a similar comment - binding to As an experiment, I wrote a (very quick and dirty) patch that changed the behavior of The (Edit: The above patch diverges from Mono's behavior, which I suspect is not a desired change. Would it make sense to open this issue with the Mono team directly? As far as I can tell from Mono's code, they'd have the same problem - setting prefixes to As for why all this came up in the first place: browsers are problematic. Despite the fact that Windows is usually pretty consistent (ha) about returning DNS records for |
Updates EndPointManager to bind to *all* returned DNS records for hostname-based prefixes, not just the first one. This does diverge from expected Mono behavior, but should better match that of `Http.sys`. Fixes unosquare#576.
Describe the bug
When using
HttpListenerMode.EmbedIO
and explicitly listening on both IPv4 (127.0.0.1
) and IPv6 ([::1]
) interfaces in addition tolocalhost
proper, HTTP calls tolocalhost
may fail. However, appropriately restoringHost
may cause connections to succeed again.It appears as though when
localhost
is resolved to127.0.0.1
by the system's DNS, EmbedIO is unable to properly send back a response.To Reproduce
The following code was sufficient as an MCVE on my system:
With the above code, various
curl
commands were executed, each with different successes:When using cURL's verbose mode:
Notably, if resolution is forced to IPv6, everything works as intended:
Expected behavior
EmbedIO should behave properly when a request is made to
localhost
when IPv4 is forced.Screenshots
Wireshark logs from a failed request to
localhost
:Desktop:
Additional context
If
WithUrlPrefixes
is set to solelyhttp://localhost
, EmbedIO doesn't even listen on127.0.0.1
, which may be related (and honestly an easier way to tackle this problem?). My intent for listening to the trifecta was to handle dual-stack systems as easily as possible and not have to rely on systems behaving in odd ways. This may additionally be caused by some odd configuration specific to my system, but I have had a few of my own users confirm this issue in the past as well so I suspect it may be a bit more endemic.This problem does not exist when using
HttpListenerMode.Microsoft
, and binding tohttp://localhost
is enough to handle both IPv4 and IPv6 traffic. Ideally, however, I would not need to use the Microsoft listener, as it has caused other issues in the past.The text was updated successfully, but these errors were encountered: