@ai-ecoverse/slicc-kernel 1.106.2 → 1.106.3

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/dist/node.js CHANGED
@@ -6435,7 +6435,7 @@ function satisfies(version, range) {
6435
6435
  }
6436
6436
 
6437
6437
  // src/version.ts
6438
- var KERNEL_VERSION = true ? "1.106.2" : "0.0.0-dev";
6438
+ var KERNEL_VERSION = true ? "1.106.3" : "0.0.0-dev";
6439
6439
  var OS_RELEASE = "6.0.0-slicc";
6440
6440
  function procVersion() {
6441
6441
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -12682,9 +12682,10 @@ var MAX_UNREAD = 16 * 1024 * 1024;
12682
12682
  function errno(code, message3) {
12683
12683
  return Object.assign(new Error(`${code}: ${message3}`), { code });
12684
12684
  }
12685
- function requestHead(method, url, headers, extra) {
12685
+ function requestHead(method, url, headers, extra, first = []) {
12686
12686
  if (!TOKEN3.test(method)) throw errno("EINVAL", `method ${method}`);
12687
- const lines2 = [`${method} ${url.pathname}${url.search} HTTP/1.1`, `Host: ${url.host}`];
12687
+ const lines2 = [`${method} ${url.pathname}${url.search} HTTP/1.1`, `host: ${url.host}`];
12688
+ for (const [name2, value] of first) lines2.push(`${name2}: ${value}`);
12688
12689
  for (const [name2, value] of headers) {
12689
12690
  if (OWN_HEADERS.has(name2.toLowerCase())) continue;
12690
12691
  if (!TOKEN3.test(name2) || !SAFE_VALUE.test(value)) throw errno("EINVAL", `header ${name2}`);
@@ -12799,8 +12800,8 @@ var KernelLoopback = class {
12799
12800
  async fetch(req, port) {
12800
12801
  const url = new URL(req.url);
12801
12802
  const body = req.body ?? (/^(POST|PUT|PATCH)$/i.test(req.method) ? new Uint8Array(0) : void 0);
12802
- const length2 = body ? [["Content-Length", String(body.length)]] : [];
12803
- const head = requestHead(req.method, url, req.headers, [...length2, ["Connection", "close"]]);
12803
+ const length2 = body ? [["content-length", String(body.length)]] : [];
12804
+ const head = requestHead(req.method, url, req.headers, length2, [["connection", "close"]]);
12804
12805
  const socket = await this.connect(url, port, req.signal);
12805
12806
  try {
12806
12807
  await writeAll2(socket, body ? concat([head, body]) : head, req.signal);
@@ -12893,7 +12894,7 @@ var LoopbackWebSocket = class {
12893
12894
  const queue = [];
12894
12895
  let wake;
12895
12896
  let ended = false;
12896
- void this.pump(new WsReader(incoming, void 0, true, true), (message3) => {
12897
+ void this.pump(incoming, (message3) => {
12897
12898
  queue.push(message3);
12898
12899
  this.unread += message3.length;
12899
12900
  wake?.();
@@ -12948,7 +12949,8 @@ var LoopbackWebSocket = class {
12948
12949
  this.pending -= bytes.length;
12949
12950
  })();
12950
12951
  }
12951
- async pump(reader, deliver) {
12952
+ async pump(incoming, deliver) {
12953
+ const reader = new WsReader(incoming, void 0, true, true);
12952
12954
  let close = { code: 1006, reason: "", wasClean: false };
12953
12955
  try {
12954
12956
  for (; ; ) {
@@ -12970,11 +12972,18 @@ var LoopbackWebSocket = class {
12970
12972
  } finally {
12971
12973
  const late = setTimeout(() => this.stop.abort(), CLOSE_WAIT_MS3);
12972
12974
  await this.writes;
12975
+ if (close.wasClean) await this.serverEnd(incoming);
12973
12976
  clearTimeout(late);
12974
12977
  this.socket.close();
12975
12978
  this.settle(close);
12976
12979
  }
12977
12980
  }
12981
+ async serverEnd(incoming) {
12982
+ try {
12983
+ while ((await incoming.some(64 * 1024, this.stop.signal)).length > 0) ;
12984
+ } catch {
12985
+ }
12986
+ }
12978
12987
  sendClose(code, reason) {
12979
12988
  if (this.sentClose) return;
12980
12989
  this.sentClose = true;