hanzhe-one opened a new pull request, #7806: URL: https://github.com/apache/shenyu/pull/7806
### What is the purpose of the change Fixes #7804. A discovery upstream could be registered with a bare protocol value such as `"http"`. `Upstream.buildDomain()` defaulted only a blank protocol and concatenated any non-blank value as-is, so the gateway received `http127.0.0.1:8080` and failed with `UnknownHostException` instead of surfacing a configuration problem. ### Brief changelog - Normalize the protocol to a url prefix in `buildDomain()`: blank values still fall back to `http://`, and bare schemes such as `http`, `https:` or `https:/` become `http://` / `https://`. - Apply the same normalization to the explicit-protocol overload used by the websocket plugin, so `ws` becomes `ws://`. - Refactor `buildDomain()` to delegate to the overload instead of duplicating the concatenation. - Add unit tests for bare schemes, partially separated schemes, already valid prefixes, surrounding whitespace, blank protocol, and the explicit-protocol overload. ### Verifying this change - `./mvnw test -pl shenyu-loadbalancer -am` (60 tests in the module, all pass) - `./mvnw checkstyle:check -pl shenyu-loadbalancer` (0 violations) The admin-side registration contract (field validation or normalization when saving a discovery upstream) is intentionally left out of this change to keep the fix scoped to the gateway-side domain construction; it can be handled in a follow-up. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
