summaryrefslogtreecommitdiff
path: root/ext/node/lib.rs
diff options
context:
space:
mode:
authorLeo Kettmeir <crowlkats@toaxl.com>2023-05-27 15:42:20 +0200
committerGitHub <noreply@github.com>2023-05-27 15:42:20 +0200
commitbe59e93220e24a2e66ae2843a136e61eab9d8ac3 (patch)
tree9c49d56516d1f126234d4e11e276750c6028b42a /ext/node/lib.rs
parentd0c5ff42f4b5fa9b848e6ed5af2e480d12f15bda (diff)
refactor(node/http): don't use readablestream for writing to request (#19282)
Refactors the internal usage of a readablestream to write to the resource directly --------- Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
Diffstat (limited to 'ext/node/lib.rs')
-rw-r--r--ext/node/lib.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/ext/node/lib.rs b/ext/node/lib.rs
index 4c81351a8..c8242992a 100644
--- a/ext/node/lib.rs
+++ b/ext/node/lib.rs
@@ -9,6 +9,7 @@ use deno_core::error::AnyError;
use deno_core::located_script_name;
use deno_core::op;
use deno_core::serde_json;
+use deno_core::url::Url;
use deno_core::JsRuntime;
use deno_core::ModuleSpecifier;
use deno_fs::sync::MaybeSend;
@@ -41,12 +42,24 @@ pub use resolution::NodeResolutionMode;
pub use resolution::NodeResolver;
pub trait NodePermissions {
+ fn check_net_url(
+ &mut self,
+ url: &Url,
+ api_name: &str,
+ ) -> Result<(), AnyError>;
fn check_read(&self, path: &Path) -> Result<(), AnyError>;
}
pub(crate) struct AllowAllNodePermissions;
impl NodePermissions for AllowAllNodePermissions {
+ fn check_net_url(
+ &mut self,
+ _url: &Url,
+ _api_name: &str,
+ ) -> Result<(), AnyError> {
+ Ok(())
+ }
fn check_read(&self, _path: &Path) -> Result<(), AnyError> {
Ok(())
}
@@ -206,7 +219,7 @@ deno_core::extension!(deno_node,
ops::zlib::op_zlib_write_async,
ops::zlib::op_zlib_init,
ops::zlib::op_zlib_reset,
- ops::http::op_node_http_request,
+ ops::http::op_node_http_request<P>,
op_node_build_os,
ops::require::op_require_init_paths,
ops::require::op_require_node_module_paths<P>,