Skip to content

Commit d5638bc

Browse files
authored
Merge pull request #460 from ipfs/clarify-entity-bytes-ranges
gateway: clarify entity-bytes out of range behavior
2 parents 6a352e4 + 21e5418 commit d5638bc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/http-gateways/trustless-gateway.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,16 +205,17 @@ The following additional values are supported:
205205
A Gateway MUST augment the returned `Etag` based on the passed `entity-bytes`.
206206

207207
A Gateway SHOULD return an HTTP 400 Bad Request error when the requested range
208-
cannot be parsed as valid offset positions.
208+
is entirely outside of the entity's byte range and the Gateway is able to determine this
209+
upfront.
209210

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

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

0 commit comments

Comments
 (0)