-
Notifications
You must be signed in to change notification settings - Fork 118
Map HTTP/2 RST_STREAM codes back to RPC codes #321
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
Conversation
HTTP/2 includes its own set of error codes, which are sent in RST_STREAM frames. When servers send one of these codes to clients, we should map the HTTP/2 code back to one of our status codes.
The string munging to extract HTTP/2 error codes is quite unpleasant; filed golang/go#53896 to see if the Go team has any interest in making this a bit cleaner. |
error.go
Outdated
} | ||
msg = strings.TrimSuffix(msg, fromPeerSuffix) | ||
i := strings.LastIndex(msg, ";") | ||
if i < 0 || i == len(msg) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if i < 0 || i == len(msg) { | |
if i < 0 { |
I don't think LastIndex will return len(msg)
- I think it will be in range 0:len(msg)-1
if found.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Off by one error on my part, thank you for catching this! I meant to ensure that i < len(msg)-1
, since we're slicing with [i+1]
below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Msg
HTTP/2 includes its own set of error codes, which are sent in RST_STREAM frames. When servers send one of these codes to clients, we should map the HTTP/2 code back to one of our status codes.
HTTP/2 includes its own set of error codes, which are sent in RST_STREAM
frames. When servers send one of these codes to clients, we should map
the HTTP/2 code back to one of our status codes.