-
Notifications
You must be signed in to change notification settings - Fork 4.6k
grpcutil: add ValidateTargetURI function #8876
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
base: master
Are you sure you want to change the base?
Conversation
Fixes grpc#8747 Add an internal API to validate gRPC target URI strings. The function checks that the target parses as a valid RFC 3986 URI and that a resolver is registered for its scheme. RELEASE NOTES: n/a
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #8876 +/- ##
==========================================
+ Coverage 83.17% 83.25% +0.08%
==========================================
Files 414 415 +1
Lines 32751 32762 +11
==========================================
+ Hits 27241 27277 +36
+ Misses 4091 4078 -13
+ Partials 1419 1407 -12
🚀 New features to boost your workflow:
|
|
Hi @HueCodes, thanks for picking up this issue. To ensure we have a reusable API, we should update existing call sites to use the new implementation. Specifically:
Both of these locations share common behavior:
To handle this, the new function would need to accept a |
|
Thanks for the response! I will work on fixing this today when I am off work. |
|
Agree with the comments by @arjan-bal. Another place where we would have to use the new API is here: grpc-go/internal/xds/bootstrap/bootstrap.go Line 399 in b7b1cce
Currently, that code only verifies that the |
Add ParseTarget that accepts a default scheme parameter and returns *url.URL. This allows callers to use the parsed result and handles the common pattern of falling back to a default scheme. Update clientconn.go and balancer/rls/config.go to use the new function, removing duplicate parsing logic.
ea82c57 to
9c8aa04
Compare
|
Thanks for taking the time to review this. I appreciate it. I addressed the issues:
Let me know if there are any other changes you would like me to make. |
Fixes #8747
Add an internal API to validate gRPC target URI strings. The function
checks that the target parses as a valid RFC 3986 URI and that a
resolver is registered for its scheme.
RELEASE NOTES: n/a