Skip to content
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

accept: Add unwrapping for hijack like http.ResponseController #472

Merged
merged 2 commits into from
Aug 22, 2024

Conversation

mafredri
Copy link
Member

@mafredri mafredri commented Aug 15, 2024

Since we rely on the connection not being hijacked too early (i.e. detecting the presence of http.Hijacker) to set headers, we must manually implement the unwrapping of the http.ResponseController. By doing so, we also retain Go 1.19 compatibility without build tags (still used in compat test, though).

Closes #455

@mafredri mafredri force-pushed the mafredri/support-http-responsecontroller branch from ea6952a to d86cd75 Compare August 21, 2024 09:53
@mafredri mafredri changed the title Use http.ResponseController instead of http.Hijacker assertion Implement http.ResponseWriter unwrapping like http.ResponseController Aug 21, 2024
@mafredri mafredri force-pushed the mafredri/support-http-responsecontroller branch from d86cd75 to 558c496 Compare August 21, 2024 09:54
Since we rely on the connection not being hijacked too early (i.e.
detecting the presence of http.Hijacker) to set headers, we must
manually implement the unwrapping of the http.ResponseController. By
doing so, we also retain Go 1.19 compatibility without build tags.

Closes #455
@mafredri mafredri force-pushed the mafredri/support-http-responsecontroller branch 2 times, most recently from 230a06c to f86e67b Compare August 21, 2024 10:12
@mafredri mafredri force-pushed the mafredri/support-http-responsecontroller branch from f86e67b to ee7b9af Compare August 21, 2024 10:16
@mafredri mafredri self-assigned this Aug 21, 2024
@mafredri mafredri changed the title Implement http.ResponseWriter unwrapping like http.ResponseController accept: implement http.ResponseWriter unwrapping like http.ResponseController Aug 21, 2024
@mafredri mafredri changed the title accept: implement http.ResponseWriter unwrapping like http.ResponseController accept: add unwrapping for hijack like http.ResponseController Aug 21, 2024
@mafredri mafredri changed the title accept: add unwrapping for hijack like http.ResponseController accept: Add unwrapping for hijack like http.ResponseController Aug 21, 2024
Copy link
Member

@code-asher code-asher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet looks good to me!

@mafredri mafredri merged commit 3dd723a into master Aug 22, 2024
8 checks passed
@mafredri mafredri deleted the mafredri/support-http-responsecontroller branch August 22, 2024 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support (*http.ResponseController).Hijack()
2 participants