@jeffusion/bungee-core 5.6.1 → 5.6.2

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.
Files changed (2) hide show
  1. package/dist/main.js +34 -24
  2. package/package.json +2 -2
package/dist/main.js CHANGED
@@ -12479,7 +12479,7 @@ var package_default;
12479
12479
  var init_package = __esm(() => {
12480
12480
  package_default = {
12481
12481
  name: "@jeffusion/bungee-core",
12482
- version: "5.6.1",
12482
+ version: "5.6.2",
12483
12483
  description: "Bungee reverse proxy core engine",
12484
12484
  main: "./dist/main.js",
12485
12485
  types: "./dist/main.d.ts",
@@ -188233,8 +188233,6 @@ function restoreWorkerTransportRequest(request, transportSecret) {
188233
188233
  }
188234
188234
  }
188235
188235
  const headers = new Headers(request.headers);
188236
- if (identity)
188237
- headers.delete("authorization");
188238
188236
  const strippedHeaders = [];
188239
188237
  headers.forEach((_value, name) => {
188240
188238
  if (name.startsWith("x-bungee-internal-") || name === "x-bungee-next-authorization") {
@@ -211624,8 +211622,6 @@ async function proxyRequest(requestSnapshot, route, upstream, requestLog, config
211624
211622
  stripCredentialHeaders(hookHeaders, managedCredential.policy);
211625
211623
  stripHopHeaders(hookHeaders);
211626
211624
  const finalTargetUrl = new URL(targetUrlForRequest.href);
211627
- if (attemptOptions?.beforeSend)
211628
- hookHeaders.delete("authorization");
211629
211625
  const credentialExpectedPath = finalTargetUrl.pathname;
211630
211626
  let credentialRequest;
211631
211627
  if (managedCredential) {
@@ -230877,7 +230873,6 @@ function privateRequestHeaders(request, transportSecret, trustedPeer, identity)
230877
230873
  }
230878
230874
  if (identity) {
230879
230875
  const wire = JSON.stringify(identity);
230880
- headers.delete("authorization");
230881
230876
  headers.set(INTERNAL_DATA_IDENTITY_HEADER, wire);
230882
230877
  headers.set(INTERNAL_DATA_IDENTITY_MAC_HEADER, signDataIdentity(wire, request.method, request.url, transportSecret));
230883
230878
  }
@@ -233562,27 +233557,42 @@ class SupervisedConfigWorkerProcessAdapter {
233562
233557
  throw new Error("supervised worker control message is unsupported");
233563
233558
  if (message.command === "drain-worker")
233564
233559
  this.drainCommand = message;
233560
+ const startedAt = performance.now();
233565
233561
  let deadline;
233566
- if (message.command === "drain-worker") {
233567
- if (message.start_boot_id !== this.kernelBootId)
233568
- throw new Error("worker start deadline boot identity is unknown or mismatched");
233569
- const remaining = BigInt(message.start_deadline_ns) - process.hrtime.bigint();
233570
- if (remaining <= 0n)
233571
- throw new Error("worker drain start deadline expired before control dispatch");
233572
- deadline = performance.now() + Number((remaining + 999999n) / 1000000n);
233573
- }
233574
- const client = await this.readyClient();
233575
- if (deadline !== undefined && performance.now() >= deadline) {
233576
- this.followDrain(client, message);
233577
- throw new Error("worker drain start deadline expired before control dispatch");
233578
- }
233579
233562
  try {
233580
- const status = message.command === "drain-worker" ? await client.drain(message, deadline) : await client.start(message);
233581
- this.lastStatus = status;
233582
- this.publish(status.evidence.message);
233583
- } finally {
233584
- if (message.command === "drain-worker")
233563
+ if (message.command === "drain-worker") {
233564
+ if (message.start_boot_id !== this.kernelBootId)
233565
+ throw new Error("worker start deadline boot identity is unknown or mismatched");
233566
+ const remaining = BigInt(message.start_deadline_ns) - process.hrtime.bigint();
233567
+ deadline = performance.now() + Number((remaining + 999999n) / 1000000n);
233568
+ if (remaining <= 0n)
233569
+ throw new Error("worker drain start deadline expired before control dispatch");
233570
+ }
233571
+ const client = await this.readyClient();
233572
+ if (deadline !== undefined && performance.now() >= deadline) {
233585
233573
  this.followDrain(client, message);
233574
+ throw new Error("worker drain start deadline expired before control dispatch");
233575
+ }
233576
+ try {
233577
+ const status = message.command === "drain-worker" ? await client.drain(message, deadline) : await client.start(message);
233578
+ this.lastStatus = status;
233579
+ this.publish(status.evidence.message);
233580
+ } finally {
233581
+ if (message.command === "drain-worker")
233582
+ this.followDrain(client, message);
233583
+ }
233584
+ } catch (error) {
233585
+ if (message.command === "drain-worker") {
233586
+ recordShutdownFailure("worker_drain_command", {
233587
+ pid: this.pid,
233588
+ origin: this.origin,
233589
+ elapsedMs: shutdownElapsedMs(startedAt),
233590
+ timeoutMs: message.policy.drain_start_timeout_ms,
233591
+ deadlineExceeded: deadline !== undefined && performance.now() >= deadline,
233592
+ commandOutcome: "failed"
233593
+ }, error);
233594
+ }
233595
+ throw error;
233586
233596
  }
233587
233597
  }
233588
233598
  followDrain(client, command) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jeffusion/bungee-core",
3
- "version": "5.6.1",
3
+ "version": "5.6.2",
4
4
  "description": "Bungee reverse proxy core engine",
5
5
  "main": "./dist/main.js",
6
6
  "types": "./dist/main.d.ts",
@@ -12,7 +12,7 @@
12
12
  "test": "bun test"
13
13
  },
14
14
  "dependencies": {
15
- "@jeffusion/bungee-types": "^5.6.1",
15
+ "@jeffusion/bungee-types": "^5.6.2",
16
16
  "@types/lodash-es": "^4.17.12",
17
17
  "acorn": "^8.15.0",
18
18
  "canonicalize": "3.0.0",