mirror of
https://github.com/hzrd149/blossom.git
synced 2025-12-08 22:58:51 +00:00
Change X-Content-Digest for X-SHA-256
This commit is contained in:
16
buds/06.md
16
buds/06.md
@@ -10,11 +10,11 @@ Defines how clients can verify if the upload can be completed before sending the
|
|||||||
|
|
||||||
## HEAD /upload - Upload requirements
|
## HEAD /upload - Upload requirements
|
||||||
|
|
||||||
The `HEAD /upload` endpoint `MUST` use the `Content-Digest`, `X-Content-Type` and `X-Content-Length` headers sent by client to get the SHA-256 hash, MIME type and size of the blob that will be uploaded, returning a HTTP status code and a custom header `X-Upload-Message` to indicate some human readable message about the upload requirements.
|
The `HEAD /upload` endpoint `MUST` use the `X-SHA-256`, `X-Content-Type` and `X-Content-Length` headers sent by client to get the SHA-256 hash, MIME type and size of the blob that will be uploaded, returning a HTTP status code and a custom header `X-Upload-Message` to indicate some human readable message about the upload requirements.
|
||||||
|
|
||||||
### Headers
|
### Headers
|
||||||
|
|
||||||
- `Content-Digest`: A string formatted as `sha-256=:<base64digest>:`, where `<base64digest>` is the base64-encoded SHA-256 hash of the blob.
|
- `X-SHA-256`: A string that represents the blob's SHA-256 hash.
|
||||||
- `X-Content-Length`: An integer that represents the blob size in bytes.
|
- `X-Content-Length`: An integer that represents the blob size in bytes.
|
||||||
- `X-Content-Type`: A string that specifies the fblobile's MIME type, like `application/pdf` or `image/png`.
|
- `X-Content-Type`: A string that specifies the fblobile's MIME type, like `application/pdf` or `image/png`.
|
||||||
- `X-Upload-Message`: A human readable message that explains the reason why the upload cannot proceed.
|
- `X-Upload-Message`: A human readable message that explains the reason why the upload cannot proceed.
|
||||||
@@ -32,7 +32,7 @@ Example request from the client:
|
|||||||
```http
|
```http
|
||||||
X-Content-Type: application/pdf
|
X-Content-Type: application/pdf
|
||||||
X-Content-Length: 184292
|
X-Content-Length: 184292
|
||||||
Content-Digest: SHA-256=:88a74d0b866c8ba79251a11fe5ac807839226870e77355f02eaf68b156522576:
|
X-SHA-256: 88a74d0b866c8ba79251a11fe5ac807839226870e77355f02eaf68b156522576
|
||||||
```
|
```
|
||||||
|
|
||||||
Example response from the server if the upload can be done:
|
Example response from the server if the upload can be done:
|
||||||
@@ -48,27 +48,27 @@ Some examples of error messages:
|
|||||||
|
|
||||||
```http
|
```http
|
||||||
HTTP/1.1 400 Bad Request
|
HTTP/1.1 400 Bad Request
|
||||||
X-Upload-Message: Invalid Content-Digest header format. Expected format: sha-256=:<hash>:
|
X-Upload-Message: Invalid X-SHA-256 header format. Expected a string.
|
||||||
```
|
```
|
||||||
|
|
||||||
```http
|
```http
|
||||||
HTTP/1.1 401 Unauthorized
|
HTTP/1.1 401 Unauthorized
|
||||||
X-Upload-Message: Authorization required for uploading video files
|
X-Upload-Message: Authorization required for uploading video files.
|
||||||
```
|
```
|
||||||
|
|
||||||
```http
|
```http
|
||||||
HTTP/1.1 401 Forbidden
|
HTTP/1.1 401 Forbidden
|
||||||
X-Upload-Message: Account banned
|
X-Upload-Message: SHA-256 hash banned.
|
||||||
```
|
```
|
||||||
|
|
||||||
```http
|
```http
|
||||||
HTTP/1.1 411 Length Required
|
HTTP/1.1 411 Length Required
|
||||||
X-Upload-Message: Missing Content-Length or X-Content-Length headers
|
X-Upload-Message: Missing X-Content-Length header.
|
||||||
```
|
```
|
||||||
|
|
||||||
```http
|
```http
|
||||||
HTTP/1.1 413 Content Too Large
|
HTTP/1.1 413 Content Too Large
|
||||||
X-Upload-Message: File too large. Max allowed size is 100MB
|
X-Upload-Message: File too large. Max allowed size is 100MB.
|
||||||
```
|
```
|
||||||
|
|
||||||
```http
|
```http
|
||||||
|
|||||||
Reference in New Issue
Block a user