@amritk/nish-aarch64-linux 0.47.0 → 0.48.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/package.json +1 -1
- package/runtime/gfx/README.md +55 -0
- package/runtime/gfx/nish-gfx.c +1063 -0
- package/runtime/gfx/nish-gfx.h +221 -0
- package/runtime/gfx/nish-gfx.overrides.json +14 -0
- package/runtime/nish.d.ts +22 -5
- package/runtime/nish.mjs +1 -0
- package/runtime/runtime-net.c +53 -27
- package/runtime/runtime-uring.c +39 -7
- package/scripts/build.sh +88 -3
- package/std/compress/deflate.ts +1371 -704
- package/std/net/handler.ts +24 -6
- package/std/net/http-server.ts +358 -141
- package/std/net/http1-server.ts +8 -2
- package/std/raster.ts +35 -21
- package/std/synth.ts +9 -1
package/std/net/handler.ts
CHANGED
|
@@ -929,10 +929,7 @@ export class HttpHandler {
|
|
|
929
929
|
* `openHttpHandler` for a `Result`.
|
|
930
930
|
*/
|
|
931
931
|
constructor(limits: HandlerLimits, listener: i32, router: Router, loop: i32 = -1) {
|
|
932
|
-
|
|
933
|
-
if (fault.length > 0) {
|
|
934
|
-
panic(fault)
|
|
935
|
-
}
|
|
932
|
+
handlerCheckLimits(limits)
|
|
936
933
|
this.maxDecoded = limits.maxDecoded
|
|
937
934
|
this.decoder = new HttpBodyDecoder(limits.maxDecoded > 0 ? limits.maxDecoded : 1)
|
|
938
935
|
this.bodyTimeout = toI64(limits.bodyTimeout) * HANDLER_NANOS_PER_MS
|
|
@@ -1204,7 +1201,7 @@ export class HttpHandler {
|
|
|
1204
1201
|
*/
|
|
1205
1202
|
private drive(slot: i32): void {
|
|
1206
1203
|
const conn: Http1Connection = this.server.connection(slot)
|
|
1207
|
-
let event: i32 = this.server.next(slot)
|
|
1204
|
+
let event: i32 = this.unended(slot) ? H1_NEED_MORE : this.server.next(slot)
|
|
1208
1205
|
while (event !== H1_NEED_MORE && event !== H1_ERROR) {
|
|
1209
1206
|
if (event === H1_REQUEST) {
|
|
1210
1207
|
this.begin(slot, conn)
|
|
@@ -1215,7 +1212,7 @@ export class HttpHandler {
|
|
|
1215
1212
|
} else if (event === H1_WRITE) {
|
|
1216
1213
|
this.resume(slot, conn)
|
|
1217
1214
|
}
|
|
1218
|
-
event = this.server.next(slot)
|
|
1215
|
+
event = this.unended(slot) ? H1_NEED_MORE : this.server.next(slot)
|
|
1219
1216
|
}
|
|
1220
1217
|
if (event === H1_ERROR) {
|
|
1221
1218
|
// The carrier has written its refusal and ends the connection; a
|
|
@@ -1237,6 +1234,19 @@ export class HttpHandler {
|
|
|
1237
1234
|
this.settle(slot, conn)
|
|
1238
1235
|
}
|
|
1239
1236
|
|
|
1237
|
+
/**
|
|
1238
|
+
* Whether `slot`'s response is under way with every byte handed over but
|
|
1239
|
+
* not yet ended. The carrier finishes a `Content-Length` response once its
|
|
1240
|
+
* last byte is written and would read the next request on the next `next`,
|
|
1241
|
+
* so `drive` does not ask the slot again until the program's `end`: until
|
|
1242
|
+
* then the response is the program's, and a pipelined request behind it
|
|
1243
|
+
* waits (#1556).
|
|
1244
|
+
*/
|
|
1245
|
+
private unended(slot: i32): boolean {
|
|
1246
|
+
const r: HttpRequest | null = this.requestAt(this.currentOf(slot))
|
|
1247
|
+
return r !== null && r.state === HANDLER_STREAMING && r.pendingEnd === r.pendingStart
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1240
1250
|
/**
|
|
1241
1251
|
* Whether `slot`'s send can wait for `flush`: `deferSends` turned that on, it has output to send, the
|
|
1242
1252
|
* output is still roomy, so more answers fit behind it, and no request on
|
|
@@ -2659,6 +2669,14 @@ export const openHttpHandler = (
|
|
|
2659
2669
|
return Ok(new HttpHandler(limits, listener, router, loop))
|
|
2660
2670
|
}
|
|
2661
2671
|
|
|
2672
|
+
/** Panics unless `limits` can make a handler: a limit below its least is the program's mistake. */
|
|
2673
|
+
const handlerCheckLimits = (limits: HandlerLimits): void => {
|
|
2674
|
+
const fault: string = handlerLimitsFault(limits)
|
|
2675
|
+
if (fault.length > 0) {
|
|
2676
|
+
panic(fault)
|
|
2677
|
+
}
|
|
2678
|
+
}
|
|
2679
|
+
|
|
2662
2680
|
/** Why `limits` cannot make a handler, or `""` when it can. */
|
|
2663
2681
|
const handlerLimitsFault = (limits: HandlerLimits): string => {
|
|
2664
2682
|
if (limits.slots < 1 || limits.jsonBytes < 256 || limits.maxEvents < 1 || limits.bodyTimeout < 1) {
|