-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
reverseproxy: Pull latest proxy changes from stdlib #4266
Conversation
Oh, nice. I’ll give it a try. Thank you very much! |
These changes look great, thanks Francis. The divergence from bugfixes upstream was something I was worried about. I'll wait to approve this until @leafac reports back whether it resolves his issue. |
Should we wait for you, @leafac? (Thanks for trying it out, btw) |
Yeah, sorry about taking too long to answer. I’ll test this first thing when I get to work. 😃 |
👍 I tested and I believe it’s working now 🙌 Thank you everyone for your work. You’re awesome! Here’s what I did in more detail:
Note how the headers came right away. |
Excellent! Thanks for confirming @leafac 🎉 |
I went through the commits that touched stdlib's `reverseproxy.go` file, and copied over all the changes that are to code that was copied into Caddy. The commits I pulled changes from: - golang/go@2cc3473 - golang/go@a5cea06 - golang/go@ecdbffd - golang/go@2189852 -golang/go@ca3c0df - golang/go@9c017ff This may also fix #4247 because of the change to `copyResponse` to set `mlw.flushPending = true` right away.
b8e4b9a
to
ac934b2
Compare
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.
Thanks for doing this, Francis! And thanks for testing it out, @leafac!
From reading through the code, I think this code path is now obsoleted by the changes made in #4266. Basically, `h.flushInterval()` will set the flush interval to `-1` if we're in a bi-directional stream, and the recent PR ensured that `h.copyResponse()` properly flushes headers immediately when the flush interval is non-zero. So now there should be no need to call Flush before calling `h.copyResponse()`.
From reading through the code, I think this code path is now obsoleted by the changes made in #4266. Basically, `h.flushInterval()` will set the flush interval to `-1` if we're in a bi-directional stream, and the recent PR ensured that `h.copyResponse()` properly flushes headers immediately when the flush interval is non-zero. So now there should be no need to call Flush before calling `h.copyResponse()`.
I went through the commits that touched stdlib's
reverseproxy.go
file in the past couple of years (only a dozen or so), and copied over all the changes that are to code that was copied into Caddy.The commits I pulled changes from (hopefully apparent from looking at those commits what the changes in this PR are doing):
This may also fix #4247 because of the change to
copyResponse
to setmlw.flushPending = true
right away. /cc @leafac if you'd be willing to try out this PR (you can grab a build from the CI artifacts, or build from this commit withxcaddy
) to see if it fixes your usecase.