Closed zerodegress closed 3 weeks ago
tempory solution(maybe):
let (_, conn) = awc::Client::builder().finish().ws("ws://127.0.0.1:9090/").set_header(actix_http::header::HOST, "127.0.0.1:9090").connect().await.map_err(|e| {
println!("{:?}", e);
}).unwrap();
Seems like http
uses a non-standard definition of "host" since the .host()
method actually returns the "hostname".
fixed in 5ad92c0062c3ee972005b9c2b0bbb0c2d5d59fbb
Expected Behavior
code like below should perform connection to websocket server correctly
Current Behavior
the server responses 400, here's the wireshark captured![图片](https://github.com/user-attachments/assets/4f253459-5d81-4e4e-a1eb-53be6652ef9e)
Possible Solution
noticed that the upgrade request:![图片](https://github.com/user-attachments/assets/994931c6-c885-4b25-a677-193774c2ed5b)
and the code here in awc ws.rs:![图片](https://github.com/user-attachments/assets/872421ad-ab73-43f3-a6aa-0f5a9194f4e7)
according to mdn, i thought maybe the port should be appended to the host, like this: host: 127.0.0.1:9090
Steps to Reproduce (for bugs)
1.install required dependencies(actix_rt, awc) 2.simply run the code above
Context
trying to connect the rosbridge_server(ros kinetic) in websocket protocol.
Your Environment
rustc -V
):1.79.0