-
Notifications
You must be signed in to change notification settings - Fork 13
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
martian: fix half-close propagation downstream when using http2 handler #870
Conversation
08509be
to
9a0649a
Compare
internal/martian/errors.go
Outdated
@@ -45,7 +45,8 @@ func isClosedConnError(err error) bool { | |||
if errors.Is(err, io.EOF) || | |||
errors.Is(err, io.ErrUnexpectedEOF) || | |||
errors.Is(err, syscall.ECONNABORTED) || | |||
errors.Is(err, syscall.ECONNRESET) { | |||
errors.Is(err, syscall.ECONNRESET) || | |||
errors.Is(err, errClosedBody) { |
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.
Yes! I've seen a lot of these recently.
internal/martian/unsafe.go
Outdated
) | ||
|
||
//go:linkname errClosedBody golang.org/x/net/http2.errClosedBody | ||
var errClosedBody error |
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.
Isn't that file name too general?
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.
Initially I called it h2Err... but reverted to that due to linter
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.
Yeah, I was thinking of some h2error.go
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.
go:linkname moved to errors.go and renamed to h2ErrClosedBody
.
internal/martian/proxy_handler.go
Outdated
} | ||
|
||
func (w writeFlusher) Write(p []byte) (n int, err error) { | ||
n, err = w.rw.Write(p) | ||
func makeH2Writer(rw http.ResponseWriter, rc *http.ResponseController, req *http.Request) *h2Writer { |
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.
Return a pointer? Previous flusher was a copy, and the methods receive a copy too, so I'm double checking if that's on purpose.
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.
Nah, that's too fast generation...
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.
Fixed
.golangci.yml
Outdated
- linters: | ||
- revive | ||
source: '_ "unsafe"' |
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.
grep for already existing comments
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.
Dropped that commit.
Use http2.Response.Close() to send RST_STREAM frame. Reimplement writeFlusher as h2Writer. This is to be tested in Sauce Connect due to lack of testing infrastructure for http2 at the moment. I added #869 to fix that.
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.
LGTM
No description provided.