From 19f5042c56d0fbe01d1d2f74f3dc090300331d21 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Thu, 25 Jan 2024 18:45:30 +0100 Subject: [PATCH] gateway: clarify entiry-bytes out of range Cosmetic clarification based on discussion that happened in https://github.com/ipfs/boxo/pull/523 --- src/http-gateways/trustless-gateway.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/http-gateways/trustless-gateway.md b/src/http-gateways/trustless-gateway.md index 71ae1f30..b35dc18e 100644 --- a/src/http-gateways/trustless-gateway.md +++ b/src/http-gateways/trustless-gateway.md @@ -155,7 +155,7 @@ 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 @@ -163,8 +163,8 @@ that includes enough blocks for the client to understand why the requested 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.