Skip to content

Commit

Permalink
gateway: clarify entiry-bytes out of range
Browse files Browse the repository at this point in the history
Cosmetic clarification based on discussion that happened in 
ipfs/boxo#523
  • Loading branch information
lidel authored Jan 25, 2024
1 parent 956afd1 commit 19f5042
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/http-gateways/trustless-gateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,16 @@ The following additional values are supported:
A Gateway MUST augment the returned `Etag` based on the passed `entity-bytes`.

A Gateway SHOULD return an HTTP 400 Bad Request error when the requested range
cannot be parsed as valid offset positions.
is outside of valid offset positions in full, and the gateway knows that upfront.

In more nuanced error scenarios, a Gateway MUST return a valid CAR response
that includes enough blocks for the client to understand why the requested
`entity-bytes` was incorrect or why only a part of the requested byte range was
returned:

- If the requested `entity-bytes` resolves to a range that partially falls
outside the entity's byte range, the response MUST include the subset of
blocks within the entity's bytes.
outside the entity's byte range (before or after),
the response MUST include the subset of blocks within the entity's bytes.
- This allows clients to request valid ranges of the entity without needing
to know its total size beforehand, and it does not require the Gateway to
buffer the entire entity before returning the response.
Expand Down

0 comments on commit 19f5042

Please sign in to comment.