@fedify/fedify 2.1.29 → 2.1.31
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/{builder-Mg2G3qj8.mjs → builder-isMRh_I6.mjs} +3 -3
- package/dist/{client-CAM_bQXx.d.cts → client-BIBzqEIp.d.cts} +0 -1
- package/dist/{client-CjDMsn4a.mjs → client-BZr7TGyu.mjs} +113 -64
- package/dist/{client-CSddvgWN.d.ts → client-jE7oGvRh.d.ts} +0 -1
- 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/{context-DLLaDau8.d.ts → context-C0uGVzgk.d.ts} +28 -2
- package/dist/{context-BNwv9Q1v.d.cts → context-CLaLxi49.d.cts} +28 -2
- package/dist/{deno-BiYv5RT5.mjs → deno-CiaJqTcu.mjs} +1 -1
- package/dist/docloader-DOrwedT7.mjs +124 -0
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/handler.test.mjs +6 -6
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/inbox.test.mjs +1 -1
- package/dist/federation/keycache.test.mjs +18 -7
- package/dist/federation/middleware.test.mjs +380 -24
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.d.cts +2 -2
- package/dist/federation/mod.d.ts +2 -2
- package/dist/federation/mod.js +1 -1
- package/dist/federation/send.test.mjs +445 -70
- package/dist/federation/temporal.test.mjs +1 -1
- package/dist/federation/webfinger.test.mjs +1 -1
- package/dist/{http-Dl00HXr4.d.ts → http-9IFUxdkp.d.cts} +1 -2
- package/dist/{http-C1ga9WQu.mjs → http-A9mP2uM7.mjs} +194 -96
- package/dist/{http-Cginz7L0.cjs → http-CRiVlZd5.cjs} +188 -105
- package/dist/{http-B3rSb2GQ.js → http-Crml3gei.js} +187 -104
- package/dist/{http-DqZhyEso.d.cts → http-SbfezERn.d.ts} +1 -2
- package/dist/{inbox-BWzL0xMU.mjs → inbox-KESLudq4.mjs} +1 -1
- package/dist/{key-O-ATwIGS.mjs → key-Dg6-DV_O.mjs} +17 -3
- package/dist/{keycache-RFlZObU3.mjs → keycache-DahCaG_m.mjs} +1 -1
- package/dist/{kv-cache-BdylAE9w.cjs → kv-cache-Cqmm-yQa.cjs} +59 -15
- package/dist/{kv-cache-8Kg2CHiD.js → kv-cache-DQcyZL5T.js} +60 -16
- package/dist/{ld-C-fCGM-z.mjs → ld-COjDN6Nb.mjs} +2 -2
- package/dist/{middleware-CVRFS7PZ.cjs → middleware-BbgR7xOI.cjs} +185 -60
- package/dist/{middleware-VvrqPwHL.cjs → middleware-BtDQUCcz.cjs} +1 -1
- package/dist/{middleware-C9UCWOqw.mjs → middleware-COFlKeYn.mjs} +79 -39
- package/dist/{middleware-CxgFiKI3.mjs → middleware-CuQvczZd.mjs} +1 -1
- package/dist/{middleware-41MkquTV.js → middleware-DIW5S_5L.js} +185 -60
- package/dist/{mod-DNEgTI8M.d.ts → mod-BRnwh2oy.d.ts} +2 -7
- package/dist/{mod-BLDHhuW0.d.ts → mod-C7w-QVUv.d.ts} +1 -1
- package/dist/{mod-CWJNbyju.d.ts → mod-CFRocFeQ.d.ts} +1 -1
- package/dist/{mod-BmlfRBmU.d.cts → mod-CGUH8Ujp.d.cts} +1 -1
- package/dist/{mod-Cn9GJ5ex.d.cts → mod-Co7LEK9X.d.cts} +2 -7
- package/dist/{mod-DiuFTYUt.d.cts → mod-LOEOKbYd.d.cts} +1 -1
- package/dist/mod.cjs +5 -5
- package/dist/mod.d.cts +6 -6
- package/dist/mod.d.ts +6 -6
- 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 +292 -30
- 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-C8IVASD3.mjs → owner-CFHq61cq.mjs} +2 -2
- package/dist/{proof-BbHMAkPG.cjs → proof-0JkSC_pT.cjs} +1 -1
- package/dist/{proof-cGfRPTiV.js → proof-DzksJFK7.js} +1 -1
- package/dist/{proof-CUdcBgvg.mjs → proof-KSHlbPCG.mjs} +2 -2
- package/dist/{send-BoV4dyVO.mjs → send-DaDe2YCb.mjs} +117 -32
- package/dist/sig/http.test.mjs +507 -3
- package/dist/sig/key.test.mjs +197 -3
- package/dist/sig/ld.test.mjs +47 -2
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.d.cts +2 -2
- package/dist/sig/mod.d.ts +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +46 -1
- package/dist/sig/proof.test.mjs +52 -1
- package/dist/{temporal-BJlnku_d.mjs → temporal-DNGH8o2E.mjs} +1 -1
- package/dist/testing/mod.d.mts +26 -1
- package/dist/{types-miAYfiGO.js → types-B1_pRFE_.js} +112 -63
- package/dist/{types-DRPjmHVV.cjs → types-DOvyymM4.cjs} +111 -62
- package/dist/utils/docloader.test.mjs +380 -32
- 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 +7 -7
- package/dist/docloader-DrxXBFL8.mjs +0 -80
|
@@ -11,7 +11,7 @@ let _opentelemetry_semantic_conventions = require("@opentelemetry/semantic-conve
|
|
|
11
11
|
let byte_encodings_base64 = require("byte-encodings/base64");
|
|
12
12
|
//#region deno.json
|
|
13
13
|
var name = "@fedify/fedify";
|
|
14
|
-
var version = "2.1.
|
|
14
|
+
var version = "2.1.31";
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region src/sig/accept.ts
|
|
17
17
|
/**
|
|
@@ -292,16 +292,23 @@ async function importJwk(jwk, type) {
|
|
|
292
292
|
/**
|
|
293
293
|
* Fetches the document that the given actor URI dereferences to, and returns
|
|
294
294
|
* the actor only if the host that served the document is authoritative for
|
|
295
|
-
* the id the document claims.
|
|
295
|
+
* the id the document claims, and that id is the actor that was asked for.
|
|
296
296
|
*
|
|
297
297
|
* Only the origin that serves an actor id can speak for it. Without that
|
|
298
298
|
* rule any host could serve a document describing somebody else's actor—and
|
|
299
299
|
* listing its own keys as that actor's.
|
|
300
300
|
*
|
|
301
|
+
* The returned actor always has exactly the requested `actorId` as its `id`.
|
|
302
|
+
* A document loader follows redirects and alternate document links, so the
|
|
303
|
+
* document an actor id leads to may describe a different actor altogether,
|
|
304
|
+
* on the same origin or on another; accepting it would attribute that other
|
|
305
|
+
* actor's keys to the requested one. See GHSA-8863-8468-7hq7.
|
|
306
|
+
*
|
|
301
307
|
* @param actorId The URI of the actor to fetch.
|
|
302
308
|
* @param options Options for fetching the document.
|
|
303
309
|
* @returns The actor, or `null` if the document cannot be fetched, is not an
|
|
304
|
-
* actor,
|
|
310
|
+
* actor, belongs to another origin, or describes an actor other
|
|
311
|
+
* than the requested one.
|
|
305
312
|
* @internal
|
|
306
313
|
*/
|
|
307
314
|
async function fetchActorDocument(actorId, options = {}) {
|
|
@@ -356,6 +363,13 @@ async function fetchActorDocumentInternal(actorId, options, propagateContextFetc
|
|
|
356
363
|
});
|
|
357
364
|
return null;
|
|
358
365
|
}
|
|
366
|
+
if (object.id.href !== actorId.href) {
|
|
367
|
+
logger.debug("The document fetched for the actor {actorId} is the actor {documentActorId} instead; refusing to treat it as the requested actor's document.", {
|
|
368
|
+
actorId: actorId.href,
|
|
369
|
+
documentActorId: object.id.href
|
|
370
|
+
});
|
|
371
|
+
return null;
|
|
372
|
+
}
|
|
359
373
|
return object;
|
|
360
374
|
}
|
|
361
375
|
/**
|
|
@@ -1584,10 +1598,10 @@ async function createRedirectRequest(request, location, body, validateRedirect)
|
|
|
1584
1598
|
cache: request.cache
|
|
1585
1599
|
});
|
|
1586
1600
|
}
|
|
1587
|
-
async function fetchDoubleKnockRequest(request, signedRequest, signal) {
|
|
1601
|
+
async function fetchDoubleKnockRequest(session, request, signedRequest, signal) {
|
|
1588
1602
|
const maxAttempts = request.method === "GET" || request.method === "HEAD" ? 2 : 1;
|
|
1589
1603
|
for (let attempt = 1;; attempt++) try {
|
|
1590
|
-
return await fetch(signedRequest, {
|
|
1604
|
+
return await session.fetch(signedRequest, {
|
|
1591
1605
|
redirect: "manual",
|
|
1592
1606
|
signal
|
|
1593
1607
|
});
|
|
@@ -1638,117 +1652,186 @@ function getAbortReason(signal) {
|
|
|
1638
1652
|
return signal.reason ?? new DOMException("The operation was aborted.", "AbortError");
|
|
1639
1653
|
}
|
|
1640
1654
|
/**
|
|
1641
|
-
* Performs a double-knock request
|
|
1642
|
-
*
|
|
1643
|
-
*
|
|
1655
|
+
* Performs a double-knock request like {@link doubleKnock}, opening a session
|
|
1656
|
+
* for every hop with the given function, and passes the final response to
|
|
1657
|
+
* the given function. The final session is closed after `consume` settles,
|
|
1658
|
+
* so `consume` must read or cancel the response body before it returns.
|
|
1659
|
+
* This is not exported from any entry point.
|
|
1644
1660
|
* @param request The request to send.
|
|
1645
1661
|
* @param identity The identity to use for signing the request.
|
|
1646
1662
|
* @param options The options for double-knock requests.
|
|
1647
|
-
* @
|
|
1648
|
-
*
|
|
1663
|
+
* @param openHop The function to open a session for each hop. The session of
|
|
1664
|
+
* a hop is closed before the next hop is opened.
|
|
1665
|
+
* @param consume The function to consume the final response.
|
|
1666
|
+
* @returns The value returned by `consume`.
|
|
1649
1667
|
*/
|
|
1650
|
-
async function
|
|
1651
|
-
|
|
1668
|
+
async function doubleKnockScoped(request, identity, options, openHop, consume) {
|
|
1669
|
+
const { response, session } = await doubleKnockCore(request, identity, options, openHop);
|
|
1670
|
+
try {
|
|
1671
|
+
return await consume(response);
|
|
1672
|
+
} catch (error) {
|
|
1673
|
+
(0, _logtape_logtape.getLogger)([
|
|
1674
|
+
"fedify",
|
|
1675
|
+
"sig",
|
|
1676
|
+
"http"
|
|
1677
|
+
]).debug("Failed to consume the response from {url}; closing the session: {error}", {
|
|
1678
|
+
url: request.url,
|
|
1679
|
+
error
|
|
1680
|
+
});
|
|
1681
|
+
throw error;
|
|
1682
|
+
} finally {
|
|
1683
|
+
await session.close();
|
|
1684
|
+
}
|
|
1652
1685
|
}
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) {
|
|
1667
|
-
if (redirected >= DEFAULT_MAX_REDIRECTION) throw new _fedify_vocab_runtime.FetchError(request.url, `Too many redirections (${redirected + 1})`);
|
|
1668
|
-
const redirectRequest = await createRedirectRequest(request, response.headers.get("Location"), body, options.validateRedirect);
|
|
1669
|
-
if (visited.has(redirectRequest.url)) throw new _fedify_vocab_runtime.FetchError(request.url, `Redirect loop detected: ${redirectRequest.url}`);
|
|
1670
|
-
return doubleKnockInternal(redirectRequest, identity, {
|
|
1671
|
-
...options,
|
|
1672
|
-
body
|
|
1673
|
-
}, redirected + 1, visited);
|
|
1674
|
-
} else if (response.status === 400 || response.status === 401 || response.status > 401) {
|
|
1675
|
-
const logger = (0, _logtape_logtape.getLogger)([
|
|
1686
|
+
function isRedirectResponse(response) {
|
|
1687
|
+
return response.status >= 300 && response.status < 400 && response.headers.has("Location");
|
|
1688
|
+
}
|
|
1689
|
+
/**
|
|
1690
|
+
* Starts cancelling the body of a response that is not passed to the caller,
|
|
1691
|
+
* without waiting for it to settle. The cancellation of a branch of a tee
|
|
1692
|
+
* (e.g., a body cloned by a fetch mock) settles only after the other branch
|
|
1693
|
+
* is cancelled too, per the Streams standard, so awaiting it could block
|
|
1694
|
+
* forever. Failures are only logged.
|
|
1695
|
+
*/
|
|
1696
|
+
function cancelResponseBody(response, url) {
|
|
1697
|
+
response.body?.cancel().catch((error) => {
|
|
1698
|
+
(0, _logtape_logtape.getLogger)([
|
|
1676
1699
|
"fedify",
|
|
1677
1700
|
"sig",
|
|
1678
1701
|
"http"
|
|
1679
|
-
])
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1702
|
+
]).debug("Failed to cancel the response body from {url}: {error}", {
|
|
1703
|
+
url,
|
|
1704
|
+
error
|
|
1705
|
+
});
|
|
1706
|
+
});
|
|
1707
|
+
}
|
|
1708
|
+
async function doubleKnockCore(request, identity, options, openHop) {
|
|
1709
|
+
const { specDeterminer, log, tracerProvider, signal } = options;
|
|
1710
|
+
const visited = /* @__PURE__ */ new Set();
|
|
1711
|
+
const body = options.body !== void 0 ? options.body : request.method !== "GET" && request.method !== "HEAD" ? await request.clone().arrayBuffer() : null;
|
|
1712
|
+
let session = await openHop(request.url);
|
|
1713
|
+
try {
|
|
1714
|
+
for (let redirected = 0;; redirected++) {
|
|
1715
|
+
visited.add(request.url);
|
|
1716
|
+
const origin = new URL(request.url).origin;
|
|
1717
|
+
const firstTrySpec = specDeterminer == null ? "rfc9421" : await specDeterminer.determineSpec(origin);
|
|
1718
|
+
let signedRequest = await signRequest(request, identity.privateKey, identity.keyId, {
|
|
1719
|
+
spec: firstTrySpec,
|
|
1720
|
+
tracerProvider,
|
|
1721
|
+
body
|
|
1722
|
+
});
|
|
1723
|
+
log?.(signedRequest);
|
|
1724
|
+
let response = await fetchDoubleKnockRequest(session, request, signedRequest, signal);
|
|
1725
|
+
const firstRedirected = isRedirectResponse(response);
|
|
1726
|
+
if (!firstRedirected && (response.status === 400 || response.status === 401 || response.status > 401)) {
|
|
1727
|
+
const logger = (0, _logtape_logtape.getLogger)([
|
|
1728
|
+
"fedify",
|
|
1729
|
+
"sig",
|
|
1730
|
+
"http"
|
|
1731
|
+
]);
|
|
1732
|
+
const acceptSigHeader = response.headers.get("Accept-Signature");
|
|
1733
|
+
if (acceptSigHeader != null) {
|
|
1734
|
+
const entries = validateAcceptSignature(parseAcceptSignature(acceptSigHeader));
|
|
1735
|
+
const localKeyId = identity.keyId.href;
|
|
1736
|
+
const localAlg = "rsa-v1_5-sha256";
|
|
1737
|
+
let fulfilled = false;
|
|
1738
|
+
let challengeRequest;
|
|
1739
|
+
for (const entry of entries) {
|
|
1740
|
+
const rfc9421 = fulfillAcceptSignature(entry, localKeyId, localAlg);
|
|
1741
|
+
if (rfc9421 == null) continue;
|
|
1742
|
+
logger.debug("Received Accept-Signature challenge; accumulating label {label} and components {components}.", {
|
|
1743
|
+
label: rfc9421.label,
|
|
1744
|
+
components: rfc9421.components
|
|
1745
|
+
});
|
|
1746
|
+
try {
|
|
1747
|
+
challengeRequest = await signRequest(challengeRequest ?? request, identity.privateKey, identity.keyId, {
|
|
1748
|
+
spec: "rfc9421",
|
|
1749
|
+
tracerProvider,
|
|
1750
|
+
body,
|
|
1751
|
+
rfc9421
|
|
1752
|
+
});
|
|
1753
|
+
fulfilled = true;
|
|
1754
|
+
} catch (error) {
|
|
1755
|
+
logger.debug("Failed to fulfill Accept-Signature challenge entry {label}: {error}", {
|
|
1756
|
+
label: entry.label,
|
|
1757
|
+
error
|
|
1758
|
+
});
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
if (fulfilled && challengeRequest != null) {
|
|
1762
|
+
cancelResponseBody(response, request.url);
|
|
1763
|
+
signedRequest = challengeRequest;
|
|
1764
|
+
log?.(signedRequest);
|
|
1765
|
+
response = await session.fetch(signedRequest, {
|
|
1766
|
+
redirect: "manual",
|
|
1767
|
+
signal
|
|
1768
|
+
});
|
|
1769
|
+
}
|
|
1770
|
+
if (fulfilled && !isRedirectResponse(response)) {
|
|
1771
|
+
if (response.status < 300) {
|
|
1772
|
+
await specDeterminer?.rememberSpec(origin, "rfc9421");
|
|
1773
|
+
return {
|
|
1774
|
+
response,
|
|
1775
|
+
session
|
|
1776
|
+
};
|
|
1777
|
+
}
|
|
1778
|
+
if (response.status !== 400 && response.status !== 401) return {
|
|
1779
|
+
response,
|
|
1780
|
+
session
|
|
1781
|
+
};
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
if (!isRedirectResponse(response)) {
|
|
1785
|
+
const spec = firstTrySpec === "draft-cavage-http-signatures-12" ? "rfc9421" : "draft-cavage-http-signatures-12";
|
|
1786
|
+
(0, _logtape_logtape.getLogger)([
|
|
1787
|
+
"fedify",
|
|
1788
|
+
"sig",
|
|
1789
|
+
"http"
|
|
1790
|
+
]).debug("Failed to verify with the spec {spec} ({status} {statusText}); retrying with spec {secondSpec}... (double-knocking)", {
|
|
1791
|
+
spec: firstTrySpec,
|
|
1792
|
+
secondSpec: spec,
|
|
1793
|
+
status: response.status,
|
|
1794
|
+
statusText: response.statusText
|
|
1700
1795
|
});
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1796
|
+
cancelResponseBody(response, request.url);
|
|
1797
|
+
signedRequest = await signRequest(request, identity.privateKey, identity.keyId, {
|
|
1798
|
+
spec,
|
|
1799
|
+
tracerProvider,
|
|
1800
|
+
body
|
|
1706
1801
|
});
|
|
1802
|
+
log?.(signedRequest);
|
|
1803
|
+
response = await fetchDoubleKnockRequest(session, request, signedRequest, signal);
|
|
1804
|
+
if (!isRedirectResponse(response) && response.status !== 400 && response.status !== 401) await specDeterminer?.rememberSpec(origin, spec);
|
|
1707
1805
|
}
|
|
1708
|
-
}
|
|
1709
|
-
if (
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
});
|
|
1716
|
-
if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) return doubleKnock(await createRedirectRequest(request, response.headers.get("Location"), body, options.validateRedirect), identity, {
|
|
1717
|
-
...options,
|
|
1718
|
-
body
|
|
1719
|
-
});
|
|
1720
|
-
}
|
|
1721
|
-
if (fulfilled && response.status < 300) {
|
|
1722
|
-
await specDeterminer?.rememberSpec(origin, "rfc9421");
|
|
1723
|
-
return response;
|
|
1724
|
-
}
|
|
1725
|
-
if (fulfilled && response.status !== 400 && response.status !== 401) return response;
|
|
1726
|
-
}
|
|
1727
|
-
const spec = firstTrySpec === "draft-cavage-http-signatures-12" ? "rfc9421" : "draft-cavage-http-signatures-12";
|
|
1728
|
-
logger.debug("Failed to verify with the spec {spec} ({status} {statusText}); retrying with spec {secondSpec}... (double-knocking)", {
|
|
1729
|
-
spec: firstTrySpec,
|
|
1730
|
-
secondSpec: spec,
|
|
1731
|
-
status: response.status,
|
|
1732
|
-
statusText: response.statusText
|
|
1733
|
-
});
|
|
1734
|
-
signedRequest = await signRequest(request, identity.privateKey, identity.keyId, {
|
|
1735
|
-
spec,
|
|
1736
|
-
tracerProvider,
|
|
1737
|
-
body
|
|
1738
|
-
});
|
|
1739
|
-
log?.(signedRequest);
|
|
1740
|
-
response = await fetchDoubleKnockRequest(request, signedRequest, signal);
|
|
1741
|
-
if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) {
|
|
1806
|
+
} else if (!firstRedirected) await specDeterminer?.rememberSpec(origin, firstTrySpec);
|
|
1807
|
+
if (!isRedirectResponse(response)) return {
|
|
1808
|
+
response,
|
|
1809
|
+
session
|
|
1810
|
+
};
|
|
1811
|
+
cancelResponseBody(response, request.url);
|
|
1812
|
+
await session.close();
|
|
1742
1813
|
if (redirected >= DEFAULT_MAX_REDIRECTION) throw new _fedify_vocab_runtime.FetchError(request.url, `Too many redirections (${redirected + 1})`);
|
|
1743
|
-
const
|
|
1814
|
+
const location = response.headers.get("Location");
|
|
1815
|
+
const redirectRequest = await createRedirectRequest(request, location, body, options.validateRedirect);
|
|
1744
1816
|
if (visited.has(redirectRequest.url)) throw new _fedify_vocab_runtime.FetchError(request.url, `Redirect loop detected: ${redirectRequest.url}`);
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1817
|
+
request = redirectRequest;
|
|
1818
|
+
session = await openHop(request.url);
|
|
1819
|
+
}
|
|
1820
|
+
} catch (error) {
|
|
1821
|
+
try {
|
|
1822
|
+
await session.close();
|
|
1823
|
+
} catch (closeError) {
|
|
1824
|
+
(0, _logtape_logtape.getLogger)([
|
|
1825
|
+
"fedify",
|
|
1826
|
+
"sig",
|
|
1827
|
+
"http"
|
|
1828
|
+
]).debug("Failed to close the session for {url}: {error}", {
|
|
1829
|
+
url: request.url,
|
|
1830
|
+
error: closeError
|
|
1831
|
+
});
|
|
1832
|
+
}
|
|
1833
|
+
throw error;
|
|
1834
|
+
}
|
|
1752
1835
|
}
|
|
1753
1836
|
/**
|
|
1754
1837
|
* Performs a timing-safe equality comparison between two `Uint8Array` values.
|
|
@@ -1778,10 +1861,10 @@ function timingSafeEqual(a, b) {
|
|
|
1778
1861
|
return result === 0;
|
|
1779
1862
|
}
|
|
1780
1863
|
//#endregion
|
|
1781
|
-
Object.defineProperty(exports, "
|
|
1864
|
+
Object.defineProperty(exports, "doubleKnockScoped", {
|
|
1782
1865
|
enumerable: true,
|
|
1783
1866
|
get: function() {
|
|
1784
|
-
return
|
|
1867
|
+
return doubleKnockScoped;
|
|
1785
1868
|
}
|
|
1786
1869
|
});
|
|
1787
1870
|
Object.defineProperty(exports, "exportJwk", {
|