@amritk/nish-x86_64-linux 0.24.0 → 0.25.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/bin/nish +0 -0
- package/docs/AI.md +24 -4
- package/package.json +1 -1
- package/runtime/browser.mjs +4 -3
- package/runtime/core/host.d.ts +8 -0
- package/runtime/core/host.mjs +50 -2
- package/runtime/nish.d.ts +100 -0
- package/runtime/nish.h +34 -0
- package/runtime/nish.mjs +21 -0
- package/runtime/node.mjs +57 -6
- package/runtime/runtime-net.c +44 -3
- package/runtime/runtime-os.c +115 -12
- package/scripts/build.sh +13 -3
- package/std/README.md +25 -8
- package/std/cli-args.ts +1216 -0
- package/std/cli-flags.ts +585 -0
- package/std/cli.ts +308 -19
- package/std/compress/checksum.ts +132 -20
- package/std/compress/deflate.ts +638 -248
- package/std/compress/gzip.ts +20 -6
- package/std/crypto/LICENSE-fiat-crypto-p384 +21 -0
- package/std/crypto/p256.ts +63 -1
- package/std/crypto/p384.ts +6044 -0
- package/std/crypto/pki-roots.ts +322 -0
- package/std/crypto/pki.ts +1207 -0
- package/std/crypto/rsa.ts +663 -0
- package/std/crypto/x509.ts +1054 -58
- package/std/net/dns-config.ts +734 -0
- package/std/net/dns-message.ts +517 -0
- package/std/net/dns-resolver.ts +1015 -0
- package/std/net/dns.ts +478 -0
- package/std/net/http1-client.ts +1227 -0
- package/std/net/http1-server.ts +7 -2
- package/std/net/http1.ts +9 -9
- package/std/net/tls/client.ts +1094 -0
- package/std/net/tls/codec.ts +585 -3
- package/std/net/tls/record-client.ts +1192 -0
- package/std/net/tls/verify.ts +221 -0
- package/std/net/tls-tcp.ts +642 -11
- package/std/net/tls.ts +2 -2
- package/std/net/url.ts +559 -4
- package/std/yaml-write.ts +415 -0
package/std/net/http1-server.ts
CHANGED
|
@@ -1272,7 +1272,10 @@ export class Http1Connection {
|
|
|
1272
1272
|
enc.identityFields(names, values)
|
|
1273
1273
|
}
|
|
1274
1274
|
// `respond` and the body together, or neither: what `respond` sets is
|
|
1275
|
-
// put back when the body does not fit behind the head.
|
|
1275
|
+
// put back when the body does not fit behind the head. `room` first, so
|
|
1276
|
+
// that what was sent is already moved out of the way and the `outputEnd`
|
|
1277
|
+
// put back is one `respond` did not move.
|
|
1278
|
+
this.room()
|
|
1276
1279
|
const outputEnd: i32 = this.outputEnd
|
|
1277
1280
|
const closeAfter: boolean = this.closeAfter
|
|
1278
1281
|
const r: i32 = this.respond(status, enc.names, enc.values, n)
|
|
@@ -1954,7 +1957,9 @@ export class Http1TlsServer {
|
|
|
1954
1957
|
readable(slot: i32): i32 {
|
|
1955
1958
|
const live: boolean = this.live(slot)
|
|
1956
1959
|
const now: i64 = monotonicNanos()
|
|
1957
|
-
|
|
1960
|
+
// What a lingering slot drains is not activity, so `idleTimeout` bounds
|
|
1961
|
+
// how long a client that trickles bytes after the close can hold it.
|
|
1962
|
+
if (live && !this.tls.lingering(slot)) {
|
|
1958
1963
|
this.connections[slot].lastActive = now
|
|
1959
1964
|
}
|
|
1960
1965
|
this.tls.readable(slot)
|
package/std/net/http1.ts
CHANGED
|
@@ -524,7 +524,7 @@ const http1TakeLine = (p: Http1Parser, limit: i32, overStatus: i32): i32 => {
|
|
|
524
524
|
}
|
|
525
525
|
|
|
526
526
|
/** Whether `c` is a tchar of RFC 9110 §5.6.2, the bytes a token is made of. */
|
|
527
|
-
const http1IsTokenByte = (c: i32): boolean =>
|
|
527
|
+
export const http1IsTokenByte = (c: i32): boolean =>
|
|
528
528
|
(c >= 97 && c <= 122) ||
|
|
529
529
|
(c >= 65 && c <= 90) ||
|
|
530
530
|
(c >= 48 && c <= 57) ||
|
|
@@ -541,10 +541,10 @@ const http1IsTokenByte = (c: i32): boolean =>
|
|
|
541
541
|
c === 126
|
|
542
542
|
|
|
543
543
|
/** Whether `c` may appear in a field value (RFC 9110 §5.5): HTAB, SP, VCHAR or obs-text. */
|
|
544
|
-
const http1IsValueByte = (c: i32): boolean => c === 9 || (c >= 32 && c !== 127)
|
|
544
|
+
export const http1IsValueByte = (c: i32): boolean => c === 9 || (c >= 32 && c !== 127)
|
|
545
545
|
|
|
546
546
|
/** `buf[from .. to)` as a string, each upper-case ASCII letter lowered when `lower`. */
|
|
547
|
-
const http1Text = (buf: u8[], from: i32, to: i32, lower: boolean): string => {
|
|
547
|
+
export const http1Text = (buf: u8[], from: i32, to: i32, lower: boolean): string => {
|
|
548
548
|
const parts: string[] = []
|
|
549
549
|
for (let k: i32 = from; k >= 0 && k < to && k < toI32(buf.length); k += 1) {
|
|
550
550
|
let c: i32 = toI32(buf[k])
|
|
@@ -557,10 +557,10 @@ const http1Text = (buf: u8[], from: i32, to: i32, lower: boolean): string => {
|
|
|
557
557
|
}
|
|
558
558
|
|
|
559
559
|
/** Whether `c` is optional whitespace, a space or a tab (OWS, RFC 9110 §5.6.3). */
|
|
560
|
-
const http1IsOws = (c: i32): boolean => c === 32 || c === 9
|
|
560
|
+
export const http1IsOws = (c: i32): boolean => c === 32 || c === 9
|
|
561
561
|
|
|
562
562
|
/** Whether `text[a .. b)` is `word`, which is lowercase, in any ASCII case. */
|
|
563
|
-
const http1SameWord = (text: string, a: i32, b: i32, word: string): boolean => {
|
|
563
|
+
export const http1SameWord = (text: string, a: i32, b: i32, word: string): boolean => {
|
|
564
564
|
const n: i32 = toI32(word.length)
|
|
565
565
|
if (a < 0 || b - a !== n || b > toI32(text.length)) {
|
|
566
566
|
return false
|
|
@@ -989,7 +989,7 @@ const http1ContentLength = (bytes: u8[], from: i32, to: i32, limit: i32): i32 =>
|
|
|
989
989
|
}
|
|
990
990
|
|
|
991
991
|
/** The value of the hex digit `c`, or -1. */
|
|
992
|
-
const http1HexValue = (c: i32): i32 => {
|
|
992
|
+
export const http1HexValue = (c: i32): i32 => {
|
|
993
993
|
if (c >= 48 && c <= 57) {
|
|
994
994
|
return c - 48
|
|
995
995
|
}
|
|
@@ -1190,7 +1190,7 @@ const http1BytesOf = (text: string): u8[] => {
|
|
|
1190
1190
|
}
|
|
1191
1191
|
|
|
1192
1192
|
/** Whether every byte of `text` is a tchar, and there is at least one. */
|
|
1193
|
-
const http1IsToken = (text: string): boolean => {
|
|
1193
|
+
export const http1IsToken = (text: string): boolean => {
|
|
1194
1194
|
const n: i32 = toI32(text.length)
|
|
1195
1195
|
if (n === 0) {
|
|
1196
1196
|
return false
|
|
@@ -1204,7 +1204,7 @@ const http1IsToken = (text: string): boolean => {
|
|
|
1204
1204
|
}
|
|
1205
1205
|
|
|
1206
1206
|
/** Whether every byte of `text` may stand in a field value or a reason phrase. */
|
|
1207
|
-
const http1IsFieldText = (text: string): boolean => {
|
|
1207
|
+
export const http1IsFieldText = (text: string): boolean => {
|
|
1208
1208
|
const n: i32 = toI32(text.length)
|
|
1209
1209
|
for (let k: i32 = 0; k < n; k += 1) {
|
|
1210
1210
|
if (!http1IsValueByte(toI32(text.charCodeAt(k)))) {
|
|
@@ -1395,7 +1395,7 @@ const http1DecimalDigits = (n: i32): i32 => {
|
|
|
1395
1395
|
}
|
|
1396
1396
|
|
|
1397
1397
|
/** Writes `text` at `out[at ..)`, which the caller has made sure holds it, and answers where it ends. */
|
|
1398
|
-
const http1PutText = (out: u8[], at: i32, text: string): i32 => {
|
|
1398
|
+
export const http1PutText = (out: u8[], at: i32, text: string): i32 => {
|
|
1399
1399
|
const n: i32 = toI32(text.length)
|
|
1400
1400
|
for (let k: i32 = 0; k < n && at + k < toI32(out.length); k += 1) {
|
|
1401
1401
|
if (at + k >= 0) {
|