[fix][client] PIP-468: V5 client validates serviceUrl scheme#25720
Open
merlimat wants to merge 1 commit intoapache:masterfrom
Open
[fix][client] PIP-468: V5 client validates serviceUrl scheme#25720merlimat wants to merge 1 commit intoapache:masterfrom
merlimat wants to merge 1 commit intoapache:masterfrom
Conversation
The v5 client only speaks the broker binary protocol; passing the admin/web service URL (http:// or https://) used to silently accept the value and then fail far downstream with a cryptic connection error. Validate at configure-time and fail with a message that points to the right URL: - PulsarClientBuilder.serviceUrl() and ConnectionPolicy.proxyServiceUrl must use pulsar:// or pulsar+ssl://. Anything else throws IllegalArgumentException at the setter. - The error message for http:// / https:// specifically calls out the admin-URL confusion and hints at the broker port (6650 / 6651). - API javadoc updated to document the contract and the @throws. - New PulsarClientBuilderV5Test covers accepted forms (single host, TLS, multi-host comma list) and each rejected case (http, https, unknown scheme, null, blank), plus that proxyServiceUrl is validated too.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The v5 client only speaks the broker binary protocol; passing the admin/web service URL (
http://orhttps://) used to silently accept the value and then fail far downstream with a cryptic connection error. This PR validates the URL at configure-time and fails fast with a message that points to the right URL.PulsarClientBuilder.serviceUrl()andConnectionPolicy.proxyServiceUrlmust usepulsar://orpulsar+ssl://. Anything else throwsIllegalArgumentExceptionat the setter.http:///https://specifically calls out the admin-URL confusion and hints at the broker port (6650 / 6651).@throws.Test plan
PulsarClientBuilderV5Testcovers:pulsar://host:port,pulsar+ssl://host:port, multi-host comma list (pulsar://h1:p,h2:p,h3:p)http://(with admin-URL guidance + port hint),https://(with TLS-broker-scheme hint),ws://, null, blankConnectionPolicy.proxyServiceUrlis validated toopulsar-client-v5unit tests pass