mirror of
https://github.com/hzrd149/blossom.git
synced 2025-12-08 22:58:51 +00:00
mirror blobs
This commit is contained in:
29
buds/04.md
Normal file
29
buds/04.md
Normal file
@@ -0,0 +1,29 @@
|
||||
BUD-04
|
||||
======
|
||||
|
||||
Efficiently mirroring blobs
|
||||
---------------------
|
||||
|
||||
`draft` `optional`
|
||||
|
||||
If a server supports the `/upload` endpoint defined in [BUD-02](./02.md) it MAY also support an optional `url` query parameter in the URL ( eg. `/upload?url=https://cdn.satellite.earth/b1674191a88ec5cdd733e4240a81803105dc412d6c6708d53ab94fc248f4f553.pdf` )
|
||||
|
||||
If the `url` query parameter is specified the server MUST ignore the body and `Content-Type` of the request and download the raw binary blob data from the URL
|
||||
|
||||
The server MUST verify the sha256 hash of the downloaded blob matches the `x` tag in the upload [authorization event](./02.md#upload-authorization-required)
|
||||
|
||||
The server should re-use the `Content-Type` header returned from the URL to know the mime type of the blob. if none is returned it may use the file extension in the URL
|
||||
|
||||
The endpoint MUST return a [Blob Descriptor](#blob-descriptor) if the mirroring was successful or an error object if it was not
|
||||
|
||||
If no `url` query parameter is specified the server MUST follow the rules layed out in [BUD-02](./02.md)
|
||||
|
||||
## Example Flow
|
||||
|
||||
1. Client requests lists of blobs from Server A
|
||||
1. Client signs an upload auth event for X
|
||||
1. Client makes request `https://cdn.server-b.com/upload?url=https://cdn.server-a.com/<sha256>.png` with authorization header
|
||||
1. Server B receives request
|
||||
1. Server B downloads blob from Server A using url query parameter
|
||||
1. Server B verifies downloaded blob hash matches `x` tag in authorization header
|
||||
1. Server B returns [Blob Descriptor](./02.md#blob-descriptor)
|
||||
Reference in New Issue
Block a user