Skip to content

Commit 573417e

Browse files
committed
ipip-337: final editorial changes
1 parent d343189 commit 573417e

File tree

2 files changed

+25
-23
lines changed

2 files changed

+25
-23
lines changed

IPIP/0337-delegated-routing-http-api.md

+9-7
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ and supporting large content providers is a key strategy for driving down IPFS c
1515
These providers must handle high volumes of traffic and support many users, so leveraging industry-standard tools and services
1616
such as HTTP load balancers, CDNs, reverse proxies, etc. is a requirement.
1717
To maximize compatibility with standard tools, IPFS needs an HTTP API specification that uses standard HTTP idioms and payload encoding.
18-
The [Reframe spec](https://github.com/ipfs/specs/blob/main/reframe/REFRAME_PROTOCOL.md) for delegated content routing is an experimental attempt at this,
18+
The [Reframe spec](https://github.com/ipfs/specs/blob/main/reframe/REFRAME_PROTOCOL.md) for delegated content routing is an experimental attempt at this,
1919
but it has resulted in a very unidiomatic HTTP API which is difficult to implement and is incompatible with many existing tools.
2020
The cost of a proper redesign, implementation, and maintenance of Reframe and its implementation is too high relative to the urgency of having a delegated content routing HTTP API.
2121

2222
Note that this does not supplant nor deprecate Reframe. Ideally in the future, Reframe and its implementation would receive the resources needed to map the IDL to idiomatic HTTP,
2323
and implementations of this spec could then be rewritten in the IDL, maintaining backwards compatibility.
2424

25-
We expect this API to be extended beyond "content routing" in the future, so additional IPIPs may rename this to something more general such as "Delegated Routing HTTP API".
25+
We expect this API to be extended beyond "content routing" in the future, so additional IPIPs may rename this to something more general such as "Delegated Routing HTTP API".
2626

2727
## Detailed design
2828

@@ -62,7 +62,7 @@ So this API proposal makes the following changes:
6262
- The Delegated Content Routing API is defined using HTTP semantics, and can be implemented without introducing Reframe concepts nor IPLD
6363
- There is a clear distinction between the RPC protocol (HTTP) and the API (Deleged Content Routing)
6464
- "Method names" and cache-relevant parameters are pushed into the URL path
65-
- Streaming support is removed, and default response size limits are added along with an optional `pageLimit` parameter for clients to specify response sizes
65+
- Streaming support is removed, and default response size limits are added.
6666
- We will add streaming support in a subsequent IPIP, but we are trying to minimize the scope of this IPIP to what is immediately useful
6767
- Bodies are encoded using idiomatic JSON, instead of using IPLD codecs, and are compatible with OpenAPI specifications
6868
- The JSON uses human-readable string encodings of common data types
@@ -84,13 +84,14 @@ and increasing data availability.
8484
#### Backwards Compatibility
8585

8686
IPFS Stewards will implement this API in [go-delegated-routing](https://github.com/ipfs/go-delegated-routing), using breaking changes in a new minor version.
87-
Because the existing Reframe spec can't be safely used in JavaScript and we won't be investing time and resources into changing the wire format implemented in edelweiss to fix it,
88-
the experimental support for Reframe in Kubo will be deprecated in the next release and delegated content routing will subsequently use this HTTP API.
87+
Because the existing Reframe spec can't be safely used in JavaScript and we won't be investing time and resources into changing the wire format implemented in edelweiss to fix it,
88+
the experimental support for Reframe in Kubo will be deprecated in the next release and delegated content routing will subsequently use this HTTP API.
8989
We may decide to re-add Reframe support in the future once these issues have been resolved.-
9090

9191
#### Forwards Compatibility
9292

9393
Standard HTTP mechanisms for forward compatibility are used:
94+
9495
- The API is versioned using a version number prefix in the path
9596
- The `Accept` and `Content-Type` headers are used for content type negotiation, allowing for backwards-compatible additions of new MIME types, hypothetically such as:
9697
- `application/cbor` for binary-encoded responses
@@ -104,8 +105,9 @@ As a proof-of-concept, the tests for the initial implementation of this HTTP API
104105

105106
### Security
106107

107-
- TODO: cover user privacy
108-
- TODO: parsing best practices: what are limits (e.g., per message / field)?
108+
- All CID requests are sent to a central HTTPS endpoint as plain text, with TLS being the only protection against third-party observation.
109+
- While privacy is not a concern in the current version, plans are underway to add a separate endpoint that prioritizes lookup privacy. Follow the progress in related pre-work in [IPIP-272 (double hashed DHT)](https://github.com/ipfs/specs/pull/373/) and [ipni#5 (reader privacy in indexers)](https://github.com/ipni/specs/pull/5).
110+
- The usual JSON parsing rules apply. To prevent potential Denial of Service (DoS) attack, clients should ignore responses larger than 100 providers and introduce a byte size limit that is applicable to their use case.
109111

110112
### Alternatives
111113

routing/DELEGATED_CONTENT_ROUTING_HTTP.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Delegated Content Routing HTTP API
22

3-
![wip](https://img.shields.io/badge/status-wip-orange.svg?style=flat-square) Delegated Content Routing HTTP API
3+
![reliable](https://img.shields.io/badge/status-reliable-green.svg?style=flat-square) Delegated Content Routing HTTP API
44

55
**Author(s)**:
66

@@ -54,7 +54,7 @@ Both read and write provider records have a minimal required schema as follows:
5454

5555
Where:
5656

57-
- `Protocol` is the multicodec name of the transfer protocol
57+
- `Protocol` is the multicodec name of the transfer protocol or an opaque string (for experimenting with novel protocols without a multicodec)
5858
- `Schema` denotes the schema to use for encoding/decoding the record
5959
- This is separate from the `Protocol` to allow this HTTP API to evolve independently of the transfer protocol
6060
- Implementations should switch on this when parsing records, not on `Protocol`
@@ -66,11 +66,14 @@ Specifications for some transfer protocols are provided in the "Transfer Protoco
6666

6767
### `GET /routing/v1/providers/{CID}`
6868

69-
- Response codes
70-
- `200`: the response body contains 0 or more records
71-
- `404`: must be returned if no matching records are found
72-
- `422`: request does not conform to schema or semantic constraints
73-
- Response Body
69+
#### Response codes
70+
71+
- `200` (OK): the response body contains 0 or more records
72+
- `404` (Not Found): must be returned if no matching records are found
73+
- `422` (Unprocessable Entity): request does not conform to schema or semantic constraints
74+
75+
#### Response Body
76+
7477
```json
7578
{
7679
"Providers": [
@@ -83,26 +86,23 @@ Specifications for some transfer protocols are provided in the "Transfer Protoco
8386
}
8487
```
8588

86-
- Response limit: 100 providers
89+
Response limit: 100 providers
8790

8891
Each object in the `Providers` list is a *read provider record*.
8992

9093
## Pagination
9194

9295
This API does not support pagination, but optional pagination can be added in a backwards-compatible spec update.
9396

94-
### Implementation Notes
95-
96-
Servers are required to return *at most* `pageLimit` results in a page. It is recommended for pages to be as dense as possible, but it is acceptable for them to return any number of items in the closed interval [0, pageLimit]. This is dependent on the capabilities of the backing database implementation.
97-
For example, a query specifying a `transfer` filter for a rare transfer protocol should not *require* the server to perform a very expensive database query for a single request. Instead, this is left to the server implementation to decide based on the constraints of the database.
97+
## Streaming
9898

99-
Implementations should encode into the token whatever information is necessary for fetching the next page. This could be a base32-encoded JSON object like `{"offset":3,"limit":10}`, an object ID of the last scanned item, etc.
99+
This API does not currently support streaming, however it can be added in the future through a backwards-compatible update by using a content type other than `application/json`.
100100

101101
## Error Codes
102102

103-
- `501`: must be returned if a method/path is not supported
104-
- `429`: may be returned to indicate to the caller that it is issuing requests too quickly
105-
- `400`: must be returned if an unknown path is requested
103+
- `501` (Not Implemented): must be returned if a method/path is not supported
104+
- `429` (Too Many Requests): may be returned along with optional [Retry-After](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After) header to indicate to the caller that it is issuing requests too quickly
105+
- `400` (Bad Request): must be returned if an unknown path is requested
106106

107107
## CORS and Web Browsers
108108

0 commit comments

Comments
 (0)