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

feat(ext/http): add an op to perform raw HTTP upgrade #18511

Merged
merged 6 commits into from
Apr 2, 2023

Conversation

mmastrac
Copy link
Contributor

@mmastrac mmastrac commented Mar 30, 2023

This commit adds new "op_http_upgrade_early", that allows to hijack existing
"Deno.HttpConn" acquired from "Deno.serveHttp" API and performing
a Websocket upgrade on this connection.

This is not a public API and is meant to be used internally in the "ext/node"
polyfills for "http" module.

@mmastrac mmastrac changed the title [WIP] Deno.upgradeHttpRaw for Deno.serveHttp [WIP] Deno.upgradeHttp2 for websocket support in Deno.serveHttp Mar 31, 2023
cli/tsc/dts/lib.deno.unstable.d.ts Outdated Show resolved Hide resolved
ext/http/01_http.js Outdated Show resolved Hide resolved
ext/http/01_http.js Outdated Show resolved Hide resolved
ext/http/lib.rs Show resolved Hide resolved
ext/http/lib.rs Outdated Show resolved Hide resolved
ext/http/websocket_upgrade.rs Outdated Show resolved Hide resolved
runtime/js/90_deno_ns.js Outdated Show resolved Hide resolved
@bartlomieju
Copy link
Member

In #18552 I was able to completely refactor "ext/node" to not rely on Flash server impl and instead use "Deno.serveHttp" with the API provided in this PR. I think we should proceed with it, especially since we don't need to expose it as a public API.

@bartlomieju bartlomieju marked this pull request as ready for review April 2, 2023 20:39
@bartlomieju bartlomieju changed the title [WIP] Deno.upgradeHttp2 for websocket support in Deno.serveHttp feat(ext/http): add an op to perform raw HTTP upgrade Apr 2, 2023
@bartlomieju bartlomieju mentioned this pull request Apr 2, 2023
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

LGTM, exciting change!

@bartlomieju bartlomieju merged commit 513dada into denoland:main Apr 2, 2023
levex pushed a commit that referenced this pull request Apr 12, 2023
This commit adds new "op_http_upgrade_early", that allows to hijack
existing "Deno.HttpConn" acquired from "Deno.serveHttp" API 
and performing a Websocket upgrade on this connection.

This is not a public API and is meant to be used internally in the
"ext/node" polyfills for "http" module.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
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.

2 participants