-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fetch()
promise doesn't resolve
#26490
Comments
The steps to reproduce depend on an external service (yahoo). It'd be great if someone could capture the response to replay in locally. When using a |
Your comment about the |
@lucacasonato good call! I tested a bit more, and replacing the |
@littledivy it looks like our tls handling has a bug? |
quick status updated I isolated some of the code for easier debugging. The following function correctly panics in hyper-rustls (hijacked an example with As this function doesn't have any explicit dependencies, I suspect there's some global configuration going on in deno. fn break_me_harder() {
let _ = rustls::crypto::ring::default_provider().install_default();
let mut http_connector = HttpConnector::new_with_resolver(GaiResolver::new());
http_connector.enforce_http(false);
let root_store = rustls::RootCertStore::from_iter(
webpki_roots::TLS_SERVER_ROOTS.iter().cloned(),
);
let tls = rustls::ClientConfig::builder()
// .with_native_roots()
// .unwrap()
.with_root_certificates(root_store)
.with_no_client_auth();
let mut connector_hyper = hyper_rustls::HttpsConnectorBuilder::new()
.with_tls_config(tls)
.https_or_http()
.enable_http1()
.enable_http2()
.wrap_connector(http_connector.clone());
let client =
hyper_util::client::legacy::Client::builder(TokioExecutor::new())
.build(connector_hyper);
let _ = std::thread::spawn(move || {
let mut request: http::Request<http_body_util::Empty<bytes::Bytes>> = http::request::Request::default();
// blocks in deno, causes error in hyper-rustls
*request.uri_mut() = Uri::from_str("https://finance.yahoo.com/markets/currencies/").unwrap();
// passes
// *request.uri_mut() = Uri::from_str("https://www.google.com").unwrap();
request.headers_mut().append("User-Agent", HeaderValue::from_static("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"));
let rt = tokio::runtime::Runtime::new().unwrap();
dbg!(">block");
// this unwrap should fail because hyper notices an error
// blocks in deno
let r = rt.block_on(client.request(request)).unwrap();
dbg!("<block");
r
})
.join()
.unwrap();
panic!("request finished");
} output in hyper-rustls (expected)
output in deno (bad)
|
We should be using https://github.com/denoland/rustls-tokio-stream, not hyper-rustls - probably the bug is in https://github.com/denoland/rustls-tokio-stream |
to get hyperium/h2#792 which fixes promises not being resolved when the server sends large headers denoland#26490
@lucacasonato Turned out not to be a TLS issue, and unrelated to rustls-tokio-stream, so all good on that! See linked PR for details. Found the bug by reducing deno to the aforementioned function |
to get hyperium/h2#792 which fixes promises not being resolved when the server sends large headers denoland#26490
Version: Deno 2.0.2
Run the following
fetch()
requestThe request won't finish.
Node 22.10.0 finishes the request with an error
When running node with
node --max-http-header-size 5000000
, the promises resolves.The text was updated successfully, but these errors were encountered: