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
Fix handling of None and "" as hostnames in trio.socket #277
Comments
So I guess we probably shouldn't special-case So I think we should:
(Fun fact: on Linux |
There's another special case in the sockaddr resolution stuff: |
It looks like basically to fix this we just need to add an I think |
Eh, handling |
It looks like the Python stdlib has a weird behavior:
socket.getaddrinfo(None, 0)
resolves to the wildcard address(es)sock.bind((None, 0))
is an errorsocket.getaddrinfo("", 0)
is an errorsock.bind(("", 0))
binds to the wildcard addressTrio is currently not quite consistent. Trio's
getaddrinfo
matches the stdlib, but forbind
we raise an error with both versions, because we usegetaddrinfo
to validate the user's input, and then if it passes we hand the user's input directly to the stdlibbind
.We should at the least support one way of calling
bind
, and perhaps we should teach both versions to support both behaviors.The text was updated successfully, but these errors were encountered: