-
Notifications
You must be signed in to change notification settings - Fork 628
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Minor adaptation of VerifyCidTransform implementation * refactor: factorize content-encoding negotiation into new lib * bsky: Use undici to stream blob * fixup! bsky: Use undici to stream blob * disable ssrf bsky protection in dev-env * remove http requests to self to host "/img/" * drop axios from tests * fixes * fix tests * reviex changes * properly handle HEAD requests * handle client disconnection * fix tests * drop unrelated change * tidy * tidy * tidy * remove axios from dev-env * remove axios from identity package * use undici 6 * remove axios dependency from ozone * tidy * remove axios from PDS package * avoid killing bsky-pds connections * improve debugging data * Better handle invalid CID * tidy * tidy * refactor "allFulfilled" util in @atproto/common * tidy --------- Co-authored-by: devin ivy <[email protected]>
- Loading branch information
1 parent
3365bf8
commit 72eba67
Showing
56 changed files
with
1,769 additions
and
1,037 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@atproto/bsky": patch | ||
--- | ||
|
||
Improve performance when serving blobs | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@atproto/common-web": patch | ||
--- | ||
|
||
Add `createRetryable` utility function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@atproto-labs/xrpc-utils": patch | ||
--- | ||
|
||
New utility package to work with xrpc-server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@atproto-labs/did-resolver": patch | ||
--- | ||
|
||
Ensure proper escaping when building PLC url |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
"@atproto/identity": patch | ||
"@atproto/dev-env": patch | ||
"@atproto/ozone": patch | ||
"@atproto/bsky": patch | ||
"@atproto/pds": patch | ||
--- | ||
|
||
Remove dependency on Axios |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@atproto/common-web": patch | ||
--- | ||
|
||
Add `allFulfilled` utility |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
import { handleAllSettledErrors } from '@atproto/common' | ||
import { allFulfilled } from '@atproto/common' | ||
import { ImageInvalidator } from './types' | ||
|
||
export class MultiImageInvalidator implements ImageInvalidator { | ||
constructor(public invalidators: ImageInvalidator[]) {} | ||
async invalidate(subject: string, paths: string[]) { | ||
const results = await Promise.allSettled( | ||
await allFulfilled( | ||
this.invalidators.map((invalidator) => | ||
invalidator.invalidate(subject, paths), | ||
), | ||
) | ||
handleAllSettledErrors(results) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { isUnicastIp, unicastLookup } from '@atproto-labs/fetch-node' | ||
import { Agent, Dispatcher, Pool, RetryAgent } from 'undici' | ||
|
||
import { ServerConfig } from '../config' | ||
import { RETRYABLE_HTTP_STATUS_CODES } from '../util/retry' | ||
|
||
export function createBlobDispatcher(cfg: ServerConfig): Dispatcher { | ||
const baseDispatcher = new Agent({ | ||
allowH2: cfg.proxyAllowHTTP2, // This is experimental | ||
headersTimeout: cfg.proxyHeadersTimeout, | ||
maxResponseSize: cfg.proxyMaxResponseSize, | ||
bodyTimeout: cfg.proxyBodyTimeout, | ||
factory: cfg.disableSsrfProtection | ||
? undefined | ||
: (origin, opts) => { | ||
const { protocol, hostname } = | ||
origin instanceof URL ? origin : new URL(origin) | ||
if (protocol !== 'https:') { | ||
throw new Error(`Forbidden protocol "${protocol}"`) | ||
} | ||
if (isUnicastIp(hostname) === false) { | ||
throw new Error('Hostname resolved to non-unicast address') | ||
} | ||
return new Pool(origin, opts) | ||
}, | ||
connect: { | ||
lookup: cfg.disableSsrfProtection ? undefined : unicastLookup, | ||
}, | ||
}) | ||
|
||
return cfg.proxyMaxRetries > 0 | ||
? new RetryAgent(baseDispatcher, { | ||
statusCodes: [...RETRYABLE_HTTP_STATUS_CODES], | ||
methods: ['GET', 'HEAD'], | ||
maxRetries: cfg.proxyMaxRetries, | ||
}) | ||
: baseDispatcher | ||
} |
Oops, something went wrong.