Skip to content

gateway: clarify 3XX on trustless gw #494

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/http-gateways/path-gateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,11 @@ A generic client error returned when it is not possible to return a better one

### `404` Not Found

Error to indicate that request was formally correct, but traversal of the
requested content path was not possible due to a invalid or missing DAG node.
Error indicating that the request was syntactically valid, but traversal
of the requested content path failed due to an invalid or missing DAG node.

This error SHOULD occur when either the root CID is not provided by the gateway
or a specified sub-path does not exist within the DAG referenced by the root CID.
Comment on lines +317 to +321
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are touching these in #491 , should we merge that first?


### `410` Gone

Expand Down
19 changes: 19 additions & 0 deletions src/http-gateways/trustless-gateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,25 @@ In case both are present in the request, the value from the [`Accept`](#accept-r

Below MUST be implemented **in addition** to "HTTP Response" of :cite[path-gateway].

## Response Status Codes

### `200` OK

The request succeeded.

If the HTTP method was `GET`, then data is transmitted in the message body.

### `404` Not Found

Error to indicate that requested resource is not provided by the gateway.

### `3XX` Redirects
Comment on lines +238 to +250
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, unsure how this plays with #491 and path-gateway status codes. Should we edit there instead?

Begs the question, does it make sense that a recursive trustless gateway redirects and the non-recursive doesn't?


Non-recursive trustless gateway SHOULD NOT return HTTP redirects.
Change of URL should occur by announcing it to the routing system.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change of URL should occur by announcing it to the routing system.

i'm slightly confused by this line.. which routing system?

do you mean to imply that clients receiving a 3xx redirect from a spec-compliant trustless gateway should detect the 3xx and handle it appropriately?

maybe it's just too late for me.


Clients SHOULD ignore redirects and interpret them the same way as `404`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does the client know that it is talking to a non-recursive gateway though? Ideally the same client should work for all the gateways pretty much the same so the requirement is a bit weird (in some cases redirects should be followed and in others not).


## Response Headers

### `Content-Type` (response header)
Expand Down