There was a logic bug in envelopingWriter and transformingWriter that could cause it to spuriously return a non-nil error after it had finished writing trailers for a response.
There was also an issue with responseWriter.reportEnd, which would cancel the operation context, which could then cause the handler to freak out. In particular, httputil.ReverseProxy could observe a context cancelation when trying to proxy the response bytes (even though all response bytes were copied and the cancellation was right after the final byte was written). The reverse proxy, when it encounters an error, will panic(http.ErrAbortWrite), which then causes the HTTP/2 stream to be cancelled (if HTTP/2 is used) instead of a normal stream termination.
This adds the entirety of the repro test case in #148, almost verbatim, to tests in this repo.
There was a logic bug in
envelopingWriter
andtransformingWriter
that could cause it to spuriously return a non-nil error after it had finished writing trailers for a response.There was also an issue with
responseWriter.reportEnd
, which would cancel the operation context, which could then cause the handler to freak out. In particular,httputil.ReverseProxy
could observe a context cancelation when trying to proxy the response bytes (even though all response bytes were copied and the cancellation was right after the final byte was written). The reverse proxy, when it encounters an error, willpanic(http.ErrAbortWrite)
, which then causes the HTTP/2 stream to be cancelled (if HTTP/2 is used) instead of a normal stream termination.This adds the entirety of the repro test case in #148, almost verbatim, to tests in this repo.
Resolves #148.