mash-graz
16dbbfa64a
fix(node:http) Export validateHeaderName
and validateHeaderValue
functions ( #22616 )
...
Modify `_http_outgoing.ts` to support the extended signature of
`validateHeaderName()` used since node v19.5.0/v18.14.0 by adding the
`label` parameter. (see:
https://nodejs.org/api/http.html#httpvalidateheadernamename-label )
Making both validation functions accessible as public exports of
`node:http`
Fixes: #22614
2024-03-10 22:46:05 +00:00
Igor Zinkovsky
dc16c996dd
fix(ext/node) add node http methods ( #22630 )
...
fixes #22627
This PR fixes a node compat issue that is preventing `serverless-http`
and `serverless-express` npm modules from working with Deno. These
modules are useful for running apps on AWS Lambda (and other serverless
infra).
---------
Signed-off-by: Igor Zinkovsky <igor@deno.com>
2024-02-29 17:56:04 -05:00
Asher Gomez
7abd72a80f
BREAKING(unstable): remove Deno.HttpClient.rid
( #22075 )
...
As part of ongoing works to make `rid` private.
---------
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-02-18 07:27:06 -07:00
Bartek Iwańczuk
345423cf76
refactor: Use virtul ops module ( #22175 )
...
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-29 22:02:26 +01:00
Bartek Iwańczuk
909986fa6e
refactor: migrate 'ext/node' extension to virtual ops module ( #22157 )
...
Follow up to https://github.com/denoland/deno/pull/22135
2024-01-29 14:58:08 +01:00
Asher Gomez
6059731594
refactor: set removal version for Deno.Server
( #22024 )
...
This change sets the removal version for the deprecated `Deno.Server`
interface for Deno 2.0.
Towards #22021
2024-01-23 02:19:49 +01:00
Marvin Hagemeister
59f419bf41
fix(node/http): remoteAddress and remotePort not being set ( #21998 )
...
<!--
Before submitting a PR, please read https://deno.com/manual/contributing
1. Give the PR a descriptive title.
Examples of good title:
- fix(std/http): Fix race condition in server
- docs(console): Update docstrings
- feat(doc): Handle nested reexports
Examples of bad title:
- fix #7123
- update docs
- fix bugs
2. Ensure there is a related issue and it is referenced in the PR text.
3. Ensure there are tests that cover the changes.
4. Ensure `cargo test` passes.
5. Ensure `./tools/format.js` passes without changing files.
6. Ensure `./tools/lint.js` passes.
7. Open as a draft PR if your work is still in progress. The CI won't
run
all steps, but you can add '[ci]' to a commit message to force it to.
8. If you would like to run the benchmarks on the CI, add the 'ci-bench'
label.
-->
Ultimately, it came down to using incorrect property names in the
`FakeSocket` constructor. The values are passed under `remoteAddress`,
not `hostname` and `remotePort` instead of `port`.
Fixes https://github.com/denoland/deno/issues/21980
2024-01-19 13:09:37 +01:00
Bartek Iwańczuk
4e3aff8400
chore: upgrade deno_core to 0.247.0 ( #21974 )
2024-01-18 17:57:22 +01:00
Divy Srivastava
66ff28c21e
fix(node): update req.socket
on WS upgrade ( #21984 )
...
Update the `req.socket` to be a `net.Socket` from `FakeSocket`
Fixes #21979
2024-01-18 22:24:02 +05:30
Kenta Moriuchi
515a34b4de
refactor: use core.ensureFastOps()
( #21888 )
2024-01-10 15:37:25 -07:00
David Sherret
7e72f3af61
chore: update copyright to 2024 ( #21753 )
2024-01-01 19:58:21 +00:00
Matt Mastracci
0efe438f7c
perf: remove opAsync ( #21690 )
...
`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-27 02:30:26 +01:00
Divy Srivastava
60da9d493c
fix(ext/node): add ClientRequest#setNoDelay ( #21694 )
...
Fixes https://github.com/denoland/deno/issues/18316
2023-12-25 08:58:51 +05:30
Divy Srivastava
5e24e28318
fix(ext/node): ServerResponse getHeader() return undefined ( #21525 )
...
Matches Node's return type.
Next.js check for `if (header === undefined)`:
e02fe314dc/packages/next/src/server/base-http/node.ts (L93)
2023-12-11 11:11:59 +05:30
Divy Srivastava
e8fc7c20b7
fix(ext/node): stub ServerResponse#flushHeaders ( #21526 )
...
This commit adds a no-op flushHeaders method to the ServerResponse
object. It is a nop because the ServerResponse implementation is based
on top of the Deno server API instead of the Node `OutgoingMessage`
base.
Fixes #21509
2023-12-11 04:46:12 +00:00
Matt Mastracci
e6e708e46c
refactor: use resourceForReadableStream for fetch ( #20217 )
...
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-12-01 08:56:10 -07:00
Asher Gomez
616354e76c
refactor: replace deferred()
from std/async
with Promise.withResolvers()
( #21234 )
...
Closes #21041
---------
Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2023-11-22 12:11:20 +01:00
Jacob Hummer
b2e3389a6a
fix(node/http): export globalAgent ( #21081 )
...
Fixes #21080
Fixes #18312
---------
Signed-off-by: Jacob Hummer <jcbhmr@outlook.com>
2023-11-11 10:13:30 +05:30
Gasman
837c870ff4
fix(node/http): socket.setTimeout ( #20930 )
...
Fixes #20923
2023-11-07 00:51:14 +01:00
Bartek Iwańczuk
2929313652
fix(node/http): don't leak resources on destroyed request ( #20040 )
...
Closes https://github.com/denoland/deno/issues/19828
2023-08-29 12:13:58 +00:00
osddeitf
c2547ba039
fix(node/http): correctly send Content-length
header instead of Transfer-Encoding: chunked
( #20127 )
...
Fix #20063 .
2023-08-28 09:32:54 +02:00
Bartek Iwańczuk
a48ec1d563
fix(node/http): emit error when addr in use ( #20200 )
...
Closes https://github.com/denoland/deno/issues/20186
2023-08-18 13:48:18 +02:00
Marcos Casagrande
ddbb5fdfb0
perf(ext/node): optimize http headers ( #20163 )
...
This PR optimizes Node's `IncomingMessageForServer.headers` by replacing
`Object.fromEntries()` with a loop and `headers.entries` with
`headersEntries` which returns the internal array directly instead of an
iterator
## Benchmarks
Using `wrk` with 5 headers
```
wrk -d 10s --latency -H "X-Deno: true" -H "Accept: application/json" -H "X-Foo: bar" -H "User-Agent: wrk" -H "Accept-Encoding: gzip, br" http://127.0.0.1:3000
```
**this PR**
```
Running 10s test @ http://127.0.0.1:3000
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 167.53us 136.89us 2.75ms 97.33%
Req/Sec 31.98k 1.38k 36.39k 70.30%
Latency Distribution
50% 134.00us
75% 191.00us
90% 234.00us
99% 544.00us
642548 requests in 10.10s, 45.96MB read
Requests/sec: 63620.36
Transfer/sec: 4.55MB
```
**main**
```
Running 10s test @ http://127.0.0.1:3000
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 181.31us 132.54us 3.79ms 97.13%
Req/Sec 29.21k 1.45k 32.93k 79.21%
Latency Distribution
50% 148.00us
75% 198.00us
90% 261.00us
99% 545.00us
586939 requests in 10.10s, 41.98MB read
Requests/sec: 58114.01
Transfer/sec: 4.16MB
```
```js
import express from "npm:express";
const app = express();
app.get("/", function (req, res) {
req.headers;
res.end();
});
app.listen(3000);
```
2023-08-15 16:59:35 +02:00
Marcos Casagrande
e071382768
perf(ext/node): cache IncomingMessageForServer.headers
( #20147 )
...
This PR adds caching to node's `req.headers`
```js
import express from "npm:express";
const app = express();
app.get("/", function (req, res) {
const ua = req.header("User-Agent");
const auth = req.header("Authorization");
const type = req.header("Content-Type");
const ip = req.header("X-Forwarded-For");
res.end();
});
app.listen(3000);
```
**this PR**
```
wrk -d 10s --latency http://127.0.0.1:3000
Running 10s test @ http://127.0.0.1:3000
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 155.64us 152.14us 5.74ms 97.39%
Req/Sec 35.00k 1.97k 39.10k 80.69%
Latency Distribution
50% 123.00us
75% 172.00us
90% 214.00us
99% 563.00us
703420 requests in 10.10s, 50.31MB read
Requests/sec: 69648.45
Transfer/sec: 4.98MB
```
**main**
```
wrk -d 10s --latency http://127.0.0.1:3000
Running 10s test @ http://127.0.0.1:3000
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 217.95us 786.89us 26.26ms 98.23%
Req/Sec 32.32k 2.54k 37.19k 87.13%
Latency Distribution
50% 130.00us
75% 191.00us
90% 232.00us
99% 1.88ms
649411 requests in 10.10s, 46.45MB read
Requests/sec: 64300.44
Transfer/sec: 4.60MB
```
2023-08-14 15:14:02 +02:00
Bartek Iwańczuk
bd79baea5e
fix(node): add writable and readable fields to FakeSocket ( #19931 )
...
Closes https://github.com/denoland/deno/issues/19927
2023-07-25 07:17:53 +00:00
Leo Kettmeir
da709729e3
fix(node/http): add encrypted field to FakeSocket ( #19886 )
...
Fixes #19557
2023-07-21 02:18:07 +02:00
Leo Kettmeir
bf4e99cbd7
fix(node/http): call callback after request is sent ( #19871 )
...
Fixes #19762
2023-07-19 01:30:19 +02:00
Leo Kettmeir
9d5f6f67d6
fix(node/http): add destroy to FakeSocket ( #19796 )
...
Closes #19782
2023-07-11 15:08:35 +02:00
Leo Kettmeir
4cfc54931d
fix(node/http): allow callback in first argument of end call ( #19778 )
...
Closes #19762
2023-07-11 14:49:19 +02:00
Leo Kettmeir
5cda141f2d
fix(node/http): server use FakeSocket and add end method ( #19660 )
...
Fixes #19324
2023-07-10 13:48:35 +02:00
Bartek Iwańczuk
01f0d03ae8
refactor: rename built-in node modules from ext:deno_node/ to node: ( #19680 )
...
Closes https://github.com/denoland/deno/issues/19510
2023-07-02 20:19:30 +02:00
Leo Kettmeir
4db534d461
fix(node/http): add setKeepAlive to FakeSocket ( #19659 )
...
Closes #19535
2023-06-30 03:39:16 +02:00
Kenta Moriuchi
e16b74d792
chore(ext/node): disable prefer-primordials on a per-file basis ( #19553 )
2023-06-27 15:18:22 +09:00
Bartek Iwańczuk
f145cbfacc
refactor(ext/fetch): simplify fetch ops ( #19494 )
...
Addresses feedback from
https://github.com/denoland/deno/pull/19412#discussion_r1227912676
2023-06-15 15:34:21 +02:00
Leo Kettmeir
fc4e4c3e93
chore(ext/node): bring back changes to ClientRequest.onSocket ( #19509 )
...
Reverts denoland/deno#19426
2023-06-14 22:59:27 +02:00
Bartek Iwańczuk
07cbec4a82
fix(ext/node): handle 'upgrade' responses ( #19412 )
...
This commit adds support for "upgrade" events in "node:http"
"ClientRequest". Currently only "Websocket" upgrades are
handled. Thanks to this change package like "npm:puppeteer"
and "npm:discord" should work.
Closes https://github.com/denoland/deno/issues/18913
Closes https://github.com/denoland/deno/issues/17847
2023-06-13 14:11:27 +02:00
Leo Kettmeir
b4ae37a617
feat(node): HTTPS server ( #19362 )
2023-06-13 04:15:08 +02:00
Bartek Iwańczuk
c775001466
chore(ext/node): revert changes to ClientRequest.onSocket ( #19426 )
...
Partially reverts https://github.com/denoland/deno/pull/19340
because it causes hangs in some situations.
2023-06-08 20:32:26 +02:00
Leo Kettmeir
5aca8b9e5d
fix(node/http): use fake socket and proper url handling ( #19340 )
...
Fixes https://github.com/denoland/deno/issues/19349
---------
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-06-06 14:37:10 +00:00
Leo Kettmeir
6e0bf093c5
refactor: further work on node http client ( #19327 )
...
Closes https://github.com/denoland/deno/issues/18300
2023-05-31 20:06:21 +02:00
Bartek Iwańczuk
d90a75c036
fix: use proper ALPN protocols if HTTP client is HTTP/1.1 only ( #19303 )
...
Closes https://github.com/denoland/deno/issues/16923
---------
Co-authored-by: crowlkats <crowlkats@toaxl.com>
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-05-29 23:05:45 +02:00
Bartek Iwańczuk
cf8b7bb530
fix(node): http.IncomingMessageForClient.complete ( #19302 )
...
Closes https://github.com/denoland/deno/issues/19238
2023-05-29 01:29:01 +02:00
Leo Kettmeir
be59e93220
refactor(node/http): don't use readablestream for writing to request ( #19282 )
...
Refactors the internal usage of a readablestream to write to the
resource directly
---------
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-27 15:42:20 +02:00
Levente Kurusa
9ddb39d4cd
fix(ext/node): ClientRequest.setTimeout(0) should remove listeners ( #19240 )
...
Co-authored-by: crowlkats <crowlkats@toaxl.com>
2023-05-24 22:54:12 +02:00
Leo Kettmeir
5878258952
refactor: further work on node http client ( #19211 )
2023-05-23 03:03:10 +02:00
Bartek Iwańczuk
40bda07ff5
fix(node): add http.Server.unref() ( #19201 )
...
Closes https://github.com/denoland/deno/issues/19113
2023-05-22 01:02:10 +02:00
Bartek Iwańczuk
5b07522349
BREAKING(unstable): change return type of Deno.serve() API ( #19189 )
...
This commit changes the return type of an unstable `Deno.serve()` API
to instead return a `Deno.Server` object that has a `finished` field.
This change is done in preparation to be able to ref/unref the HTTP
server.
2023-05-19 02:59:23 +02:00
Leo Kettmeir
867a6d3032
refactor(node): reimplement http client ( #19122 )
...
This commit reimplements most of "node:http" client APIs using
"ext/fetch".
There is some duplicated code and two removed Node compat tests that
will be fixed in follow up PRs.
---------
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-17 01:20:32 +02:00
Levente Kurusa
000315e75a
fix(node/http): Request.setTimeout(0) should clear ( #18949 )
...
Fixes: #18932
2023-05-02 02:14:13 +02:00
Bartek Iwańczuk
1e331a4873
refactor(ext/node): migrate back to using "Deno.serve" API for HTTP server ( #18865 )
...
This commit fixes "node:http" API to properly handle "upgrade"
requests and thus marking Vite work again.
This is done by migrating back to "Deno.serve()" and internal
"upgradeHttpRaw" APIs for "node:http" module polyfill.
2023-04-27 12:45:13 +02:00