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

Implement HTTP Hijacker interface #837

Merged
merged 8 commits into from
May 28, 2024
Merged

Implement HTTP Hijacker interface #837

merged 8 commits into from
May 28, 2024

Conversation

ribice
Copy link
Collaborator

@ribice ribice commented May 28, 2024

Resolves #836

Was able to reproduce it with 0.28.0 (Error accepting websocket connection: failed to accept WebSocket connection: http.ResponseWriter does not implement http.Hijacker) and see it resolved with this fix.

@ribice ribice requested review from cleptric and removed request for cleptric May 28, 2024 10:37
@ribice ribice requested a review from cleptric May 28, 2024 10:44
Copy link

codecov bot commented May 28, 2024

Codecov Report

Attention: Patch coverage is 92.30769% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 81.98%. Comparing base (6d83e72) to head (4d07129).

Files Patch % Lines
http/wrap_writer.go 92.10% 5 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #837      +/-   ##
==========================================
+ Coverage   81.76%   81.98%   +0.22%     
==========================================
  Files          50       51       +1     
  Lines        4436     4507      +71     
==========================================
+ Hits         3627     3695      +68     
- Misses        661      663       +2     
- Partials      148      149       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ribice
Copy link
Collaborator Author

ribice commented May 28, 2024

The only difference between this (and previous incomplete Wrapper) and Chi's is that this defaults to 200 instead of 0 if WriteHeader has not yet been called.

@ribice ribice changed the title Http hijacker Implement HTTP Hijacker interface May 28, 2024
http/wrap_writer.go Show resolved Hide resolved
@ribice ribice requested a review from cleptric May 28, 2024 13:46
@cleptric cleptric merged commit 00b23e0 into master May 28, 2024
20 checks passed
@cleptric cleptric deleted the http-hijacker branch May 28, 2024 15:57
@kydemy-fran
Copy link

kydemy-fran commented Aug 12, 2024

Is this fix working transparently? or requires some extra initialization?
I am still getting the error using the negronisentry package.

@ribice
Copy link
Collaborator Author

ribice commented Aug 12, 2024

I just checked and it seems you're right, I've updated the implementation for stdlib but not for negroni. I'll submit a fix today.

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.

regression: after upgrade to 0.28 my websocket server no longer works 🐛
3 participants