Fix double flush for proxied 1xx responses to avoid duplicate responses
We've faced some timeout issues on proxied Kube API calls that upgraded to SPDY. See https://gitlab.com/gitlab-org/cluster-integration/gitlab-agent/-/issues/371+ Turns out that this was due to a regression in the Golang standard library introduced with https://go-review.googlesource.com/c/go/+/269997 tl;dr: the standard library flushes the connection on a `WriteHeader()` for a status code of 1xx - possibly because of `100 Continue` which needs to persist headers and with that doesn't set the internal `wroteHeader` flag which is used to determine if it should flush or not. However, for a `101 Switching Protocol` we actually want it to flush (manually or not), but don't persist headers - at least don't send the response twice. Closes: #371
Please register or sign in to comment