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

"Deno.upgradeHttp" API needs to be rewritten for Node compat #15398

Closed
bartlomieju opened this issue Aug 3, 2022 · 1 comment
Closed

"Deno.upgradeHttp" API needs to be rewritten for Node compat #15398

bartlomieju opened this issue Aug 3, 2022 · 1 comment

Comments

@bartlomieju
Copy link
Member

Required for denoland/std#2061

Node emits "upgrade" event with "request", "socket" and "head" arguments, when a request is received that has Connection: upgrade header. Deno.upgradeHttp was meant to be a solution to polyfill that Node API, however the semantics of this API are strictly related to how upgrades work in hyper. Deno.upgradeHttp resolves a promise only after a response is sent back (again, mandated by hyper), but in case of Node's API it is callers responsibility in write the response manually.

Because of that we are unable to polyfill Node's server API which is a (most likely) the last blocker for Vite compatibility denoland/std#2055 We need to change Deno.upgradeHttp in such a way that it will verify that passed request is actually an upgrade request and yield the request back, along with the underlying connection and first packet of data (could be empty).

CC @littledivy

@bartlomieju
Copy link
Member Author

This was already addressed in new Deno.serve() API.

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

No branches or pull requests

1 participant