mirror of https://github.com/hzrd149/blossom.git
Clarify requirements around Content-Type and Content-Length
- Specify that the server must return the MIME type in the Content-Type header for blob retrieval. - Clarify fallback behaviour for unknown MIME types to application/octet-stream. - Improve the description of how servers should infer MIME types and handle Content-Length for mirror requests.
This commit is contained in:
parent
5ef2889547
commit
cacfa520dd
|
@ -79,6 +79,9 @@ The `GET /<sha256>` endpoint MUST return the contents of the blob in the respons
|
|||
|
||||
The endpoint MUST accept an optional file extension in the URL. ie. `.pdf`, `.png`, etc
|
||||
|
||||
Regardless of the file extension, the server MUST return the MIME type of the blob in the `Content-Type`
|
||||
header. If the server does not know the MIME type of the blob, it MUST default to `application/octet-stream`
|
||||
|
||||
If the endpoint returns a `301` or `302` redirect it MUST redirect to a URL containing the same sha256 hash as the requested blob.
|
||||
This ensures that if a user was to copy or reuse the redirect URL it would still contain the original sha256 hash
|
||||
|
||||
|
|
|
@ -25,9 +25,14 @@ The `/mirror` endpoint MUST download the blob from the specified URL and verify
|
|||
|
||||
**Multiple `x` tags in the authorization event MUST NOT be interpreted as the user requesting to mirror multiple blobs.**
|
||||
|
||||
The endpoint MUST return a [Blob Descriptor](#blob-descriptor) and a `2xx` status code if the mirroring was successful or a `4xx` status code and error messageif it was not
|
||||
The endpoint MUST return a [Blob Descriptor](#blob-descriptor) and a `2xx` status code if the mirroring was successful
|
||||
or a `4xx` status code and error message if it was not.
|
||||
|
||||
Servers SHOULD use the `Content-Type` header returned from the requested URL to infer the mime type of the blob. If the `Content-Type` header is not returned they SHOULD attempt to use the file extension in the URL or fallback to `application/octet-stream`.
|
||||
Servers SHOULD use the `Content-Type` header returned from the requested URL to infer the mime type of the blob. If the
|
||||
`Content-Type` header is not present they SHOULD attempt to detect the `Content-Type` from the blob contents and file
|
||||
extension, falling back to `application/octet-stream` if they cannot determine the type.
|
||||
|
||||
Servers MAY use the `Content-Length` header to determine the size of the blob.
|
||||
|
||||
Servers MAY reject a mirror request for any reason and MUST respond with the appropriate HTTP `4xx` status code and an error message explaining the reason for the rejection.
|
||||
|
||||
|
|
Loading…
Reference in New Issue