-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Bun.serve: HTTP/3 (QUIC) support via h3: true
#29768
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
Merged
Merged
Changes from 44 commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
d5f7aa2
Bun.serve: add HTTP/3 (QUIC) listener via `h3: true`
Jarred-Sumner a0fc950
serve(h3): route HTTP/3 through RequestContext instead of a separate …
Jarred-Sumner 33ac980
serve(h3): mirror static and file routes onto the H3 app
Jarred-Sumner 768ff6d
serve(h3): fix UAF in tryEnd after synchronous stream close; adversar…
Jarred-Sumner d211992
serve(h3): fix 7 bugs from branch sweep
Jarred-Sumner 6017dc6
serve(h3): production-readiness pass
Jarred-Sumner b3e8fc2
[autofix.ci] apply automated fixes
autofix-ci[bot] 7ff1a21
LICENSE: add lsquic, ls-qpack, ls-hpack
Jarred-Sumner 8706e4b
serve(h3): address review findings
Jarred-Sumner b1eacbd
Http3Request: no-arg getQuery() strips leading '?' to match HttpRequest
Jarred-Sumner 6acf87b
serve(h3): second-round review fixes
Jarred-Sumner fa49794
quic.c: include <stdio.h> for fwrite/stderr in us_quic_log_buf
Jarred-Sumner 4c57d66
quic.c: gate lsquic logger to BUN_DEBUG builds
Jarred-Sumner 49fca0a
quic.c: drop dead <assert.h>; lift lsquic global init into the C++ layer
Jarred-Sumner d6f713e
serve(h3): drive lsquic from loop_post + drainMicrotasks instead of p…
Jarred-Sumner c5ff317
[autofix.ci] apply automated fixes
autofix-ci[bot] afa5d7c
serve(h3): count each QUIC connection as a virtual poll
Jarred-Sumner 08f9a4a
remove stray h3blast load-tester and bench script accidentally swept in
Jarred-Sumner 60279c5
restore h3blast load tester source + http3-hello bench; gitignore bui…
Jarred-Sumner 64c96b2
[autofix.ci] apply automated fixes
autofix-ci[bot] bbc106d
test(h3): waitForStderr rejects on child EOF; rename misnamed concurr…
Jarred-Sumner f751000
[autofix.ci] apply automated fixes
autofix-ci[bot] 82314e2
serve(h3): batch process_conns at loop_pre/loop_post; encoder-side perf
Jarred-Sumner d75e84e
[autofix.ci] apply automated fixes
autofix-ci[bot] 8336f33
serve(h3): skip lsquic priority walk; fix UDP EPOLLERR+EPOLLOUT spin
Jarred-Sumner 145711b
Http3ResponseData: WTF::Vector<_, N> for header storage
Jarred-Sumner fd09e8e
serve(h3): drop the QUIC timerfd; fold earliest_adv_tick into getTimeout
Jarred-Sumner 3f3cf81
serve(h3): review-feedback batch
Jarred-Sumner 09987e7
serve(h3): drainQuicIfNecessary after the deferred-task queue
Jarred-Sumner b1305ec
serve(h3): drop inline threshold flush; parse sock_extended_err in MS…
Jarred-Sumner 7510ebb
serve(h3): include <netinet/in.h> for Android; review nits
Jarred-Sumner 4322337
NodeHTTP: explicit case 0 / ASSERT_NOT_REACHED in toUWSResponse kind …
Jarred-Sumner 3a48620
serve: type the resp_kind selector as a real enum on both sides
Jarred-Sumner bf70914
serve(h3): fill uncovered methods when "/*" route is method-specific
Jarred-Sumner f52eed3
serve(h3): enable on Windows
Jarred-Sumner b887d7b
serve(h3): drop the remaining Windows guards missed in f52eed3
Jarred-Sumner 9712ae4
serve(h3): cap CL-less bodies at maxRequestBodySize; treat h3_listene…
Jarred-Sumner 0704dc8
[autofix.ci] apply automated fixes
autofix-ci[bot] 77fe95f
serve(h3): drop literal Host when :authority is present; review fixups
Jarred-Sumner bc7fb4a
Http3Request: case-insensitive host skip in forEachHeader
Jarred-Sumner 562b4f1
serve(h3): coderabbit review pass
Jarred-Sumner 136c156
[autofix.ci] apply automated fixes
autofix-ci[bot] deace3b
HTTPHeaderNames: add Proxy-Connection; fix h3/libuv timer re-arm
Jarred-Sumner 63b0ab3
Http3Request: getHeader("host") returns the resolved authority directly
Jarred-Sumner ad7cddc
serve(h3): emit Alt-Svc on static/file routes; close quic_timer on lo…
Jarred-Sumner f4ee4df
ServerConfig: reject h1:false with a unix socket
Jarred-Sumner 9bebc25
test(h3): make graceful-stop test diagnostic; widen post-stop sleep
Jarred-Sumner 3addffd
test(serve-protocols): use getReader/releaseLock so the stderr drain …
Jarred-Sumner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| import { spawnSync } from "node:child_process"; | ||
| import { mkdtempSync, readFileSync } from "node:fs"; | ||
| import { tmpdir } from "node:os"; | ||
| import { join } from "node:path"; | ||
|
|
||
| process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"; | ||
|
|
||
| let cert, key; | ||
| if (process.argv[2] && process.argv[3]) { | ||
| cert = readFileSync(process.argv[2], "utf8"); | ||
| key = readFileSync(process.argv[3], "utf8"); | ||
| } else { | ||
| const dir = mkdtempSync(join(tmpdir(), "h3-hello-")); | ||
| const certPath = join(dir, "cert.pem"); | ||
| const keyPath = join(dir, "key.pem"); | ||
| const { status, stderr } = spawnSync( | ||
| "openssl", | ||
| [ | ||
| "req", | ||
| "-x509", | ||
| "-nodes", | ||
| "-newkey", | ||
| "rsa:2048", | ||
| "-days", | ||
| "365", | ||
| "-subj", | ||
| "/CN=localhost", | ||
| "-keyout", | ||
| keyPath, | ||
| "-out", | ||
| certPath, | ||
| ], | ||
| { stdio: ["ignore", "ignore", "pipe"] }, | ||
| ); | ||
| if (status !== 0) { | ||
| throw new Error("openssl failed: " + stderr); | ||
| } | ||
| cert = readFileSync(certPath, "utf8"); | ||
| key = readFileSync(keyPath, "utf8"); | ||
| } | ||
|
|
||
| const TOTAL = 10_000_000; | ||
| var i = 0; | ||
|
|
||
| const server = Bun.serve({ | ||
| port: 3001, | ||
| h3: true, | ||
| h1: true, | ||
| tls: { cert, key, rejectUnauthorized: false }, | ||
| routes: { "/hi": new Response("hello!") }, | ||
| fetch(req) { | ||
| if (i++ === TOTAL - 1) setTimeout(() => server.stop().then(() => process.exit(0))); | ||
| return new Response("Hello, World!" + i); | ||
| }, | ||
| }); | ||
| setTimeout(() => {}, 999999); | ||
|
|
||
| console.log(String(server.url)); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.