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

added a Hijack Route for upgrade #159

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

barkyq
Copy link

@barkyq barkyq commented Feb 5, 2023

Hello Gobwas,

Thanks for the great package. I was hoping to add an option to "hijack" the upgrade process if a certain header was present, cancelling the upgrade negotiation and handing back control to the caller of "Upgrade," without writing anything to the "Conn."

My idea was to use status code "418" http.StatusTeapot, defined in https://www.rfc-editor.org/rfc/rfc2324 as a signal that the user wants to Hijack the handshake process.

This is to implement https://github.com/nostr-protocol/nips/blob/master/11.md in a project I am working on.

Sincerely,
Barky Q

@barkyq
Copy link
Author

barkyq commented Feb 19, 2023

changed the logic from the initial commit. now it is called escape hatch.

With this way, the upgrader can see all the non-ws headers and store any relevant information in the error pointer, which gets passed around to each call of OnHost and OnHeader.

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.

None yet

1 participant