Skip to content

Commit 8f44d00

Browse files
authored
Merge pull request #568 from libp2p/marco/multiaddr-scheme
libp2phttp: Define the multiaddr URI
2 parents e3eb9dc + 95ffe6d commit 8f44d00

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

http/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,22 @@ Application protocols using HTTP semantics can run over any libp2p stream transp
126126

127127
HTTP/1.1 is chosen as the minimum bar for interoperability, but other encodings of HTTP semantics are possible as well and may be specified in a future update.
128128

129+
## Multiaddr URI scheme
130+
131+
In places where a URI is expected, implementations SHOULD accept a multiaddr URI
132+
in addition to a standard http or https URI. A multiaddr URI is a
133+
[URI](https://datatracker.ietf.org/doc/html/rfc3986) with the `multiaddr`
134+
scheme. It is constructed by taking the "multiaddr:" string and appending the
135+
string encoded representation of the multiaddr. E.g. the multiaddr
136+
`/ip4/1.2.3.4/udp/54321/quic-v1` would be represented as
137+
`multiaddr:/ip4/1.2.3.4/udp/54321/quic-v1`.
138+
139+
This URI can be extended to include HTTP paths with the `/http-path` component.
140+
This allows a user to make an HTTP request to a specific HTTP resource using a
141+
multiaddr. For example, a user could make a GET request to
142+
`multiaddr:/ip4/1.2.3.4/udp/54321/quic-v1/p2p/12D.../http-path/.well-known%2Flibp2p`. This also allows
143+
an HTTP redirect to another host and another HTTP resource.
144+
129145
## Using other request-response semantics (not HTTP)
130146

131147
This document has focused on using HTTP semantics, but HTTP may not be the common divisor amongst all transports (current and future). It may be desirable to use some other request-response semantics for your application-level protocol, perhaps something like rust-libp2p’s [request-response](https://docs.rs/libp2p/0.52.1/libp2p/request_response/index.html) abstraction. Nothing specified in this document prohibits mapping other semantics onto HTTP semantics to keep the benefits of using an HTTP transport.

0 commit comments

Comments
 (0)