leizhiyuan opened a new issue, #1419: URL: https://github.com/apache/rocketmq-clients/issues/1419
### Before Creating the Bug Report - [x] I found a bug, not just asking a question, which should be created in [GitHub Discussions](https://github.com/apache/rocketmq-clients/discussions). - [x] I have searched the [GitHub Issues](https://github.com/apache/rocketmq-clients/issues) and [GitHub Discussions](https://github.com/apache/rocketmq-clients/discussions) of this repository and believe that this is not a duplicate. - [x] I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ. ### Programming Language of the Client Rust ### Runtime Platform Environment macOS 27 (arm64) ### RocketMQ Version of the Client/Server Client: Rust `rocketmq` 5.0.0, master `a3d1de8b` Server: a managed RocketMQ 5.x service (Tencent Cloud TDMQ for RocketMQ 5), gRPC proxy endpoint ### Run or Compiler Version rustc 1.98.0 ### Describe the Bug An access url with an `http://` or `https://` prefix, as used by the official Rust lite examples, cannot be used: the client fails to connect with a DNS error. **Scenario.** `rust/examples/lite_producer.rs` and `rust/examples/lite_push_consumer.rs` both do: ```rust client_option.set_access_url("http://localhost:8080"); ``` Copying this and replacing the host with a real endpoint makes `Producer::start()` fail: ``` Failed to create session at client.start => failed to connect to peer Context: peer: http://<endpoint>:8080 called: session.create_session Source: transport error Caused by: 0: error trying to connect: dns error ... ``` The same happens for any url copied from a console that shows the endpoint with a scheme. **Root cause.** `Endpoints::from_url` splits the url at the last `:` and keeps everything before it as the host. So the host becomes `http://localhost`, and `Session::build_endpoint` then prefixes it again, producing `http://http://localhost:8080`. **Java behavior.** `Endpoints(String)` strips both prefixes for a single address, and `EndpointsTest` covers it (`testEndpointsWithDomainPortAndHttpPrefix`, `testEndpointsWithDomainPortAndHttpsPrefix`, ...): ```java if (endpoints.startsWith(HTTP_PREFIX)) { endpoints = endpoints.substring(HTTP_PREFIX.length()); } if (endpoints.startsWith(HTTPS_PREFIX)) { endpoints = endpoints.substring(HTTPS_PREFIX.length()); } ``` The prefix is only removed and does not enable TLS. A multi-address endpoint (`a:1;b:2`) is not stripped. ### Steps to Reproduce 1. `client_option.set_access_url("http://<endpoint>:8080")`. 2. `Producer::new(...)?.start().await`. ### What Did You Expect to See? The client connects to `<endpoint>:8080`, as the Java client does, and the official examples work as written. ### What Did You See Instead? A DNS error for the peer `http://<endpoint>:8080`. ### Additional Context --- Tracked in #1412. -- 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]
