wwbmmm opened a new pull request, #3767:
URL: https://github.com/apache/brpc/pull/3767

   ### What problem does this PR solve?
   
   Problem Summary:
   
   `ServerOptions.enabled_protocols` is documented as the list of protocols to 
serve, but `Server::BuildAcceptor()` always exempted `http`/`h2` (and 
`rdma_handshake`) from the whitelist. A server configured with 
`enabled_protocols = "baidu_std"` still served the complete HTTP/1 and HTTP/2 
stacks, including builtin services on the main port, without any error or 
warning.
   
   ### What is changed and the side effects?
   
   Changed:
   - The whitelist is now authoritative: when `enabled_protocols` is non-empty, 
only the listed protocols are served. `rdma_handshake` remains always served 
because it only handles the transport level handshake and dispatches no 
request; this is documented explicitly.
   - If builtin services (`has_builtin_services`, true by default) or restful 
services are registered while the whitelist contains neither `http` nor `h2`, 
`Server::Start()` fails with an actionable error instead of leaving their HTTP 
surface in an undefined state.
   - Updated the `ServerOptions.enabled_protocols` comment and 
`docs/en/server.md`, `docs/cn/server.md`.
   - Tests: `test/brpc_server_unittest.cpp` covers a whitelist without http 
rejecting HTTP, a whitelist with http/h2 still serving builtin services, and 
the misconfiguration failures. `test/rdma_test_helper.h` disables builtin 
services since it whitelists only `baidu_std`.
   
   Side effects:
   - Performance effects: none, the change only affects acceptor construction.
   - Breaking backward compatibility: yes. Deployments that relied on the 
undocumented http/h2 exemption must add `http` (or `h2`) to 
`enabled_protocols`, or set `has_builtin_services = false`; `Server::Start()` 
now fails with a message explaining both options instead of silently serving 
HTTP.
   
   Tests run:
   - `build/test/brpc_server_unittest` (all 54 tests), executed from `test/` so 
that cert-relative tests find their files.
   
   ---
   🤖 This PR was automatically created by brpc-oncall


-- 
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]

Reply via email to