Skip to content

Commit 91315b7

Browse files
committed
add http support
1 parent c4ae2a3 commit 91315b7

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

error-codes/README.md

+9
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,14 @@ as the latest WebTransport draft,
9292
allows for a 4-byte error code to be sent on stream resets, we will introduce
9393
error codes over WebTransport later.
9494

95+
### HTTP
96+
Protocols that work over http MUST use the response header `Libp2p-Error-Code` to send the error code. The grammar for the field is similar to `Content-Length`
97+
```
98+
Libp2p-Error-Code: 1*DIGIT
99+
```
100+
95101
### Multistream Select
96102
Multistream-Select is used to negotiate Security protocol for TCP connections before a stream muxer has been selected. There's only one error code defined for such cases, `PROTOCOL_NEGOTIATION_FAILED`. To encode this error, send the string `101` prefixed with the length and close the TCP connection.
103+
104+
105+

error-codes/libp2p-error-codes.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
| NO_ERROR | 0 | No reason provided for disconnection. This is equivalent to resetting a stream without any error code. |
2222
| Reserved For Transport | 1 - 100 | Reserved for transport level error codes. |
2323
| PROTOCOL_NEGOTIATION_FAILED | 101 | Rejected because we couldn't negotiate a protocol. Used by multistream select|
24-
| RESOURCE_LIMIT_EXCEEDED | 102 | Connection rejected because we ran into a resource limit. Implementations MAY retry with a backoff |
24+
| RESOURCE_LIMIT_EXCEEDED | 102 | Stream rejected because we ran into a resource limit. Implementations MAY retry with a backoff |
2525
| RATE_LIMITED | 103 | Rejected because the connection was rate limited. Implementations MAY retry with a backoff |
2626
| PROTOCOL_VIOLATION | 104 | Rejected because the stream protocol was violated. MAY be used interchangably with `BAD_REQUEST` |
2727
| SUPPLANTED | 105 | Resetted because a better transport is available for the stream |
28-
| GARBAGE_COLLECTED | 106 | Connection was garbage collected |
28+
| GARBAGE_COLLECTED | 106 | Idle Stream was garbage collected |
2929
| SHUTDOWN | 107 | The node is shutting down |
3030
| GATED | 108 | The stream was gated. Most likely the IP / node is blacklisted. |

0 commit comments

Comments
 (0)