uuuyuqi opened a new pull request, #16374: URL: https://github.com/apache/dubbo/pull/16374
## What is the purpose of the change? GitHub_issue: #16373 This pull request fixes port-unification protocol detection when provider TLS is configured with `AuthPolicy.NONE`. `AuthPolicy.NONE` means TLS is optional. If a client sends a non-TLS first packet to the port-unification port, the server should continue with plaintext protocol detection. The current `3.3` branch enters the TLS-detection branch, sees that the packet is not TLS, and then does nothing when the auth policy is `NONE`. As a result, plaintext Dubbo detection is skipped and the connection waits until the caller times out. The fix keeps the existing strict-TLS behavior unchanged: - TLS first packet: enable SSL and return. - Non-TLS first packet with required TLS: log, discard data, close the channel, and return. - Non-TLS first packet with `AuthPolicy.NONE`: fall through to plaintext `detectProtocol(...)`. This PR also adds a regression test that provides an optional-TLS test `CertProvider`, sends a Dubbo plaintext first packet, and verifies that the plaintext protocol detector is invoked. Verification: - Before the production fix, the new regression test failed because the detector count was `0` instead of `1`. - `mvn -q -pl dubbo-remoting/dubbo-remoting-netty4 -am -Dtest=NettyPortUnificationServerHandlerTest,PortUnificationServerTest,SslServerTlsHandlerTest -Dsurefire.failIfNoSpecifiedTests=false -DskipITs -DskipIntegrationTests=true -Djacoco.skip=true test` - `mvn -q -pl dubbo-remoting/dubbo-remoting-netty4 -am -DskipTests -DskipIntegrationTests=true -Djacoco.skip=true -Dcheckstyle.skip=false -Dcheckstyle_unix.skip=false -Drat.skip=false verify` - `mvn -q -pl dubbo-remoting/dubbo-remoting-netty4 -am spotless:check` ## Checklist - [x] Make sure there is a [GitHub_issue](https://github.com/apache/dubbo/issues) field for the change (usually before the description, using `GitHub_issue: #123456`). - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exists. If the new feature or significant change is added, please remember to add integration-test in [dubbo-samples](https://github.com/apache/dubbo-samples) project. - [x] Make sure gitHub actions can pass, only after CI passed will we review it. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
