You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: IPIP/0337-delegated-routing-http-api.md
+9-7
Original file line number
Diff line number
Diff line change
@@ -15,14 +15,14 @@ and supporting large content providers is a key strategy for driving down IPFS c
15
15
These providers must handle high volumes of traffic and support many users, so leveraging industry-standard tools and services
16
16
such as HTTP load balancers, CDNs, reverse proxies, etc. is a requirement.
17
17
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,
19
19
but it has resulted in a very unidiomatic HTTP API which is difficult to implement and is incompatible with many existing tools.
20
20
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.
21
21
22
22
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,
23
23
and implementations of this spec could then be rewritten in the IDL, maintaining backwards compatibility.
24
24
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".
26
26
27
27
## Detailed design
28
28
@@ -62,7 +62,7 @@ So this API proposal makes the following changes:
62
62
- The Delegated Content Routing API is defined using HTTP semantics, and can be implemented without introducing Reframe concepts nor IPLD
63
63
- There is a clear distinction between the RPC protocol (HTTP) and the API (Deleged Content Routing)
64
64
- "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.
66
66
- 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
67
67
- Bodies are encoded using idiomatic JSON, instead of using IPLD codecs, and are compatible with OpenAPI specifications
68
68
- The JSON uses human-readable string encodings of common data types
@@ -84,13 +84,14 @@ and increasing data availability.
84
84
#### Backwards Compatibility
85
85
86
86
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.
89
89
We may decide to re-add Reframe support in the future once these issues have been resolved.-
90
90
91
91
#### Forwards Compatibility
92
92
93
93
Standard HTTP mechanisms for forward compatibility are used:
94
+
94
95
- The API is versioned using a version number prefix in the path
95
96
- The `Accept` and `Content-Type` headers are used for content type negotiation, allowing for backwards-compatible additions of new MIME types, hypothetically such as:
96
97
-`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
104
105
105
106
### Security
106
107
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.
Copy file name to clipboardExpand all lines: routing/DELEGATED_CONTENT_ROUTING_HTTP.md
+16-16
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Delegated Content Routing HTTP API
2
2
3
-
 Delegated Content Routing HTTP API
3
+
 Delegated Content Routing HTTP API
4
4
5
5
**Author(s)**:
6
6
@@ -54,7 +54,7 @@ Both read and write provider records have a minimal required schema as follows:
54
54
55
55
Where:
56
56
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)
58
58
-`Schema` denotes the schema to use for encoding/decoding the record
59
59
- This is separate from the `Protocol` to allow this HTTP API to evolve independently of the transfer protocol
60
60
- 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
66
66
67
67
### `GET /routing/v1/providers/{CID}`
68
68
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
+
74
77
```json
75
78
{
76
79
"Providers": [
@@ -83,26 +86,23 @@ Specifications for some transfer protocols are provided in the "Transfer Protoco
83
86
}
84
87
```
85
88
86
-
-Response limit: 100 providers
89
+
Response limit: 100 providers
87
90
88
91
Each object in the `Providers` list is a *read provider record*.
89
92
90
93
## Pagination
91
94
92
95
This API does not support pagination, but optional pagination can be added in a backwards-compatible spec update.
93
96
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
98
98
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`.
100
100
101
101
## Error Codes
102
102
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
0 commit comments