@fedify/fedify 2.5.0-dev.2448 → 2.5.0-dev.2494
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/README.md +3 -0
- package/dist/{builder-DbC8bn6k.mjs → builder-Y3pokaG2.mjs} +2 -2
- package/dist/{client-D-XP_Ccb.d.cts → client-3InDZbba.d.cts} +0 -1
- package/dist/{client-D-XP_Ccb.d.ts → client-3InDZbba.d.ts} +0 -1
- package/dist/{client-CEnNz8O7.mjs → client-5SIFzW3q.mjs} +113 -64
- package/dist/compat/mod.d.cts +1 -1
- package/dist/compat/mod.d.ts +1 -1
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{compound-proof-heeXW2_A.mjs → compound-proof-BM7AINht.mjs} +2 -2
- package/dist/{context-GlHrzdSP.d.ts → context-DQJE9YfH.d.ts} +29 -3
- package/dist/{context-BazwQrHn.d.cts → context-DSuL3YWx.d.cts} +29 -3
- package/dist/{deno-Dpewt_jJ.mjs → deno-D7blYLbb.mjs} +1 -1
- package/dist/docloader-DbBbDaY-.mjs +136 -0
- package/dist/{exporter-DThFfe7P.mjs → exporter-DVG68ozH.mjs} +36 -30
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/compound-fanout.test.mjs +6 -3
- package/dist/federation/handler-compound-proof.test.mjs +3 -3
- package/dist/federation/handler.test.mjs +5 -5
- package/dist/federation/hashlink-media.test.mjs +2 -2
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/inbox-actorless.test.mjs +5 -5
- package/dist/federation/inbox-report.test.mjs +5 -5
- package/dist/federation/inbox-view.test.mjs +1 -1
- package/dist/federation/inbox.test.mjs +1 -1
- package/dist/federation/metrics.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +468 -33
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.d.cts +3 -3
- package/dist/federation/mod.d.ts +3 -3
- package/dist/federation/mod.js +1 -1
- package/dist/federation/mq.test.mjs +1 -1
- package/dist/federation/outgoing-proof.test.mjs +9 -6
- package/dist/federation/portable-actor.test.mjs +3 -3
- package/dist/federation/portable-chain.test.mjs +3 -3
- package/dist/federation/portable-collection.test.mjs +4 -4
- package/dist/federation/portable-delivery.test.mjs +2 -2
- package/dist/federation/portable-gateway-keys.test.mjs +11 -5
- package/dist/federation/portable-inbox.test.mjs +4 -4
- package/dist/federation/portable-parse-uri.test.mjs +1 -1
- package/dist/federation/portable-route-activity.test.mjs +2 -2
- package/dist/federation/portable.test.mjs +3 -3
- package/dist/federation/send.test.mjs +502 -93
- package/dist/federation/tasks/enqueue.test.mjs +1 -1
- package/dist/federation/tasks/tasks.test.mjs +2 -2
- package/dist/federation/temporal.test.mjs +1 -1
- package/dist/federation/webfinger.test.mjs +1 -1
- package/dist/{federation-D8YexkP1.cjs → federation-CFaTsSMN.cjs} +246 -108
- package/dist/{http-CAl7Num5.cjs → http-2SwIR4b-.cjs} +179 -110
- package/dist/{http-BBr-VLil.js → http-CrYxBKqG.js} +178 -109
- package/dist/{http-BZkyQIkb.mjs → http-CxKd10Lq.mjs} +204 -106
- package/dist/{inbox-wDuMKaFW.mjs → inbox-CM0UktG8.mjs} +2 -2
- package/dist/{inbox-view-NE9wXdLo.mjs → inbox-view-BJ5DBPFo.mjs} +1 -1
- package/dist/{key-nYGY4QB9.d.cts → key-DbLNT-vA.d.ts} +1 -2
- package/dist/{key-DhsBxxZN.d.ts → key-DlHT4R6k.d.cts} +1 -2
- package/dist/{kv-cache-CTQSfkmp.mjs → kv-cache-CIdGATck.mjs} +1 -1
- package/dist/{kv-cache-CjgCOz3i.cjs → kv-cache-Cd8xKv-x.cjs} +72 -27
- package/dist/{kv-cache-U7uz5nx4.js → kv-cache-DbgFe35y.js} +73 -28
- package/dist/{ld-Cel1RRZ5.d.cts → ld-CWVpo_NM.d.cts} +1 -1
- package/dist/{ld-CQFuiah9.mjs → ld-DUeBHFWH.mjs} +2 -2
- package/dist/{ld-CcuZ4NZa.d.ts → ld-Inagww4R.d.ts} +1 -1
- package/dist/{metrics-B-QxRSSR.mjs → metrics-B7TvoAP7.mjs} +1 -1
- package/dist/{middleware-BdlNa8BD.mjs → middleware-BE4JXx-U.mjs} +1 -1
- package/dist/{middleware-CuVa0UuS.mjs → middleware-BEaUojg7.mjs} +89 -49
- package/dist/{middleware-P-AZEQMn.js → middleware-CId6efsJ.js} +247 -109
- package/dist/{mod-DvWOv2Ho.d.cts → mod-6TQ4UQZb.d.cts} +1 -1
- package/dist/{mod-BHQE-7WQ.d.ts → mod-B4kBw1-8.d.ts} +1 -1
- package/dist/{mod-DkhfZC1u.d.ts → mod-B7j30IQf.d.ts} +2 -9
- package/dist/{mod-B2783_3v.d.cts → mod-C1nT74IG.d.cts} +1 -1
- package/dist/{mod-DjZfJj9R.d.ts → mod-CIeBgsOC.d.ts} +1 -1
- package/dist/{mod-B5-wdzmJ.d.cts → mod-YvA4Rk8J.d.cts} +2 -9
- package/dist/mod.cjs +5 -5
- package/dist/mod.d.cts +7 -7
- package/dist/mod.d.ts +7 -7
- package/dist/mod.js +5 -5
- package/dist/nodeinfo/client.test.mjs +337 -19
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/nodeinfo/mod.cjs +1 -1
- package/dist/nodeinfo/mod.d.cts +1 -1
- package/dist/nodeinfo/mod.d.ts +1 -1
- package/dist/nodeinfo/mod.js +1 -1
- package/dist/otel/exporter.test.mjs +257 -1
- package/dist/otel/mod.cjs +36 -30
- package/dist/otel/mod.d.cts +13 -0
- package/dist/otel/mod.d.ts +13 -0
- package/dist/otel/mod.js +36 -30
- package/dist/{owner-ccKkQOAf.mjs → owner-CwijV0c5.mjs} +3 -3
- package/dist/{portable-collection-DUlQ3s2M.js → portable-collection-2jn_4V7Y.js} +1 -1
- package/dist/{portable-collection-CndnpXfo.mjs → portable-collection-B023xqhZ.mjs} +2 -2
- package/dist/{portable-collection-TC-kvkVI.cjs → portable-collection-BeS88JJp.cjs} +1 -1
- package/dist/{portable-key-D5tFOoV-.mjs → portable-key-BpBucRfb.mjs} +1 -1
- package/dist/{proof-DPoF06nz.mjs → proof-DQh2z9fx.mjs} +3 -3
- package/dist/{send-CF44O1Df.mjs → send-DN5HNBv-.mjs} +174 -76
- package/dist/sig/compound-proof-discovery.test.mjs +1 -1
- package/dist/sig/compound-proof-producer.test.mjs +1 -1
- package/dist/sig/compound-proof-verification.test.mjs +2 -2
- package/dist/sig/compound-proof.test.mjs +2 -2
- package/dist/sig/http.test.mjs +553 -2
- package/dist/sig/key.test.mjs +1 -1
- package/dist/sig/ld.test.mjs +1 -1
- package/dist/sig/mitra-receive-interop.test.mjs +4 -4
- package/dist/sig/mitra-send-interop.test.mjs +3 -3
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.d.cts +3 -3
- package/dist/sig/mod.d.ts +3 -3
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +1 -1
- package/dist/sig/portable-collection.test.mjs +1 -1
- package/dist/sig/portable-interop.test.mjs +3 -3
- package/dist/sig/portable-key.test.mjs +5 -5
- package/dist/sig/proof.test.mjs +4 -4
- package/dist/sig/tootik-request-interop.test.mjs +4 -4
- package/dist/sig/tootik-send-interop.test.mjs +3 -3
- package/dist/sig/verification.test.mjs +3 -3
- package/dist/{temporal-XlZ4Wb94.mjs → temporal-yl7Z7A6y.mjs} +1 -1
- package/dist/testing/kv.test.mjs +1 -1
- package/dist/testing/mod.d.mts +26 -0
- package/dist/{types-_S2_MeLF.js → types-DUjZb4i6.js} +112 -63
- package/dist/{types-poIao40f.cjs → types-hKCCjii0.cjs} +111 -62
- package/dist/utils/docloader.test.mjs +344 -36
- package/dist/utils/kv-cache.test.mjs +1 -1
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.d.cts +1 -1
- package/dist/utils/mod.d.ts +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +8 -8
- package/dist/docloader-CpsDyqVN.mjs +0 -91
|
@@ -17,7 +17,7 @@ json_canon = require_rolldown_runtime.__toESM(json_canon, 1);
|
|
|
17
17
|
let _opentelemetry_semantic_conventions = require("@opentelemetry/semantic-conventions");
|
|
18
18
|
//#region deno.json
|
|
19
19
|
var name = "@fedify/fedify";
|
|
20
|
-
var version = "2.5.0-dev.
|
|
20
|
+
var version = "2.5.0-dev.2494+f2e9b5d3";
|
|
21
21
|
//#endregion
|
|
22
22
|
//#region src/sig/portable-key-id.ts
|
|
23
23
|
const COMPATIBLE_KEY_ID_PATH_PATTERN = /^\/\.well-known\/apgateway\/did(?::|%3A)/i;
|
|
@@ -10165,10 +10165,10 @@ async function createRedirectRequest(request, location, body, validateRedirect)
|
|
|
10165
10165
|
cache: request.cache
|
|
10166
10166
|
});
|
|
10167
10167
|
}
|
|
10168
|
-
async function fetchDoubleKnockRequest(request, signedRequest, signal) {
|
|
10168
|
+
async function fetchDoubleKnockRequest(session, request, signedRequest, signal) {
|
|
10169
10169
|
const maxAttempts = request.method === "GET" || request.method === "HEAD" ? 2 : 1;
|
|
10170
10170
|
for (let attempt = 1;; attempt++) try {
|
|
10171
|
-
return await fetch(signedRequest, {
|
|
10171
|
+
return await session.fetch(signedRequest, {
|
|
10172
10172
|
redirect: "manual",
|
|
10173
10173
|
signal
|
|
10174
10174
|
});
|
|
@@ -10219,125 +10219,194 @@ function getAbortReason(signal) {
|
|
|
10219
10219
|
return signal.reason ?? new DOMException("The operation was aborted.", "AbortError");
|
|
10220
10220
|
}
|
|
10221
10221
|
/**
|
|
10222
|
-
* Performs a double-knock request
|
|
10223
|
-
*
|
|
10224
|
-
*
|
|
10222
|
+
* Performs a double-knock request like {@link doubleKnock}, opening a session
|
|
10223
|
+
* for every hop with the given function, and passes the final response to
|
|
10224
|
+
* the given function. The final session is closed after `consume` settles,
|
|
10225
|
+
* so `consume` must read or cancel the response body before it returns.
|
|
10226
|
+
* This is not exported from any entry point.
|
|
10225
10227
|
* @param request The request to send.
|
|
10226
10228
|
* @param identity The identity to use for signing the request.
|
|
10227
10229
|
* @param options The options for double-knock requests.
|
|
10228
|
-
* @
|
|
10229
|
-
*
|
|
10230
|
+
* @param openHop The function to open a session for each hop. The session of
|
|
10231
|
+
* a hop is closed before the next hop is opened.
|
|
10232
|
+
* @param consume The function to consume the final response.
|
|
10233
|
+
* @returns The value returned by `consume`.
|
|
10230
10234
|
*/
|
|
10231
|
-
async function
|
|
10232
|
-
|
|
10235
|
+
async function doubleKnockScoped(request, identity, options, openHop, consume) {
|
|
10236
|
+
const { response, session } = await doubleKnockCore(request, identity, options, openHop);
|
|
10237
|
+
try {
|
|
10238
|
+
return await consume(response);
|
|
10239
|
+
} catch (error) {
|
|
10240
|
+
(0, _logtape_logtape.getLogger)([
|
|
10241
|
+
"fedify",
|
|
10242
|
+
"sig",
|
|
10243
|
+
"http"
|
|
10244
|
+
]).debug("Failed to consume the response from {url}; closing the session: {error}", {
|
|
10245
|
+
url: request.url,
|
|
10246
|
+
error
|
|
10247
|
+
});
|
|
10248
|
+
throw error;
|
|
10249
|
+
} finally {
|
|
10250
|
+
await session.close();
|
|
10251
|
+
}
|
|
10252
|
+
}
|
|
10253
|
+
function isRedirectResponse(response) {
|
|
10254
|
+
return response.status >= 300 && response.status < 400 && response.headers.has("Location");
|
|
10255
|
+
}
|
|
10256
|
+
/**
|
|
10257
|
+
* Starts cancelling the body of a response that is not passed to the caller,
|
|
10258
|
+
* without waiting for it to settle. The cancellation of a branch of a tee
|
|
10259
|
+
* (e.g., a body cloned by a fetch mock) settles only after the other branch
|
|
10260
|
+
* is cancelled too, per the Streams standard, so awaiting it could block
|
|
10261
|
+
* forever. Failures are only logged.
|
|
10262
|
+
*/
|
|
10263
|
+
function cancelResponseBody(response, url) {
|
|
10264
|
+
response.body?.cancel().catch((error) => {
|
|
10265
|
+
(0, _logtape_logtape.getLogger)([
|
|
10266
|
+
"fedify",
|
|
10267
|
+
"sig",
|
|
10268
|
+
"http"
|
|
10269
|
+
]).debug("Failed to cancel the response body from {url}: {error}", {
|
|
10270
|
+
url,
|
|
10271
|
+
error
|
|
10272
|
+
});
|
|
10273
|
+
});
|
|
10233
10274
|
}
|
|
10234
|
-
async function
|
|
10275
|
+
async function doubleKnockCore(request, identity, options, openHop) {
|
|
10235
10276
|
const { specDeterminer, log, tracerProvider, signal } = options;
|
|
10236
10277
|
signal?.throwIfAborted();
|
|
10237
10278
|
const maximumRedirection = options.maxRedirection ?? DEFAULT_MAX_REDIRECTION;
|
|
10238
|
-
visited
|
|
10239
|
-
const origin = new URL(request.url).origin;
|
|
10240
|
-
const firstTrySpec = specDeterminer == null ? "rfc9421" : await specDeterminer.determineSpec(origin);
|
|
10241
|
-
signal?.throwIfAborted();
|
|
10279
|
+
const visited = /* @__PURE__ */ new Set();
|
|
10242
10280
|
const body = options.body !== void 0 ? options.body : request.method !== "GET" && request.method !== "HEAD" ? await request.clone().arrayBuffer() : null;
|
|
10243
|
-
let
|
|
10244
|
-
|
|
10245
|
-
|
|
10246
|
-
|
|
10247
|
-
|
|
10248
|
-
|
|
10249
|
-
|
|
10250
|
-
|
|
10251
|
-
|
|
10252
|
-
|
|
10253
|
-
|
|
10254
|
-
|
|
10255
|
-
|
|
10256
|
-
|
|
10257
|
-
|
|
10258
|
-
|
|
10259
|
-
|
|
10260
|
-
|
|
10261
|
-
|
|
10262
|
-
|
|
10263
|
-
|
|
10264
|
-
|
|
10265
|
-
|
|
10266
|
-
|
|
10267
|
-
|
|
10268
|
-
|
|
10269
|
-
|
|
10270
|
-
|
|
10271
|
-
|
|
10272
|
-
|
|
10273
|
-
|
|
10274
|
-
|
|
10275
|
-
|
|
10276
|
-
|
|
10277
|
-
|
|
10278
|
-
|
|
10279
|
-
|
|
10280
|
-
|
|
10281
|
-
|
|
10282
|
-
|
|
10283
|
-
|
|
10284
|
-
|
|
10285
|
-
|
|
10281
|
+
let session = await openHop(request.url);
|
|
10282
|
+
try {
|
|
10283
|
+
for (let redirected = 0;; redirected++) {
|
|
10284
|
+
visited.add(request.url);
|
|
10285
|
+
const origin = new URL(request.url).origin;
|
|
10286
|
+
const firstTrySpec = specDeterminer == null ? "rfc9421" : await specDeterminer.determineSpec(origin);
|
|
10287
|
+
signal?.throwIfAborted();
|
|
10288
|
+
let signedRequest = await signRequest(request, identity.privateKey, identity.keyId, {
|
|
10289
|
+
spec: firstTrySpec,
|
|
10290
|
+
tracerProvider,
|
|
10291
|
+
body
|
|
10292
|
+
});
|
|
10293
|
+
signal?.throwIfAborted();
|
|
10294
|
+
log?.(signedRequest);
|
|
10295
|
+
let response = await fetchDoubleKnockRequest(session, request, signedRequest, signal);
|
|
10296
|
+
const firstRedirected = isRedirectResponse(response);
|
|
10297
|
+
if (!firstRedirected && (response.status === 400 || response.status === 401 || response.status > 401)) {
|
|
10298
|
+
const logger = (0, _logtape_logtape.getLogger)([
|
|
10299
|
+
"fedify",
|
|
10300
|
+
"sig",
|
|
10301
|
+
"http"
|
|
10302
|
+
]);
|
|
10303
|
+
const acceptSigHeader = response.headers.get("Accept-Signature");
|
|
10304
|
+
if (acceptSigHeader != null) {
|
|
10305
|
+
const entries = validateAcceptSignature(parseAcceptSignature(acceptSigHeader));
|
|
10306
|
+
const localKeyId = identity.keyId.href;
|
|
10307
|
+
const localAlg = "rsa-v1_5-sha256";
|
|
10308
|
+
let fulfilled = false;
|
|
10309
|
+
let challengeRequest;
|
|
10310
|
+
for (const entry of entries) {
|
|
10311
|
+
signal?.throwIfAborted();
|
|
10312
|
+
const rfc9421 = fulfillAcceptSignature(entry, localKeyId, localAlg);
|
|
10313
|
+
if (rfc9421 == null) continue;
|
|
10314
|
+
logger.debug("Received Accept-Signature challenge; accumulating label {label} and components {components}.", {
|
|
10315
|
+
label: rfc9421.label,
|
|
10316
|
+
components: rfc9421.components
|
|
10317
|
+
});
|
|
10318
|
+
try {
|
|
10319
|
+
challengeRequest = await signRequest(challengeRequest ?? request, identity.privateKey, identity.keyId, {
|
|
10320
|
+
spec: "rfc9421",
|
|
10321
|
+
tracerProvider,
|
|
10322
|
+
body,
|
|
10323
|
+
rfc9421
|
|
10324
|
+
});
|
|
10325
|
+
fulfilled = true;
|
|
10326
|
+
} catch (error) {
|
|
10327
|
+
logger.debug("Failed to fulfill Accept-Signature challenge entry {label}: {error}", {
|
|
10328
|
+
label: entry.label,
|
|
10329
|
+
error
|
|
10330
|
+
});
|
|
10331
|
+
}
|
|
10332
|
+
}
|
|
10333
|
+
if (fulfilled && challengeRequest != null) {
|
|
10334
|
+
signal?.throwIfAborted();
|
|
10335
|
+
cancelResponseBody(response, request.url);
|
|
10336
|
+
signedRequest = challengeRequest;
|
|
10337
|
+
log?.(signedRequest);
|
|
10338
|
+
response = await session.fetch(signedRequest, {
|
|
10339
|
+
redirect: "manual",
|
|
10340
|
+
signal
|
|
10341
|
+
});
|
|
10342
|
+
}
|
|
10343
|
+
if (fulfilled && !isRedirectResponse(response)) {
|
|
10344
|
+
if (response.status < 300) {
|
|
10345
|
+
await specDeterminer?.rememberSpec(origin, "rfc9421");
|
|
10346
|
+
return {
|
|
10347
|
+
response,
|
|
10348
|
+
session
|
|
10349
|
+
};
|
|
10350
|
+
}
|
|
10351
|
+
if (response.status !== 400 && response.status !== 401) return {
|
|
10352
|
+
response,
|
|
10353
|
+
session
|
|
10354
|
+
};
|
|
10355
|
+
}
|
|
10356
|
+
}
|
|
10357
|
+
if (!isRedirectResponse(response)) {
|
|
10358
|
+
const spec = firstTrySpec === "draft-cavage-http-signatures-12" ? "rfc9421" : "draft-cavage-http-signatures-12";
|
|
10359
|
+
(0, _logtape_logtape.getLogger)([
|
|
10360
|
+
"fedify",
|
|
10361
|
+
"sig",
|
|
10362
|
+
"http"
|
|
10363
|
+
]).debug("Failed to verify with the spec {spec} ({status} {statusText}); retrying with spec {secondSpec}... (double-knocking)", {
|
|
10364
|
+
spec: firstTrySpec,
|
|
10365
|
+
secondSpec: spec,
|
|
10366
|
+
status: response.status,
|
|
10367
|
+
statusText: response.statusText
|
|
10286
10368
|
});
|
|
10287
|
-
|
|
10288
|
-
|
|
10289
|
-
|
|
10290
|
-
|
|
10291
|
-
|
|
10369
|
+
cancelResponseBody(response, request.url);
|
|
10370
|
+
signal?.throwIfAborted();
|
|
10371
|
+
signedRequest = await signRequest(request, identity.privateKey, identity.keyId, {
|
|
10372
|
+
spec,
|
|
10373
|
+
tracerProvider,
|
|
10374
|
+
body
|
|
10292
10375
|
});
|
|
10376
|
+
signal?.throwIfAborted();
|
|
10377
|
+
log?.(signedRequest);
|
|
10378
|
+
response = await fetchDoubleKnockRequest(session, request, signedRequest, signal);
|
|
10379
|
+
if (!isRedirectResponse(response) && response.status !== 400 && response.status !== 401) await specDeterminer?.rememberSpec(origin, spec);
|
|
10293
10380
|
}
|
|
10294
|
-
}
|
|
10295
|
-
if (
|
|
10296
|
-
|
|
10297
|
-
|
|
10298
|
-
|
|
10299
|
-
|
|
10300
|
-
|
|
10301
|
-
signal
|
|
10302
|
-
});
|
|
10303
|
-
if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) return doubleKnock(await createRedirectRequest(request, response.headers.get("Location"), body, options.validateRedirect), identity, {
|
|
10304
|
-
...options,
|
|
10305
|
-
body
|
|
10306
|
-
});
|
|
10307
|
-
}
|
|
10308
|
-
if (fulfilled && response.status < 300) {
|
|
10309
|
-
await specDeterminer?.rememberSpec(origin, "rfc9421");
|
|
10310
|
-
return response;
|
|
10311
|
-
}
|
|
10312
|
-
if (fulfilled && response.status !== 400 && response.status !== 401) return response;
|
|
10313
|
-
}
|
|
10314
|
-
const spec = firstTrySpec === "draft-cavage-http-signatures-12" ? "rfc9421" : "draft-cavage-http-signatures-12";
|
|
10315
|
-
logger.debug("Failed to verify with the spec {spec} ({status} {statusText}); retrying with spec {secondSpec}... (double-knocking)", {
|
|
10316
|
-
spec: firstTrySpec,
|
|
10317
|
-
secondSpec: spec,
|
|
10318
|
-
status: response.status,
|
|
10319
|
-
statusText: response.statusText
|
|
10320
|
-
});
|
|
10321
|
-
signal?.throwIfAborted();
|
|
10322
|
-
signedRequest = await signRequest(request, identity.privateKey, identity.keyId, {
|
|
10323
|
-
spec,
|
|
10324
|
-
tracerProvider,
|
|
10325
|
-
body
|
|
10326
|
-
});
|
|
10327
|
-
signal?.throwIfAborted();
|
|
10328
|
-
log?.(signedRequest);
|
|
10329
|
-
response = await fetchDoubleKnockRequest(request, signedRequest, signal);
|
|
10330
|
-
if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) {
|
|
10381
|
+
} else if (!firstRedirected) await specDeterminer?.rememberSpec(origin, firstTrySpec);
|
|
10382
|
+
if (!isRedirectResponse(response)) return {
|
|
10383
|
+
response,
|
|
10384
|
+
session
|
|
10385
|
+
};
|
|
10386
|
+
cancelResponseBody(response, request.url);
|
|
10387
|
+
await session.close();
|
|
10331
10388
|
if (redirected >= maximumRedirection) throw new _fedify_vocab_runtime.FetchError(request.url, `Too many redirections (${redirected + 1})`);
|
|
10332
|
-
const
|
|
10389
|
+
const location = response.headers.get("Location");
|
|
10390
|
+
const redirectRequest = await createRedirectRequest(request, location, body, options.validateRedirect);
|
|
10333
10391
|
if (visited.has(redirectRequest.url)) throw new _fedify_vocab_runtime.FetchError(request.url, `Redirect loop detected: ${redirectRequest.url}`);
|
|
10334
|
-
|
|
10335
|
-
|
|
10336
|
-
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
|
-
|
|
10392
|
+
request = redirectRequest;
|
|
10393
|
+
session = await openHop(request.url);
|
|
10394
|
+
}
|
|
10395
|
+
} catch (error) {
|
|
10396
|
+
try {
|
|
10397
|
+
await session.close();
|
|
10398
|
+
} catch (closeError) {
|
|
10399
|
+
(0, _logtape_logtape.getLogger)([
|
|
10400
|
+
"fedify",
|
|
10401
|
+
"sig",
|
|
10402
|
+
"http"
|
|
10403
|
+
]).debug("Failed to close the session for {url}: {error}", {
|
|
10404
|
+
url: request.url,
|
|
10405
|
+
error: closeError
|
|
10406
|
+
});
|
|
10407
|
+
}
|
|
10408
|
+
throw error;
|
|
10409
|
+
}
|
|
10341
10410
|
}
|
|
10342
10411
|
/**
|
|
10343
10412
|
* Performs a timing-safe equality comparison between two `Uint8Array` values.
|
|
@@ -10433,10 +10502,10 @@ Object.defineProperty(exports, "detachSignature", {
|
|
|
10433
10502
|
return detachSignature;
|
|
10434
10503
|
}
|
|
10435
10504
|
});
|
|
10436
|
-
Object.defineProperty(exports, "
|
|
10505
|
+
Object.defineProperty(exports, "doubleKnockScoped", {
|
|
10437
10506
|
enumerable: true,
|
|
10438
10507
|
get: function() {
|
|
10439
|
-
return
|
|
10508
|
+
return doubleKnockScoped;
|
|
10440
10509
|
}
|
|
10441
10510
|
});
|
|
10442
10511
|
Object.defineProperty(exports, "exportJwk", {
|