@amritk/nish-x86_64-linux 0.36.0 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/INSTALL.md +92 -71
- package/bin/nish +0 -0
- package/docs/AI.md +75 -14
- package/package.json +1 -1
- package/runtime/async.d.mts +2 -0
- package/runtime/async.mjs +7 -0
- package/runtime/core/arrays.d.ts +4 -0
- package/runtime/core/arrays.mjs +33 -0
- package/runtime/nish.d.ts +1045 -512
- package/runtime/nish.h +53 -6
- package/runtime/page.d.ts +53 -0
- package/runtime/page.mjs +146 -0
- package/runtime/runtime-async.c +740 -0
- package/runtime/runtime-cross.c +2 -1
- package/runtime/runtime-region.c +85 -7
- package/runtime/runtime-text.c +1068 -0
- package/runtime/runtime-wasm.c +65 -9
- package/runtime/runtime.c +50 -961
- package/runtime/vite.mjs +48 -11
- package/scripts/build.sh +231 -31
- package/std/LICENSE-fdlibm +8 -0
- package/std/README.md +109 -82
- package/std/array.ts +266 -0
- package/std/bytes.ts +23 -19
- package/std/compress/checksum.ts +1 -1
- package/std/crypto/aes.ts +48 -43
- package/std/crypto/base64url.ts +7 -5
- package/std/crypto/bcrypt-batch.ts +13 -13
- package/std/crypto/bcrypt.ts +33 -27
- package/std/crypto/chacha20poly1305.ts +16 -14
- package/std/crypto/ed25519.ts +19 -16
- package/std/crypto/hmac.ts +7 -6
- package/std/crypto/jwt.ts +23 -20
- package/std/crypto/p256.ts +63 -56
- package/std/crypto/p384.ts +23 -20
- package/std/crypto/pki.ts +18 -15
- package/std/crypto/rsa.ts +23 -19
- package/std/crypto/x25519.ts +11 -10
- package/std/crypto/x509.ts +69 -62
- package/std/host/ring.ts +124 -0
- package/std/host/text.ts +86 -0
- package/std/json-equal.ts +12 -11
- package/std/json-number.ts +12 -12
- package/std/json-tokenizer.ts +26 -22
- package/std/json-typed.ts +92 -78
- package/std/json-value.ts +38 -33
- package/std/json.ts +32 -28
- package/std/math.ts +743 -41
- package/std/net/dns-resolver.ts +46 -6
- package/std/net/dns.ts +50 -13
- package/std/net/fetch.ts +1744 -295
- package/std/net/handler.ts +30 -0
- package/std/net/hpack.ts +29 -26
- package/std/net/http-compress.ts +42 -28
- package/std/net/http-fields.ts +19 -4
- package/std/net/http1-client-codec.ts +29 -25
- package/std/net/http1-codec.ts +62 -91
- package/std/net/http1-server.ts +79 -57
- package/std/net/http2-frame.ts +17 -16
- package/std/net/http2-tls.ts +17 -15
- package/std/net/http2.ts +67 -54
- package/std/net/http3-frame.ts +11 -10
- package/std/net/http3-server.ts +36 -35
- package/std/net/http3.ts +70 -58
- package/std/net/postgres-async.ts +1005 -0
- package/std/net/postgres.ts +185 -164
- package/std/net/prefork.ts +38 -34
- package/std/net/qpack.ts +15 -14
- package/std/net/quic-conn-ack.ts +1 -0
- package/std/net/quic-conn-cid.ts +11 -0
- package/std/net/quic-conn-params.ts +41 -14
- package/std/net/quic-datagram.ts +7 -0
- package/std/net/quic-frame.ts +48 -12
- package/std/net/quic-listener.ts +61 -44
- package/std/net/quic-packet.ts +71 -52
- package/std/net/quic-recovery.ts +59 -21
- package/std/net/quic-stream.ts +83 -55
- package/std/net/quic.ts +204 -152
- package/std/net/serve.ts +763 -0
- package/std/net/tls/client.ts +1 -0
- package/std/net/tls/codec.ts +81 -12
- package/std/net/tls/record-client.ts +30 -18
- package/std/net/tls/record-server.ts +74 -46
- package/std/net/tls/record.ts +33 -24
- package/std/net/tls/ticket.ts +2 -0
- package/std/net/tls/verify.ts +8 -7
- package/std/net/tls-tcp.ts +58 -50
- package/std/net/tls.ts +55 -43
- package/std/net/url.ts +12 -9
- package/std/net/websocket.ts +23 -19
- package/std/net/webtransport.ts +24 -18
- package/std/random.ts +8 -6
- package/std/regex.ts +70 -59
- package/std/sync/ring.ts +24 -21
- package/std/sync/shm.ts +9 -7
- package/std/term-io.ts +17 -14
- package/std/term-probe.ts +11 -10
- package/std/term-rate.ts +71 -61
- package/std/term.ts +73 -59
- package/std/text.ts +242 -15
- package/std/threads.ts +19 -15
- package/std/yaml-json.ts +17 -15
- package/std/yaml-write.ts +21 -14
package/std/net/http2.ts
CHANGED
|
@@ -34,64 +34,77 @@
|
|
|
34
34
|
* // then conn.consume(sent)
|
|
35
35
|
* };
|
|
36
36
|
*
|
|
37
|
-
* **Events.**
|
|
38
|
-
* first that means something to the program: `H2_REQUEST` (a stream opened
|
|
39
|
-
* with a request's header section; `fields` holds it until the next header
|
|
40
|
-
* block on the connection is read, for any stream, and a program copies what
|
|
41
|
-
* it keeps past that: the next block empties `fields` and reuses the arrays
|
|
42
|
-
* it pointed into), `H2_DATA` (some of a request body, a window onto the input
|
|
43
|
-
* buffer that stays valid until the next `feed`), `H2_TRAILERS`, `H2_RESET`
|
|
44
|
-
* (the stream is gone: the peer reset it, or broke a rule that resets it —
|
|
45
|
-
* `errorCode` says which), `H2_WINDOW` (a send window that held `writeData`
|
|
46
|
-
* back has opened: `stream`, or 0 for the connection's), `H2_GOAWAY` (the
|
|
47
|
-
* peer is going away; `lastStreamId`), and
|
|
48
|
-
* `H2_ERROR`, final: the connection broke a rule, a GOAWAY with `errorCode`
|
|
49
|
-
* is queued, and every later call answers it again. `H2_NEED_MORE` asks for
|
|
50
|
-
* more input, or for the output to drain: a frame is read only while the
|
|
51
|
-
* output has room for whatever it makes the connection answer, so a peer
|
|
52
|
-
* that sends PINGs or SETTINGS and never reads the acknowledgements stops
|
|
53
|
-
* being read rather than growing a queue. Bodies move a frame at a time and
|
|
54
|
-
* nothing buffers a whole one.
|
|
37
|
+
* **Events.**
|
|
55
38
|
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* `
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
39
|
+
* `next()` reads the frames `feed` handed it and answers the first that means
|
|
40
|
+
* something to the program:
|
|
41
|
+
* - `H2_REQUEST` (a stream opened with a request's header section; `fields`
|
|
42
|
+
* holds it until the next header block on the connection is read, for any
|
|
43
|
+
* stream, and a program copies what it keeps past that: the next block
|
|
44
|
+
* empties `fields` and reuses the arrays it pointed into),
|
|
45
|
+
* - `H2_DATA` (some of a request body, a window onto the input buffer that
|
|
46
|
+
* stays valid until the next `feed`),
|
|
47
|
+
* - `H2_TRAILERS`,
|
|
48
|
+
* - `H2_RESET` (the stream is gone: the peer reset it, or broke a rule that
|
|
49
|
+
* resets it — `errorCode` says which),
|
|
50
|
+
* - `H2_WINDOW` (a send window that held `writeData` back has opened: `stream`,
|
|
51
|
+
* or 0 for the connection's),
|
|
52
|
+
* - `H2_GOAWAY` (the peer is going away; `lastStreamId`),
|
|
53
|
+
* - and `H2_ERROR`, final: the connection broke a rule, a GOAWAY with
|
|
54
|
+
* `errorCode` is queued, and every later call answers it again.
|
|
55
|
+
*
|
|
56
|
+
* `H2_NEED_MORE` asks for more input, or for the output to drain: a frame is
|
|
57
|
+
* read only while the output has room for whatever it makes the connection
|
|
58
|
+
* answer, so a peer that sends PINGs or SETTINGS and never reads the
|
|
59
|
+
* acknowledgements stops being read rather than growing a queue. Bodies move a
|
|
60
|
+
* frame at a time and nothing buffers a whole one.
|
|
61
|
+
*
|
|
62
|
+
* **What the connection refuses**, as RFC 9113 classes it.
|
|
63
|
+
*
|
|
64
|
+
* A connection error sends GOAWAY and ends the connection:
|
|
65
|
+
* - a bad preface or a first frame that is not SETTINGS (PROTOCOL_ERROR, §3.4);
|
|
66
|
+
* - every refusal of `nish/net/http2-frame`;
|
|
67
|
+
* - a frame other than CONTINUATION inside a header block, or a CONTINUATION
|
|
68
|
+
* outside one (§6.10);
|
|
69
|
+
* - a stream identifier that is even or does not increase (§5.1.1);
|
|
70
|
+
* - DATA, WINDOW_UPDATE or RST_STREAM on an idle stream, and a PUSH_PROMISE
|
|
71
|
+
* from a client (PROTOCOL_ERROR);
|
|
72
|
+
* - HEADERS on a closed stream (STREAM_CLOSED);
|
|
73
|
+
* - a header block HPACK cannot decode (COMPRESSION_ERROR, RFC 7541 §2.3.2);
|
|
74
|
+
* - DATA past the connection window, or a window pushed past 2^31 − 1
|
|
75
|
+
* (FLOW_CONTROL_ERROR, §6.9);
|
|
76
|
+
* - a setting `http2SettingError` refuses;
|
|
77
|
+
* - a header block longer than `maxHeaderBlock` or cut into more than
|
|
78
|
+
* `H2_MAX_FRAGMENTS` frames, a header block that would make the HPACK table
|
|
79
|
+
* copy past its budget (`HPACK_ERR_COPY_BUDGET`), and more streams reset than
|
|
80
|
+
* `resetBudget` allows — by the peer, or by the server for a stream error the
|
|
81
|
+
* peer caused (ENHANCE_YOUR_CALM, §10.5).
|
|
82
|
+
*
|
|
83
|
+
* A stream error resets one stream and the connection lives: a malformed
|
|
84
|
+
* request — any refusal of `nish/net/http-fields`, trailers without END_STREAM,
|
|
85
|
+
* a body that disagrees with `content-length` (PROTOCOL_ERROR, §8.1.1); DATA or
|
|
86
|
+
* HEADERS after the peer ended the stream (STREAM_CLOSED, §5.1); DATA past the
|
|
87
|
+
* stream's window, or its window pushed past 2^31 − 1 (FLOW_CONTROL_ERROR); a
|
|
88
|
+
* stream past `maxStreams` (REFUSED_STREAM, §5.1.2); a stream that depends on
|
|
89
|
+
* itself and a PRIORITY of the wrong length. A request whose header list is
|
|
90
|
+
* longer than `maxHeaderListSize` is answered with a 431 and never reaches the
|
|
91
|
+
* program (§10.5.1).
|
|
80
92
|
*
|
|
81
93
|
* **Caps are start-up numbers**, all in `Http2Config`: the streams open at
|
|
82
94
|
* once, the windows, the largest frame and header block accepted, the header
|
|
83
|
-
* list, the output buffer and the reset budget. Every stream slot is
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
+
* list, the output buffer and the reset budget. Every stream slot is allocated
|
|
96
|
+
* by the constructor; the input, output and header-block buffers are borrowed
|
|
97
|
+
* from an `Http2Pools` when first needed and given back, zeroed as far as they
|
|
98
|
+
* were written, once each is empty or the connection ends, so an idle
|
|
99
|
+
* connection holds none.
|
|
100
|
+
*
|
|
101
|
+
* A server shares one `Http2Pools` among its slots; a connection on its own
|
|
102
|
+
* makes a private one that holds one buffer of each. Once the pools are warm,
|
|
103
|
+
* reading DATA, writing DATA and every control frame allocate nothing, and
|
|
104
|
+
* neither does a header block once the decoder's arrays have grown to the
|
|
105
|
+
* largest block and header list seen: it decodes into storage the connection
|
|
106
|
+
* owns, bounded by `maxHeaderBlock` and `maxHeaderListSize` whether the stream
|
|
107
|
+
* is opened, refused or reset (`docs/security/http2.md`, H2-1).
|
|
95
108
|
*
|
|
96
109
|
* The server sends no PUSH_PROMISE and no PRIORITY, and reads PRIORITY only to
|
|
97
110
|
* check it: RFC 9113 §5.3.2 deprecates the scheme. Every field it sends is a
|
package/std/net/http3-frame.ts
CHANGED
|
@@ -38,16 +38,17 @@
|
|
|
38
38
|
* **SETTINGS** (§7.2.4). `h3ReadSettings` reads a whole payload into an
|
|
39
39
|
* `Http3Settings`: the three identifiers this endpoint understands, and the
|
|
40
40
|
* first `H3_SETTINGS_KEEP` it does not, kept rather than dropped so that an
|
|
41
|
-
* extension can read them. The four that extended CONNECT and WebTransport
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
41
|
+
* extension can read them. The four that extended CONNECT and WebTransport read
|
|
42
|
+
* (RFC 9220's, RFC 9297's and the two of the WebTransport drafts) are also
|
|
43
|
+
* recorded in fields of their own, refused when repeated, so a peer cannot push
|
|
44
|
+
* them out of reach behind eight others.
|
|
45
|
+
*
|
|
46
|
+
* A payload that ends inside a pair is H3_FRAME_ERROR (§7.1); an identifier
|
|
47
|
+
* HTTP/2 defined with no HTTP/3 counterpart (0x00, 0x02 to 0x05), or one that
|
|
48
|
+
* appears twice, is H3_SETTINGS_ERROR (§7.2.4, §7.2.4.1). A repeat among the
|
|
49
|
+
* unknown ones is caught while they are kept, and past `H3_SETTINGS_KEEP` they
|
|
50
|
+
* are counted, not compared, so a peer cannot make the read cost more than a
|
|
51
|
+
* fixed number of compares per setting.
|
|
51
52
|
*
|
|
52
53
|
* **Stream types** (§6.2): control 0x00, push 0x01, RFC 9204's QPACK
|
|
53
54
|
* encoder 0x02 and decoder 0x03, and WebTransport's 0x54, whose bidirectional
|
package/std/net/http3-server.ts
CHANGED
|
@@ -65,19 +65,19 @@
|
|
|
65
65
|
* GSO where the platform has it and one datagram at a time where it does not.
|
|
66
66
|
* Each flight goes with the ECN codepoint its connection marked it with
|
|
67
67
|
* (`QuicFlight.ecn`, RFC 9000 §13.4), so the peer's ACK_ECN counts are
|
|
68
|
-
* validated and a CE mark shrinks the window. Where the platform sends no
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* one
|
|
74
|
-
*
|
|
75
|
-
* round trip is under a millisecond it
|
|
76
|
-
* millisecond to earn credit nor holds a slot back
|
|
77
|
-
* `clock` it counts whole milliseconds.
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
68
|
+
* validated and a CE mark shrinks the window. Where the platform sends no ECN
|
|
69
|
+
* (Darwin, whose `udpSendTo` answers -95 to a marked send), the first marked
|
|
70
|
+
* send goes again unmarked and no slot marks after it.
|
|
71
|
+
*
|
|
72
|
+
* A -95 is also what a platform without segmentation offload answers, so a
|
|
73
|
+
* refused GSO send goes again one datagram at a time, still marked, and only a
|
|
74
|
+
* -95 to one of those turns marking off. The pacer counts the microseconds
|
|
75
|
+
* `clock` gives it, so on a path whose round trip is under a millisecond it
|
|
76
|
+
* neither waits for the next millisecond to earn credit nor holds a slot back
|
|
77
|
+
* for a whole one; without `clock` it counts whole milliseconds. A slot whose
|
|
78
|
+
* HTTP/3 side sent GOAWAY and whose requests have all finished, every byte
|
|
79
|
+
* acknowledged, is closed with H3_NO_ERROR; a closed slot is freed once its
|
|
80
|
+
* CONNECTION_CLOSE is out.
|
|
81
81
|
*
|
|
82
82
|
* **Timers** are a wheel of `H3_SERVER_WHEEL` one-millisecond buckets, a
|
|
83
83
|
* slot in at most one: after every datagram and every flush the slot is filed
|
|
@@ -88,15 +88,16 @@
|
|
|
88
88
|
*
|
|
89
89
|
* **Caps, fixed at start-up**: the slots, and inside each the QUIC
|
|
90
90
|
* configuration's streams and buffers and the `Http3Config`'s field section,
|
|
91
|
-
* body chunk and DATA frame.
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
91
|
+
* body chunk and DATA frame.
|
|
92
|
+
*
|
|
93
|
+
* A slot's connections and address are built on the first Initial accepted into
|
|
94
|
+
* it and kept, so a pool sized for its peak costs at start-up only its per-slot
|
|
95
|
+
* tables (the index, the wheel, the queues), and holds at most `size`
|
|
96
|
+
* connections once the peak has come; a datagram an established connection
|
|
97
|
+
* reads, and every datagram it sends, allocates nothing; nor does a datagram no
|
|
98
|
+
* slot owns, which the listener reads where it lies and answers into scratch
|
|
99
|
+
* made once, nor a handshake into a slot built before, whose state is the
|
|
100
|
+
* slot's — `docs/security/http3.md` (H3-1, H3-3).
|
|
100
101
|
*
|
|
101
102
|
* **The Date.** Every response carries one `date` field (RFC 9110 §6.6.1)
|
|
102
103
|
* from the pool's `HttpDate`, which formats the IMF-fixdate at most once a
|
|
@@ -1223,19 +1224,19 @@ export class Http3Server {
|
|
|
1223
1224
|
|
|
1224
1225
|
/**
|
|
1225
1226
|
* Stops the server for good and wipes the keys it holds: every built slot's
|
|
1226
|
-
* connection is released (`QuicConnection.release`, which sends nothing),
|
|
1227
|
-
*
|
|
1228
|
-
*
|
|
1229
|
-
*
|
|
1230
|
-
*
|
|
1231
|
-
*
|
|
1232
|
-
*
|
|
1233
|
-
*
|
|
1234
|
-
*
|
|
1235
|
-
*
|
|
1236
|
-
*
|
|
1237
|
-
*
|
|
1238
|
-
* anyone can forge.
|
|
1227
|
+
* connection is released (`QuicConnection.release`, which sends nothing), as
|
|
1228
|
+
* is one built after, by `connection` or `quic`; the listener is released;
|
|
1229
|
+
* and the configuration's `statelessResetKey` and `retryTokenKey`, the
|
|
1230
|
+
* index's salt, the connections' entropy scratch and the listener's last
|
|
1231
|
+
* answer (a Retry's or a reset's token) are zeroed. From then on every
|
|
1232
|
+
* datagram is dropped and no connection is accepted.
|
|
1233
|
+
*
|
|
1234
|
+
* The configuration's two keys are the server's once it is made with them: a
|
|
1235
|
+
* program that keeps a copy of either, to start the next server with, wipes
|
|
1236
|
+
* its own copy. The keys are zeroed in place, so give each server a
|
|
1237
|
+
* `QuicServerConfig` of its own: any other listener, connection or server
|
|
1238
|
+
* made with the same one would go on MACing Retry tokens and deriving
|
|
1239
|
+
* stateless reset tokens under an all-zero key, which anyone can forge.
|
|
1239
1240
|
*/
|
|
1240
1241
|
stop(): void {
|
|
1241
1242
|
this.stopped = true
|
package/std/net/http3.ts
CHANGED
|
@@ -38,19 +38,24 @@
|
|
|
38
38
|
* }
|
|
39
39
|
* }
|
|
40
40
|
*
|
|
41
|
-
* **Events.**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
41
|
+
* **Events.**
|
|
42
|
+
*
|
|
43
|
+
* `next()` reads the streams the QUIC connection has news for and answers the
|
|
44
|
+
* first thing that means something to the program:
|
|
45
|
+
* - `H3_REQUEST` (a request's field section, in `fields`),
|
|
46
|
+
* - `H3_DATA` (a piece of its body, a window onto `data` valid until the next
|
|
47
|
+
* call),
|
|
48
|
+
* - `H3_TRAILERS`,
|
|
49
|
+
* - `H3_END` (the request ended, and its `content-length`, if any, matched),
|
|
50
|
+
* - `H3_RESET` (the stream is gone: the client reset it or stopped it, or it
|
|
51
|
+
* broke a rule that resets it — `errorCode` says which, `resetByPeer` who),
|
|
52
|
+
* - `H3_WRITABLE` (a stream whose write was held back can take more),
|
|
53
|
+
* - `H3_GOAWAY` (the client is going away; `lastStreamId` is its push ID),
|
|
54
|
+
* - and `H3_ERROR`, final: the connection broke a rule, it is closed with
|
|
55
|
+
* `errorCode`, and every later call answers it again.
|
|
56
|
+
*
|
|
57
|
+
* `H3_NEED_MORE` asks for more datagrams. A request's events come in order —
|
|
58
|
+
* REQUEST, DATA…, TRAILERS, END — and after `H3_RESET` its stream has no more.
|
|
54
59
|
*
|
|
55
60
|
* **Back-pressure** is QUIC's flow control. A body is read only as the
|
|
56
61
|
* program calls `next()`, `bodyChunk` bytes at most at a time, and QUIC gives
|
|
@@ -71,29 +76,34 @@
|
|
|
71
76
|
* A unidirectional stream of a type it does not know is asked to stop
|
|
72
77
|
* (H3_STREAM_CREATION_ERROR) and read to its end (§6.2).
|
|
73
78
|
*
|
|
74
|
-
* **What it refuses.**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* a
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* §4.1.2)
|
|
79
|
+
* **What it refuses.**
|
|
80
|
+
*
|
|
81
|
+
* A connection error closes the QUIC connection with the code:
|
|
82
|
+
* - a second control, encoder or decoder stream, or a push stream from a client
|
|
83
|
+
* (H3_STREAM_CREATION_ERROR, §6.2.1, §6.2.2);
|
|
84
|
+
* - a control stream whose first frame is not SETTINGS (H3_MISSING_SETTINGS);
|
|
85
|
+
* - the end, reset or STOP_SENDING of any critical stream, either side's
|
|
86
|
+
* (H3_CLOSED_CRITICAL_STREAM);
|
|
87
|
+
* - a frame where it may not be — DATA or HEADERS on the control stream, a
|
|
88
|
+
* control frame on a request stream, a second SETTINGS, DATA before HEADERS,
|
|
89
|
+
* anything but the end after trailers, any PUSH_PROMISE from a client, and an
|
|
90
|
+
* HTTP/2 type HTTP/3 reserves (H3_FRAME_UNEXPECTED, §7.2.8);
|
|
91
|
+
* - a frame cut off by its stream's end or a payload of the wrong length
|
|
92
|
+
* (H3_FRAME_ERROR, §7.1);
|
|
93
|
+
* - a SETTINGS frame `nish/net/http3-frame` refuses (H3_SETTINGS_ERROR);
|
|
94
|
+
* - a GOAWAY whose push ID rose, a MAX_PUSH_ID that fell, a CANCEL_PUSH past
|
|
95
|
+
* the push IDs allowed (H3_ID_ERROR, §5.2, §7.2.7, §7.2.3);
|
|
96
|
+
* - a control frame past `H3_CONTROL_FRAME_MAX` (H3_EXCESSIVE_LOAD);
|
|
97
|
+
* - and QPACK's three.
|
|
98
|
+
*
|
|
99
|
+
* A stream error resets one request, both ways, and the connection lives: a
|
|
100
|
+
* field section `nish/net/http-fields` refuses, and a body that disagrees with
|
|
101
|
+
* `content-length` (H3_MESSAGE_ERROR, §4.1.2); a request stream that ends
|
|
102
|
+
* before its HEADERS (H3_REQUEST_INCOMPLETE, §4.1.1); a request on a stream at
|
|
103
|
+
* or past the ID of the GOAWAY this side sent (H3_REQUEST_REJECTED, §5.2). A
|
|
104
|
+
* request whose field section is longer than `maxFieldSectionSize` — the frame,
|
|
105
|
+
* or the section once decoded — is answered with a 431, never reaches the
|
|
106
|
+
* program, and its stream is asked to stop with H3_NO_ERROR (§4.2.2, §4.1.2).
|
|
97
107
|
*
|
|
98
108
|
* **No server push.** It never sends PUSH_PROMISE; a client's MAX_PUSH_ID is
|
|
99
109
|
* allowed, checked and ignored.
|
|
@@ -109,28 +119,30 @@
|
|
|
109
119
|
* counters saturate, and the lookup of a stream's state is the QUIC
|
|
110
120
|
* connection's own hash index (`QuicStreams.slotOf`), never a scan.
|
|
111
121
|
*
|
|
112
|
-
* **Extended CONNECT and WebTransport.** With `extendedConnect` the
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
* draft-
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
122
|
+
* **Extended CONNECT and WebTransport.** With `extendedConnect` the connection
|
|
123
|
+
* sends SETTINGS_ENABLE_CONNECT_PROTOCOL 1 and a request may carry `:protocol`
|
|
124
|
+
* (RFC 9220); without it `:protocol` is malformed, H3_MESSAGE_ERROR.
|
|
125
|
+
*
|
|
126
|
+
* `webtransportSessions` above 0 turns that on and also sends
|
|
127
|
+
* SETTINGS_H3_DATAGRAM 1, draft-02's SETTINGS_ENABLE_WEBTRANSPORT 1 and
|
|
128
|
+
* draft-07's SETTINGS_WEBTRANSPORT_MAX_SESSIONS, and `nish/net/webtransport`
|
|
129
|
+
* runs its sessions on top: a request then waits for the client's SETTINGS
|
|
130
|
+
* (draft-02 §3.1), and a stream that opens with WebTransport's unidirectional
|
|
131
|
+
* type (0x54) or bidirectional signal (0x41) is read as far as its session ID,
|
|
132
|
+
* held unread and named in `H3_STREAM` until the program calls `acceptStream`
|
|
133
|
+
* (its bytes then come as H3_DATA, H3_END, H3_RESET and H3_STOPPED, and
|
|
134
|
+
* `writeStream` writes them as they are) or `refuseStream`.
|
|
135
|
+
*
|
|
136
|
+
* `openStream` opens one of this side's; `writeDataWhole` writes a capsule; a
|
|
137
|
+
* GOAWAY still lets a session's new stream in, and `H3_DROPPED` names a request
|
|
138
|
+
* stream that ended before its request reached the program. The client's
|
|
139
|
+
* SETTINGS_ENABLE_CONNECT_PROTOCOL and SETTINGS_H3_DATAGRAM must be 0 or 1
|
|
140
|
+
* (H3_SETTINGS_ERROR), a session ID that is no client-initiated bidirectional
|
|
141
|
+
* stream is H3_ID_ERROR, and the signal anywhere but a stream's start is
|
|
142
|
+
* H3_FRAME_ERROR. Holding every request, not only an extended CONNECT, until
|
|
143
|
+
* the client's SETTINGS keeps a decoded field section from having to be held
|
|
144
|
+
* per stream; it costs a request only when the client's control stream is lost
|
|
145
|
+
* or reordered.
|
|
134
146
|
*
|
|
135
147
|
* Private helpers share the importing program's flat symbol namespace
|
|
136
148
|
* (`docs/wp26-stdlib.md` §3e), which is why each one carries the module's name.
|