Repository: denoland/deno
Pull request: fix(ext/fetch): update h2 to fix sending a PROTOCOL_ERROR instead of REFUSED_STREAM when receiving oversized headers

Fixes #26490

Related PR in h2 https://github.com/hyperium/h2/pull/792  
Related release of h2 https://github.com/hyperium/h2/releases/tag/v0.4.6

No test case, as the changes don't affect deno's code directly and I haven't fully grasped why the promise never resolved. The following script can be used to test manually

```ts
// blocks with h2<0.4.6. fails with h2>=0.4.6.
await fetch("https://finance.yahoo.com/currencies/", {
      headers: {
        "User-Agent":
          "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
      },
    });
```

new output

```
error: Uncaught (in promise) TypeError: error sending request from -snip- for https://finance.yahoo.com/markets/currencies/ (188.125.94.206:443): client error (SendRequest): http2 error: stream error detected: unspecific protocol error detected
     await fetch("https://finance.yahoo.com/markets/currencies/", {
     ^
    at mainFetch (ext:deno_fetch/26_fetch.js:202:11)
    at eventLoopTick (ext:core/01_core.js:175:7)
    at async fetch (ext:deno_fetch/26_fetch.js:454:11)
    at async request.ts:1:6
Caused by: Error: stream error detected: unspecific protocol error detected
    at mainFetch (ext:deno_fetch/26_fetch.js:202:43)
    at eventLoopTick (ext:core/01_core.js:175:7)
    at async fetch (ext:deno_fetch/26_fetch.js:454:11)
    at async request.ts:1:6
```

This error message is not very helpful, see #26490 for node's output, which explains what went wrong.  

- Do we want to open a new issue to try to improve the error message? (Reported error is `hyper_util::client::legacy::Error(SendRequest, hyper::Error(Http2, Error { kind: Reset(StreamId(1), PROTOCOL_ERROR, Library) }))`, might be non-trivial)
- Does deno have a flag akin to node's `--max-http-header-size` which would allow the request to finish successfully? Related #21047 @littledivy 

Changed files:
filename: Cargo.lock
patch: @@ -347,6 +347,12 @@ dependencies = [
  "pin-project-lite",
 ]
 
+[[package]]
+name = "atomic-waker"
+version = "1.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
+
 [[package]]
 name = "auto_impl"
 version = "1.2.0"
@@ -1706,7 +1712,7 @@ dependencies = [
  "dyn-clone",
  "error_reporter",
  "fast-socks5",
- "h2 0.4.4",
+ "h2 0.4.7",
  "hickory-resolver",
  "http 1.1.0",
  "http-body-util",
@@ -2061,7 +2067,7 @@ dependencies = [
  "elliptic-curve",
  "errno",
  "faster-hex",
- "h2 0.4.4",
+ "h2 0.4.7",
  "hkdf",
  "http 1.1.0",
  "http-body-util",
@@ -2591,7 +2597,7 @@ dependencies = [
  "deno_permissions",
  "deno_tls",
  "fastwebsockets",
- "h2 0.4.4",
+ "h2 0.4.7",
  "http 1.1.0",
  "http-body-util",
  "hyper 1.4.1",
@@ -3851,15 +3857,15 @@ dependencies = [
 
 [[package]]
 name = "h2"
-version = "0.4.4"
+version = "0.4.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "816ec7294445779408f36fe57bc5b7fc1cf59664059096c65f905c1c61f58069"
+checksum = "ccae279728d634d083c00f6099cb58f01cc99c145b84b8be2f6c74618d79922e"
 dependencies = [
+ "atomic-waker",
  "bytes",
  "fnv",
  "futures-core",
  "futures-sink",
- "futures-util",
  "http 1.1.0",
  "indexmap 2.3.0",
  "slab",
@@ -4231,7 +4237,7 @@ dependencies = [
  "bytes",
  "futures-channel",
  "futures-util",
- "h2 0.4.4",
+ "h2 0.4.7",
  "http 1.1.0",
  "http-body 1.0.0",
  "httparse",
@@ -6443,7 +6449,7 @@ dependencies = [
  "bytes",
  "futures-core",
  "futures-util",
- "h2 0.4.4",
+ "h2 0.4.7",
  "http 1.1.0",
  "http-body 1.0.0",
  "http-body-util",
@@ -7984,7 +7990,7 @@ dependencies = [
  "flate2",
  "futures",
  "glob",
- "h2 0.4.4",
+ "h2 0.4.7",
  "http 1.1.0",
  "http-body-util",
  "hyper 1.4.1",
@@ -8278,7 +8284,7 @@ dependencies = [
  "axum",
  "base64 0.22.1",
  "bytes",
- "h2 0.4.4",
+ "h2 0.4.7",
  "http 1.1.0",
  "http-body 1.0.0",
  "http-body-util",

filename: Cargo.toml
patch: @@ -142,7 +142,7 @@ flate2 = { version = "1.0.30", default-features = false }
 fs3 = "0.5.0"
 futures = "0.3.21"
 glob = "0.3.1"
-h2 = "0.4.4"
+h2 = "0.4.6"
 hickory-resolver = { version = "0.25.0-alpha.4", features = ["tokio-runtime", "serde"] }
 http = "1.0"
 http-body = "1.0"