Closed Merely-chao closed 6 days ago
do you have reproducible example?
service code
#[web::get("/")]
async fn hello() -> String{
"hello".to_string()
}
#[ntex::main]
async fn main() -> std::io::Result<()> {
std::env::set_var("RUST_LOG", "trace");
env_logger::init();
web::HttpServer::new(|| {
web::App::new()
.service(hello)
})
.bind(("0.0.0.0", 8080))?
.run()
.await
}
service log:
[2024-06-21T02:22:50Z TRACE ntex::http::service] New http connection, peer address Some(192.168.1.137:58874)
[2024-06-21T02:22:50Z DEBUG ntex_io::ioref] : Start timer Seconds(1)
[2024-06-21T02:22:50Z DEBUG ntex_io::timer] : Timer driver does not run, current: 0
[2024-06-21T02:22:50Z TRACE ntex::http::h1::dispatcher] : Trying to read http message
[2024-06-21T02:22:50Z TRACE ntex_io::tasks] : New 234 bytes available, wakeup dispatcher
Request HTTP/1.1 GET:/
headers:
"accept": "*/*"
"cpgrade": "h2c"
"connection": "Upgrade, HTTP2-Settings"
"accept-encoding": "gzip, deflate"
"http2-settings": "AAEAAEAAAAIAAAABAAMAAABkAAQBAAAAAAUAAEAA"
"host": "192.168.1.137:8080"
"user-agent": "python-requests/2.32.3"
and payload None
[2024-06-21T02:22:50Z DEBUG ntex_io::ioref] : Stop timer
[2024-06-21T02:22:50Z TRACE ntex::http::h1::dispatcher] Handler service consumed io, stop
[2024-06-21T02:22:50Z DEBUG ntex::http::h1::dispatcher] IO: Dispatcher is stopped
client: Python
Always waiting for the content to be returned
import requests
url = "http://192.168.1.137:8080"
headers = {
"Connection": "Upgrade, HTTP2-Settings",
"Cpgrade": "h2c",
"http2-settings": "AAEAAEAAAAIAAAABAAMAAABkAAQBAAAAAAUAAEAA"
}
response = requests.get(url,headers=headers)
I see the problem, thanks!
ntex 2.0.2 is released.
one note, "h2c" upgrade is not supported at the moment
Thank you for your time. This framework is great.
https://github.com/ntex-rs/ntex/blob/e0b5284fdd5afbf130d93e73c37289aef84d03da/ntex/src/http/h1/dispatcher.rs#L151 Causing the socket not to close and the content not to return