resolver: add ValidateTargetURI for target URI validation - #9247
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #9247 +/- ##
==========================================
- Coverage 83.27% 83.26% -0.01%
==========================================
Files 421 422 +1
Lines 34084 34096 +12
==========================================
+ Hits 28382 28390 +8
- Misses 4273 4274 +1
- Partials 1429 1432 +3
🚀 New features to boost your workflow:
|
|
@hugehoo : Could you please also update the callsites that you plan to change to use this helper. I think we got stuck the last time around when we got to that part. So, I don't want to add a utility without changing the callsites and knowing for sure that we have exactly what we need. Thanks for understanding. |
|
@easwars thanks for review! I've updated the callsites to use this helper, along with their tests:
The helper now applies the default-scheme fallback for targets that don't parse as authority-form URIs, while still rejecting authority-form URIs ( |
| "xds_servers": [ | ||
| { | ||
| "server_uri": "ipv4:///127.0.0.1:443", | ||
| "server_uri": "passthrough:///127.0.0.1:443", |
There was a problem hiding this comment.
updated scheme to passthrough from ipv4 as server_uri validation added.
Changes
net/url.Parse, andresolver.Get).Scope
Testing
scheme:///endpoint) and opaque form (scheme:endpoint)url.Parsecanonicalizes the scheme to lowercase per RFC 3986 §3.1, so the case difference does not surface at the registry lookup; the test pins this behavior.host:portwithout a scheme, which is parsed as an unregistered scheme and so the common misconfiguration surfaces cleanly.RELEASE NOTES: none