summaryrefslogtreecommitdiff
path: root/ext/http
AgeCommit message (Collapse)Author
2024-11-18feat(ext/http): Make http server parameters configurable (#26785)Yusuke Tanaka
This commit makes http server parameters configurable on the extension initialization via two callbacks users can provide. The main motivation behind this change is to allow `deno_http` users to tune the HTTP/2 server to suit their needs, although Deno CLI users will not benefit from it as no JavaScript interface is exposed to set these parameters currently. It is up to users whether to provide hook functions. If not provided, the default configuration from hyper crate will be used.
2024-11-13feat: OpenTelemetry Tracing API and Exporting (#26710)snek
Initial import of OTEL code supporting tracing. Metrics soon to come. Implements APIs for https://jsr.io/@deno/otel so that code using OpenTelemetry.js just works tm. There is still a lot of work to do with configuration and adding built-in tracing to core APIs, which will come in followup PRs. --------- Co-authored-by: Luca Casonato <hello@lcas.dev>
2024-11-12fix(ext/http): prefer brotli for `accept-encoding: gzip, deflate, br, zstd` ↵Satya Rohith
(#26814) Closes https://github.com/denoland/deno/issues/26813
2024-11-10chore: forward v2.0.6 release commit to main (#26804)denobot
This is the release commit being forwarded back to main for 2.0.6 Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com> Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-11-08feat(ext/http): abort event when request is cancelled (#26781)Divy Srivastava
```js Deno.serve(async (req) => { const { promise, resolve } = Promise.withResolvers<void>(); req.signal.addEventListener("abort", () => { resolve(); }); await promise; return new Response("Ok"); }); ```
2024-11-07feat(ext/http): abort signal when request is cancelled (#26761)Divy Srivastava
Closes https://github.com/denoland/deno/issues/21653
2024-11-06chore: forward v2.0.5 release commit to main (#26755)denobot
This is the release commit being forwarded back to main for 2.0.5 Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-10-30chore: forward v2.0.4 release commit to main (#26636)denobot
This is the release commit being forwarded back to main for 2.0.4 Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-10-25chore: forward v2.0.3 commit to main (#26535)Bartek Iwańczuk
Forwarding v2.0.3 commit to `main` Co-authored-by: denobot <33910674+denobot@users.noreply.github.com> Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-10-18refactor(ext/http): use concrete error types (#26377)Leo Kettmeir
2024-10-18refactor(ext/websocket): use concrete error type (#26226)Leo Kettmeir
2024-10-18chore: forward v2.0.2 release commit to main (#26376)denobot
This is the release commit being forwarded back to main for 2.0.2 Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-10-17fix(net): don't try to set nodelay on upgrade streams (#26342)Nathan Whitaker
Fixes https://github.com/denoland/deno/issues/26341. We try to call `op_set_nodelay` on an `UpgradeStream`, which doesn't support that operation.
2024-10-16chore: forward v2.0.1 release commit to main (#26338)denobot
This is the release commit being forwarded back to main for 2.0.1 Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-10-16perf(http): make heap allocation for path conditional (#26289)David Sherret
Code: ```js Deno.serve({ port: 8085 }, request => { return new Response(request.url); }); ``` Before: ``` % wrk -d60s http://localhost:8085/path/testing\?testing=5 Running 1m test @ http://localhost:8085/path/testing?testing=5 2 threads and 10 connections Thread Stats Avg Stdev Max +/- Stdev Latency 56.01us 18.34us 3.28ms 93.84% Req/Sec 81.80k 3.13k 88.26k 90.77% 9783713 requests in 1.00m, 1.67GB read Requests/sec: 162789.89 Transfer/sec: 28.41MB ``` After: ``` % wrk -d60s http://localhost:8085/path/testing\?testing=5 Running 1m test @ http://localhost:8085/path/testing?testing=5 2 threads and 10 connections Thread Stats Avg Stdev Max +/- Stdev Latency 55.44us 15.20us 2.42ms 90.41% Req/Sec 82.71k 2.92k 88.10k 89.93% 9892916 requests in 1.00m, 1.69GB read Requests/sec: 164607.06 Transfer/sec: 28.73MB ```
2024-10-14perf(http): avoid clone getting request method and url (#26250)David Sherret
2024-10-082.0.0 (#26063)denobot
Bumped versions for 2.0.0 Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-10-02chore: release deno_* crates (#25987)denobot
Testing once again if the crates are being properly released. --------- Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-10-02chore: release deno_* crates (#25976)denobot
Test run before Deno 2.0 release to make sure that the publishing process passes correctly. --------- Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-09-18refactor(ext): align error messages (#25496)Ian Bull
Aligns the error messages in the ext/http and a few messages in the ext/fetch folder to be in-line with the Deno style guide. This change-set also removes some unnecessary checks in the 00_serve.ts. These options were recently removed, so it doesn't make sense to check for them anymore. https://github.com/denoland/deno/issues/25269
2024-09-18fix(ext/http): gracefully handle Response.error responses (#25712)Luca Casonato
Fixes #14371
2024-09-14feat: print `Listening on` messages on stderr instead of stdout (#25491)Marvin Hagemeister
Fixes https://github.com/denoland/deno/issues/25114 --------- Signed-off-by: Leo Kettmeir <crowlkats@toaxl.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: crowlkats <crowlkats@toaxl.com> Co-authored-by: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com>
2024-09-12feat(serve): Support second parameter in deno serve (#25606)Nathan Whitaker
Closes #24099
2024-09-12feat: stabilize `Deno.createHttpClient()` (#25569)Asher Gomez
Closes #25518
2024-09-06fix: invalid ipv6 hostname on `deno serve` (#25482)Marvin Hagemeister
This PR fixes an invalid URL being printed when running `deno serve` Before: invalid URL ```sh $ deno serve --host localhost deno serve: Listening on http://::1:8000/ ``` After: valid URL ```sh $ deno serve --host localhost deno serve: Listening on http://[::1]:8000/ ```
2024-09-06chore(net): soft-remove `Deno.serveHttp()` (#25451)Asher Gomez
Towards #22079 --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-09-05fix(ext/http): do not set localhost to hostname unnecessarily (#24777)Yoshiya Hinosawa
This commit changes when to cause the hostname substition of `0.0.0.0` -> `localhost`. Currently we substitute `localhost` to the hostname on windows before calling `options.onListen`, which prevents the users to do more advanced thing using hostname string like https://github.com/denoland/std/issues/5558. This PR changes it not to substitute it when the user provide `onListen` callback. closes #24776 unblocks https://github.com/denoland/std/issues/5558
2024-09-04chore: forward v1.46.3 release commit to main (#25425)denobot
This is the release commit being forwarded back to main for 1.46.3
2024-08-29chore: forward v1.46.2 release commit to main (#25296)denobot
This is the release commit being forwarded back to main for 1.46.2
2024-08-28refactor(ext): throw new error instead of throw error (#25272)Ian Bull
To ensure consistency across the codebase, this commit refactors the code in the `ext` folder to use `throw new Error`` instead of `throw` for throwing errors. Fixes https://github.com/denoland/deno/issues/25270
2024-08-22chore: forward v1.46.1 release commit to main (#25155)denobot
2024-08-221.46.0 (#25139)denobot
Bumped versions for 1.46.0 Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-08-21feat: Upgrade V8 to 12.9 (#25138)Bartek Iwańczuk
2024-08-20chore: enable no-console dlint rule (#25113)David Sherret
2024-08-14feat(serve): Opt-in parallelism for `deno serve` (#24920)Nathan Whitaker
Adds a `parallel` flag to `deno serve`. When present, we spawn multiple workers to parallelize serving requests. ```bash deno serve --parallel main.ts ``` Currently on linux we use `SO_REUSEPORT` and rely on the fact that the kernel will distribute connections in a round-robin manner. On mac and windows, we sort of emulate this by cloning the underlying file descriptor and passing a handle to each worker. The connections will not be guaranteed to be fairly distributed (and in practice almost certainly won't be), but the distribution is still spread enough to provide a significant performance increase. --- (Run on an Macbook Pro with an M3 Max, serving `deno.com` baseline:: ``` ❯ wrk -d 30s -c 125 --latency http://127.0.0.1:8000 Running 30s test @ http://127.0.0.1:8000 2 threads and 125 connections Thread Stats Avg Stdev Max +/- Stdev Latency 239.78ms 13.56ms 330.54ms 79.12% Req/Sec 258.58 35.56 360.00 70.64% Latency Distribution 50% 236.72ms 75% 248.46ms 90% 256.84ms 99% 268.23ms 15458 requests in 30.02s, 2.47GB read Requests/sec: 514.89 Transfer/sec: 84.33MB ``` this PR (`with --parallel` flag) ``` ❯ wrk -d 30s -c 125 --latency http://127.0.0.1:8000 Running 30s test @ http://127.0.0.1:8000 2 threads and 125 connections Thread Stats Avg Stdev Max +/- Stdev Latency 117.40ms 142.84ms 590.45ms 79.07% Req/Sec 1.33k 175.19 1.77k 69.00% Latency Distribution 50% 22.34ms 75% 223.67ms 90% 357.32ms 99% 460.50ms 79636 requests in 30.07s, 12.74GB read Requests/sec: 2647.96 Transfer/sec: 433.71MB ```
2024-08-02perf(ext/http): Reduce size of `ResponseBytesInner` (#24840)Nathan Whitaker
I noticed [`set_response_body`](https://github.com/nathanwhit/deno/blob/ce42f82b5a985e5f1482dff97a7268019a8e79ea/ext/http/service.rs#L439-L443) was unexpectedly hot in profiles, with most of the time being spent in `memmove`. It turns out that `ResponseBytesInner` was _massive_ (5624 bytes), so every time we moved a `ResponseBytesInner` (for instance in `set_response_body`) we were doing a >5kb memmove, which adds up pretty quickly. This PR boxes the two larger variants (the compression streams), shrinking `ResponseBytesInner` to a reasonable 48 bytes. --- Benchmarked with a simple hello world server: ```ts // hello-server.ts Deno.serve((_req) => { return new Response("Hello world"); }); // run with `deno run -A hello-server.ts` // in separate terminal `wrk -d 10s http://127.0.0.1:8000` ``` Main: ``` Running 10s test @ http://127.0.0.1:8000/ 2 threads and 10 connections Thread Stats Avg Stdev Max +/- Stdev Latency 53.39us 9.53us 0.98ms 92.78% Req/Sec 86.57k 3.56k 91.58k 91.09% 1739319 requests in 10.10s, 248.81MB read Requests/sec: 172220.92 Transfer/sec: 24.64MB ``` This PR: ``` Running 10s test @ http://127.0.0.1:8000/ 2 threads and 10 connections Thread Stats Avg Stdev Max +/- Stdev Latency 45.44us 8.49us 0.91ms 90.04% Req/Sec 100.65k 2.26k 102.65k 96.53% 2022296 requests in 10.10s, 289.29MB read Requests/sec: 200226.20 Transfer/sec: 28.64MB ``` So a nice ~15% bump. (With response body compression, the gain is ~10% for gzip and neutral for brotli)
2024-08-01fix(ext/http): correctly consume response body in `Deno.serve` (#24811)Luca Casonato
Prior to this commit, you could return a `Response` created from a string or Uint8Array multiple times. Now you can't do that anymore.
2024-07-31chore: forward v1.45.5 release commit to main (#24818)denobot
2024-07-28fix(http): Adjust hostname display for Windows when using 0.0.0.0 (#24698)Yazan AbdAl-Rahman
Fixes #24687 --------- Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2024-07-26chore: forward v1.45.4 release commit to main (#24754)denobot
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-07-23chore: forward v1.45.3 release commit to main (#24681)denobot
This is the release commit being forwarded back to main for 1.45.3 --------- Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-07-12chore: forward v1.45.2 release commit to main (#24564)denobot
Co-authored-by: dsherret <dsherret@users.noreply.github.com>
2024-07-12chore: forward v1.45.1 release commit to main (#24540)denobot
This is the release commit being forwarded back to main for 1.45.1 Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-07-111.45.0 (#24512)denobot
Bumped versions for 1.45.0 --------- Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-06-20refactor(ext): remove use of `brotli::ffi` (#24214)ud2
2024-06-19chore: forward v1.44.4 release commit to main (#24271)denobot
This is the release commit being forwarded back to main for 1.44.4 Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-06-19chore: forward v1.44.3 release commit to main (#24256)denobot
This is the release commit being forwarded back to main for 1.44.3 Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-06-17fix(ext/http): actually await `goAhead` promise (#24226)Luca Casonato
2024-06-14fix(ext/node): `server.close()` does graceful shutdown (#24184)Divy Srivastava
2024-06-13chore: forward v1.44.2 release commit to main (#24194)denobot
Co-authored-by: nathanwhit <nathanwhit@users.noreply.github.com>