summaryrefslogtreecommitdiff
path: root/ext/net/ops_unix.rs
diff options
context:
space:
mode:
authorYoshiya Hinosawa <stibium121@gmail.com>2023-10-04 11:37:39 +0900
committerGitHub <noreply@github.com>2023-10-04 11:37:39 +0900
commitda0b945804f19903beac71b23ff1040ebdb9b554 (patch)
tree8ec0508fbc04839f113b2d58169090d14b474cdd /ext/net/ops_unix.rs
parent8c1677ecbcbb474fc6a5ac9b5f73b562677bb829 (diff)
feat(unstable): add unix domain socket support to Deno.serve (#20759)
Diffstat (limited to 'ext/net/ops_unix.rs')
-rw-r--r--ext/net/ops_unix.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/ext/net/ops_unix.rs b/ext/net/ops_unix.rs
index beb41bb4a..7a5da9fa1 100644
--- a/ext/net/ops_unix.rs
+++ b/ext/net/ops_unix.rs
@@ -194,15 +194,17 @@ where
pub fn op_net_listen_unix<NP>(
state: &mut OpState,
#[string] path: String,
+ #[string] api_name: String,
) -> Result<(ResourceId, Option<String>), AnyError>
where
NP: NetPermissions + 'static,
{
let address_path = Path::new(&path);
- super::check_unstable(state, "Deno.listen");
+ super::check_unstable(state, &api_name);
let permissions = state.borrow_mut::<NP>();
- permissions.check_read(address_path, "Deno.listen()")?;
- permissions.check_write(address_path, "Deno.listen()")?;
+ let api_call_expr = format!("{}()", api_name);
+ permissions.check_read(address_path, &api_call_expr)?;
+ permissions.check_write(address_path, &api_call_expr)?;
let listener = UnixListener::bind(address_path)?;
let local_addr = listener.local_addr()?;
let pathname = local_addr.as_pathname().map(pathstring).transpose()?;