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

Improve IPv6 support #315

Closed
wants to merge 1 commit into from

Conversation

Achilleshiel
Copy link
Contributor

This improves the handling of hosts.

This makes the following types of host a valid options:

  • [::1]
  • ::1
  • 192.168.100.1
  • 192.168.100.1:123
  • [::1]:8080
  • example.com
  • example.com:8080

Closes #313

@aler9
Copy link
Member

aler9 commented Jun 17, 2023

Hello, for maintainability reasons my approach is to produce code that is as similar as possible to the standard library. I took a look at net/http, and conversion between URLs and addresses is performed by this single function:

https://cs.opensource.google/go/go/+/refs/tags/go1.20.5:src/net/http/transport.go;l=2747

This was adapted for RTSP and merged in #316. It doesn't support all the host types you listed, in particular, it turned out that this kind of addresses:

http://::1/path

Is not supported by net/http, therefore there's no reason to support it here.

Thanks for providing this contribution that allowed to develop the final patch.

@Achilleshiel
Copy link
Contributor Author

it turned out that this kind of addresses:

http://::1/path

Is not supported by net/http, therefore there's no reason to support it here.

That's correct, as that is not a valid url :). But ::1 is a valid hostname outside of an url.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Raw IPv6 addresses in URI are not properly supported
2 participants