Skip to content
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

RFC 003: Amend Connect HTTP codes #148

Merged
merged 1 commit into from
Mar 11, 2024
Merged
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
44 changes: 44 additions & 0 deletions docs/governance/rfc/003-http-codes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# 003: Amend Connect HTTP codes

This RFC proposes amending the Connect protocol to translate back and forth
between RPC error codes and HTTP codes more correctly. This fixes some
transport-level bugs and improves interoperability with gRPC, but does change
how Connect clients interpret malformed responses.

The proposed diff to the protocol specification is in [PR 130][pr130]. This
document focuses on the rationale for the change and the anticipated end user
impact.

## RPC → HTTP mappings

We propose changing the mappings from RPC error codes to HTTP codes for two
reasons:

* In two cases, Connect's current use of HTTP 408 codes is categorically
incorrect - it indicates that the client may retry the request. Using this
code for non-idempotent RPCs is a potentially severe bug.
* In an additional two cases, the current protocol diverges from the mappings
suggested in [`code.proto`][code.proto]. The `code.proto` mapping isn't used
by gRPC, but it _is_ used by the Google Cloud Platform front-ends,
gRPC-Gateway, Envoy, and a variety of other projects in the Protobuf
ecosystem.

Most Connect users won't notice these changes, since clients read explicit RPC
error codes from the response body. Servers will stop encouraging clients and
proxies to auto-retry, which fixes a severe bug. Since it changes the wire
representation of errors, this portion of the proposal will visibly affect any
HTTP-level observability that users have in place today.

## HTTP → RPC mappings

We propose removing some of the mappings from HTTP codes to RPC codes, so that
Connect's mapping becomes _identical_ to gRPC's. This helps to deliver on
Connect's promise that users can switch RPC protocols without code changes.

Again, most Connect users won't notice these changes, because clients read RPC
error codes from the response body. However, this will change clients'
interpretation of malformed responses (usually coming from a misbehaving
proxy).

[code.proto]: https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto
[pr130]: https://github.com/connectrpc/connectrpc.com/pull/130
Loading