Skip to content
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

Support for IPv6 addresses #53

Closed
gh0st42 opened this issue Mar 11, 2020 · 1 comment · Fixed by #54
Closed

Support for IPv6 addresses #53

gh0st42 opened this issue Mar 11, 2020 · 1 comment · Fixed by #54

Comments

@gh0st42
Copy link

gh0st42 commented Mar 11, 2020

While switching my code from IPv4 only to mixed mode as well as IPv6 only mode, I encountered a strange bug in attohttpc.

At first, I thought it would be as easy as replacing strings such as "http://127.0.0.1:3000/fancy_rest" with "http://[::1]:3000/fancy_rest". The latter works in my browser and in curl. Even the url crate can parse it correctly.

Just when I use attohttpc I get the following error on Linux:

Error(Io(Custom { kind: Other, error: "failed to lookup address information: Name or service not known" }))

on other systems it might also be displayed like the following:

Error(Io(Custom { kind: Other, error: "failed to lookup address information: Temporary failure in name resolution" })) 

Probably trying to interpret [::1] as a hostname instead of an IpAddr.

Unfortunately, attohttpc is not yet available on the rust playground, otherwise, I would have shown a minimal example there.

And totally unrelated: thank you for providing a pretty neat, slim and efficient http client library without async+await :D

@adamreichold
Copy link
Contributor

adamreichold commented Mar 11, 2020

I think the problem is that Ipv6Addr::from_str does not parse the [...] notation, but we use Url::host_str which hands out this notation instead of using Url::host which gives either an already parsed address or a domain name. Will prepare an MR to switch us to Url::host...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants