-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
refactor(ext/node): migrate "http" module to use "Deno.serveHttp" API #18552
Conversation
if (req.upgrade && this.listenerCount("upgrade") > 0) { | ||
const conn = await denoHttp.upgradeHttpRaw( | ||
reqEvent.request, | ||
tcpConn, | ||
) as Deno.Conn; | ||
const socket = new Socket({ | ||
handle: new TCP(constants.SERVER, conn), | ||
}); | ||
this.emit("upgrade", req, socket, Buffer.from([])); | ||
return; | ||
} else { | ||
const res = new ServerResponse(reqEvent); | ||
this.emit("request", req, res); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. Is there an immutable node buffer we can use to avoid allocating? It's only on connection so probably isn't a huge deal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about that. Are you talking about the Buffer.from([])
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Lots of code gone!
…#18552) This commit changes "node:http" module to use "Deno.serveHttp" API instead of "Deno.serve" API. --------- Co-authored-by: Matt Mastracci <matthew@mastracci.com>
…ttp" API (denoland#18552)" This reverts commit 3cd7abf.
This commit changes "node:http" module to use "Deno.serveHttp" API instead of
"Deno.serve" API. This allows us to migrate "Deno.serve" API to use "Deno.serveHttp"
under the hood and by extension allows us to remove the "flash" server implementation.