[MNG-7132] mirrorOf external:* external:http:* detect only 127.0.01 as local, missing IPv6, 127.x.y.z and other
- Dominant language
- Java
- Stars
- 5.3k
- Forks
- 3.1k
- Avg merge
- 20h 42m
- Merged PRs (30d)
- 297
Description
**[Romain Manni-Bucau](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=romain.manni-bucau)** opened **[MNG-7132](https://issues.apache.org/jira/browse/MNG-7132?redirect=false)** and commented
DefaultMirrorSelector used in org.apache.maven.internal.aether.DefaultRepositorySystemSessionFactory#newRepositorySession does not implement isLocal properly - more exactly it only handles 2 particular cases whereas local can be way more numerous:
1. ipv4 case: 127.x.y.z (test can be has 4 segments separated by a dot and starts with 127.)
2. ipv6 case: starts with 1 and ends with 0 (see java.net.Inet6Address.Inet6AddressHolder#isLoopbackAddress)
3. host case: not sure we want to handle it but except localhost hardcoded string we could parse /etc/hosts (or windows specific location) too to resolve the ip without going through InetAddress - see next point) and use the ip with 1+2 rules.
this can be implemented as string parsing (faster) or reusing [java.net](http://java.net/).InetAddress#isLoopbackAddress (which can fallback in some resolution which can be slow at startup but works better overall and is easier).
---
**Issue Links:**
- [MNG-7116](https://issues.apache.org/jira/browse/MNG-7116) Add support for mirror selector on external:http:*
- [MNG-3461](https://issues.apache.org/jira/browse/MNG-3461) Enhance Mirror definition syntax with external:*
Contributor guide
Assessment
This issue has not been assessed yet.