summaryrefslogtreecommitdiff
path: root/ext/fetch
AgeCommit message (Collapse)Author
2024-04-29fix(ext/http): ensure signal is created iff requested (#23601)Matt Mastracci
This correctly creates the `AbortSignal` regardless of when we request it. If the signal is requested after the request has completed, the signal is created in the aborted state. Using GC counts, we can see a reduction in object creation: This PR: 440 deno 1.42.4: 1650 deno 1.43.0+b02ffec: 874
2024-04-25perf(ext/http): recover memory for serve and optimize AbortController (#23559)Matt Mastracci
Max rps without a signal is unchanged, however we can drastically reduce memory usage by not creating the signal until needed, and we can optimize the rps in the case where the signal is created. With a quick memory benchmark, it looks like this helps pretty drastically with # of GCs when benchmarking w/wrk: - 1.42.4: 1763 - canary: 1093 - this patch: 874 This branch: ``` Running 10s test @ http://localhost:8080/ 2 threads and 10 connections Thread Stats Avg Stdev Max +/- Stdev Latency 87.33us 439.95us 20.68ms 99.67% Req/Sec 66.70k 6.39k 74.11k 83.66% 1340255 requests in 10.10s, 191.73MB read Requests/sec: 132696.90 Transfer/sec: 18.98MB cpu: Apple M2 Pro runtime: deno 1.43.0 (aarch64-apple-darwin) file:///Users/matt/Documents/scripts/bench_request.js benchmark time (avg) iter/s (min … max) p75 p99 p995 ----------------------------------------------------------------------------------------------- ----------------------------- newRequest 986.5 ns/iter 1,013,682.6 (878.2 ns … 1.18 µs) 1.01 µs 1.18 µs 1.18 µs newAbortController 18 ns/iter 55,541,104.1 (15.6 ns … 42.62 ns) 17.71 ns 25.05 ns 26.27 ns newAbortControllerSignal 18.66 ns/iter 53,578,966.7 (16.49 ns … 32.16 ns) 18.71 ns 25.67 ns 26.39 ns newAbortControllerSignalOnAbort 106.49 ns/iter 9,390,164.9 (97.87 ns … 120.61 ns) 108.6 ns 114.24 ns 115.89 ns newAbortControllerSignalAddEventListener 86.92 ns/iter 11,504,880.2 (81.88 ns … 103.15 ns) 90 ns 98.28 ns 99.55 ns newAbortControllerSignalOnAbortNoListener 3.01 µs/iter 331,964.4 (2.97 µs … 3.1 µs) 3.06 µs 3.1 µs 3.1 µs newAbortControllerSignalOnAbortAbort 3.26 µs/iter 306,662.6 (3.22 µs … 3.36 µs) 3.27 µs 3.36 µs 3.36 µs ``` Latest canary: ``` Running 10s test @ http://localhost:8080/ 2 threads and 10 connections Thread Stats Avg Stdev Max +/- Stdev Latency 72.86us 71.23us 4.47ms 99.05% Req/Sec 64.66k 5.54k 72.48k 82.18% 1299015 requests in 10.10s, 185.83MB read Requests/sec: 128616.02 Transfer/sec: 18.40MB cpu: Apple M2 Pro runtime: deno 1.43.0+bc4aa5f (aarch64-apple-darwin) file:///Users/matt/Documents/scripts/bench_request.js benchmark time (avg) iter/s (min … max) p75 p99 p995 ----------------------------------------------------------------------------------------------- ----------------------------- newRequest 1.25 µs/iter 800,005.2 (1.01 µs … 4.18 µs) 1.16 µs 4.18 µs 4.18 µs newAbortController 18.56 ns/iter 53,868,204.3 (16.04 ns … 38.73 ns) 18.38 ns 26.1 ns 26.63 ns newAbortControllerSignal 18.72 ns/iter 53,430,746.1 (16.13 ns … 36.71 ns) 18.71 ns 26.19 ns 26.98 ns newAbortControllerSignalOnAbort 193.91 ns/iter 5,156,992.4 (184.25 ns … 211.41 ns) 194.96 ns 207.87 ns 209.4 ns newAbortControllerSignalAddEventListener 171.45 ns/iter 5,832,569.2 (153 ns … 182.03 ns) 176.17 ns 180.75 ns 181.05 ns newAbortControllerSignalOnAbortNoListener 3.07 µs/iter 326,263.3 (2.98 µs … 3.17 µs) 3.08 µs 3.17 µs 3.17 µs newAbortControllerSignalOnAbortAbort 3.32 µs/iter 301,344.6 (3.29 µs … 3.4 µs) 3.33 µs 3.4 µs 3.4 µs ```
2024-04-251.43.0 (#23549)denobot
Bumped versions for 1.43.0 Co-authored-by: littledivy <littledivy@users.noreply.github.com>
2024-04-18feat(ext/net): extract TLS key and certificate from interfaces (#23327)Bartek Iwańczuk
Relands #23325
2024-04-16chore: forward v1.42.4 commit to `main` (#23394)Bartek Iwańczuk
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com> Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-04-12chore: forward v1.42.3 release commit to main (#23335)denobot
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-04-11Revert "refactor(ext/net): extract TLS key and certificate from inter… ↵Bartek Iwańczuk
(#23325) …faces (#23296)" This reverts commit e190acbfa8b41f92291e73c405735ba0d7b5b172. Reverting because it broke stable API type declarations. We will reland it for v1.43 with updated interfaces
2024-04-11chore: forward v1.42.2 release commit to main (#23315)denobot
Co-authored-by: Satya Rohith <me@satyarohith.com>
2024-04-09refactor(ext/net): extract TLS key and certificate from interfaces (#23296)Matt Mastracci
Removes the certificate options from all the interfaces and replaces them with a new `TlsCertifiedKeyOptions`. This allows us to centralize the documentation for TLS key management for both client and server, and will allow us to add key object support in the future. Also adds an option `keyFormat` field to the cert/key that must be omitted or set to `pem`. This will allow us to load other format keys in the future `der`, `pfx`, etc. In a future PR, we will add a way to load a certified key object, and we will add another option to `TlsCertifiedKeyOptions` like so: ```ts export interface TlsCertifiedKeyOptions = | TlsCertifiedKeyPem | TlsCertifiedKeyFromFile | TlsCertifiedKeyConnectTls | { key: Deno.CertifiedKey } ```
2024-04-08refactor(ext/tls): use cppgc to deduplicate the tls key loading code (#23289)Matt Mastracci
Pass the certificates and key files as CPPGC objects. Towards #23233
2024-04-01chore: forward v1.42.1 release commit to main (#23162)denobot
This is the release commit being forwarded back to main for 1.42.1 Co-authored-by: littledivy <littledivy@users.noreply.github.com>
2024-03-281.42.0 (#23105)denobot
Bumped versions for 1.42.0 Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-03-25fix(ext/fetch): do not truncate field value in `EventSource` (#22368)ud2
Depends on #22493. Closes #22367.
2024-03-24fix(ext/fetch): make `EventSource` more robust (#22493)ud2
This PR fixes all unhandled rejections and resource leaks found while adding a test for #22368.
2024-03-14chore: Forward 1.41.3 release commit (#22930)Nathan Whitaker
Forward 1.41.3 release commit Co-authored-by: denobot <33910674+denobot@users.noreply.github.com> Co-authored-by: nathanwhit <nathanwhit@users.noreply.github.com>
2024-03-12refactor: add `deno_permissions` crate (#22236)Divy Srivastava
Issue https://github.com/denoland/deno/issues/22222 ![image](https://github.com/denoland/deno/assets/34997667/2af8474b-b919-4519-98ce-9d29bc7829f2) This PR moves `runtime/permissions` code to a upstream crate called `deno_permissions`. The `deno_permissions::PermissionsContainer` is put into the OpState and can be used instead of the current trait-based permissions system. For this PR, I've migrated `deno_fetch` to the new crate but kept the rest of the trait-based system as a wrapper of `deno_permissions` crate. Doing the migration all at once is error prone and hard to review. Comparing incremental compile times for `ext/fetch` on Mac M1: | profile | `cargo build --bin deno` | `cargo plonk build --bin deno` | | --------- | ------------- | ------------------- | | `debug` | 20 s | 0.8s | | `release` | 4 mins 12 s | 1.4s |
2024-03-10chore: replace 'call' to 'execute' in error messages (#22579)Kenta Moriuchi
Since both "call" and "execute" were used in error messages, I replaced them with "execute," which is more used.
2024-03-08chore: forward v1.41.2 release commit to main (#22793)denobot
This is the release commit being forwarded back to main for 1.41.2 Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com> Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-02-29chore: forward v1.41.1 release commit to main (#22643)denobot
Co-authored-by: dsherret <dsherret@users.noreply.github.com>
2024-02-221.41.0 (#22524)denobot
Bumped versions for 1.41.0 Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-02-18BREAKING(unstable): remove `Deno.HttpClient.rid` (#22075)Asher Gomez
As part of ongoing works to make `rid` private. --------- Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-02-18BREAKING: add `Deno.CreateHttpClientOptions.{cert,key}` (#22280)Asher Gomez
This change deprecates `Deno.CreateHttpClientOptions.{certChain,privateKey}` in favour of `Deno.CreateHttpClientOptions.{cert,key}`. Closes #22278 Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-02-15chore: forward v1.40.5 release commit to main (#22424)denobot
This is the release commit being forwarded back to main for 1.40.5 Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-02-08chore: forward v1.40.4 release commit to main (#22345)denobot
This is the release commit being forwarded back to main for 1.40.4 Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-02-01chore: forward v1.40.3 release commit to main (#22220)Divy Srivastava
This is the release commit being forwarded back to main for 1.40.3 Ref https://github.com/denoland/deno/pull/22219
2024-01-29refactor: Use virtul ops module (#22175)Bartek Iwańczuk
Follow up to #22157. This leaves us with 4 usages of `ensureFastOps()` in `deno` itself. There's also about 150 usages of `Deno.core.ops.<op_name>` left as well.
2024-01-26refactor: migrate extensions to virtual ops module (#22135)Bartek Iwańczuk
First pass of migrating away from `Deno.core.ensureFastOps()`. A few "tricky" ones have been left for a follow up.
2024-01-26chore: forward v1.40.2 commit to main (#22133)Bartek Iwańczuk
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com> Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-01-25chore: forward v1.40.1 commit to main (#22107)Bartek Iwańczuk
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com> Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-01-251.40.0 (#22096)denobot
Bumped versions for 1.40.0 Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-01-18chore: upgrade deno_core to 0.247.0 (#21974)Bartek Iwańczuk
2024-01-13chore: forward v1.39.4 release commit to main (#21933)denobot
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-01-12chore: forward v1.39.3 to main (#21915)Bartek Iwańczuk
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com> Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-01-12fix: add EventSource typings (#21908)Leo Kettmeir
Fixes #21691
2024-01-10refactor: use `core.ensureFastOps()` (#21888)Kenta Moriuchi
2024-01-04chore: forward v1.39.2 release commit to main (#21793)Bartek Iwańczuk
2024-01-04fix: strict type check for cross realms (#21669)Kenta Moriuchi
Deno v1.39 introduces `vm.runInNewContext`. This may cause problems when using `Object.prototype.isPrototypeOf` to check built-in types. ```js import vm from "node:vm"; const err = new Error(); const crossErr = vm.runInNewContext(`new Error()`); console.assert( !(crossErr instanceof Error) ); console.assert( Object.getPrototypeOf(err) !== Object.getPrototypeOf(crossErr) ); ``` This PR changes to check using internal slots solves them. --- current: ``` > import vm from "node:vm"; undefined > vm.runInNewContext(`new Error("message")`) Error {} > vm.runInNewContext(`new Date("2018-12-10T02:26:59.002Z")`) Date {} ``` this PR: ``` > import vm from "node:vm"; undefined > vm.runInNewContext(`new Error("message")`) Error: message at <anonymous>:1:1 > vm.runInNewContext(`new Date("2018-12-10T02:26:59.002Z")`) 2018-12-10T02:26:59.002Z ``` --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-01-01chore: update copyright to 2024 (#21753)David Sherret
2023-12-31fix(http_client): Fix Deno.createHttpClient to accept poolIdleTimeout ↵Raashid Anwar
parameter (#21603) Fixed the bug `Deno.createHttpClient` to accept `poolIdleTimeout` parameter. Fixes https://github.com/denoland/deno/issues/21546
2023-12-27refactor: simplify hyper, http, h2 deps (#21715)Bartek Iwańczuk
Main change is that: - "hyper" has been renamed to "hyper_v014" to signal that it's legacy - "hyper1" has been renamed to "hyper" and should be the default
2023-12-27perf: remove opAsync (#21690)Matt Mastracci
`opAsync` requires a lookup by name on each async call. This is a mechanical translation of all opAsync calls to ensureFastOps. The `opAsync` API on Deno.core will be removed at a later time.
2023-12-23chore(ext/node): use BufView natively in http2 (#21688)Matt Mastracci
Node HTTP/2 was using the default h2 `Bytes` datatype when we can be making using of `BufView` like we do in `Deno.serve`. `fetch` and `Deno.serverHttp` can't make use of `BufView` because they are using `reqwest` which is stuck on hyper 0.x at this time.
2023-12-21chore: forward v1.39.1 commit to main (#21667) (#21671)Bartek Iwańczuk
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com> Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2023-12-131.39.0 (#21560)denobot
Bumped versions for 1.39.0 Please ensure: - [x] Target branch is correct (`vX.XX` if a patch release, `main` if minor) - [x] Crate versions are bumped correctly - [x] deno_std version is incremented in the code (see `cli/deno_std.rs`) - [x] Releases.md is updated correctly (think relevancy and remove reverts) To make edits to this PR: ```shell git fetch upstream release_1_39.0 && git checkout -b release_1_39.0 upstream/release_1_39.0 ``` cc @mmastrac --------- Co-authored-by: mmastrac <mmastrac@users.noreply.github.com> Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-12-07refactor: pull 'core', 'internals', 'primordials' from ES module (#21462)Bartek Iwańczuk
This commit refactors how we access "core", "internals" and "primordials" objects coming from `deno_core`, in our internal JavaScript code. Instead of capturing them from "globalThis.__bootstrap" namespace, we import them from recently added "ext:core/mod.js" file.
2023-12-06feat(ext/fetch): allow `Deno.HttpClient` to be declared with `using` (#21453)Yusuke Tanaka
This commit adds a method of `Symbol.dispose` to the object returned from `Deno.createHttpClient`, so we can make use of [explicit resource management](https://github.com/tc39/proposal-explicit-resource-management) by declaring it with `using`.
2023-12-06chore: forward v1.38.5 release commit to main (#21472)Bartek Iwańczuk
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
2023-12-01refactor: use resourceForReadableStream for fetch (#20217)Matt Mastracci
Switch `ext/fetch` over to `resourceForReadableStream` to simplify and unify implementation with `ext/serve`. This allows us to work in Rust with resources only. Two additional changes made to `resourceForReadableStream` were required: - Add an optional length to `resourceForReadableStream` which translates to `size_hint` - Fix a bug where writing to a closed stream that was full would panic
2023-11-30chore: forward v1.38.4 release commit to main (#21400)Bartek Iwańczuk
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
2023-11-24chore: forward v1.38.3 release commit to main (#21320)denobot