summaryrefslogtreecommitdiff
path: root/runtime/ops/http.rs
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/ops/http.rs')
-rw-r--r--runtime/ops/http.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/runtime/ops/http.rs b/runtime/ops/http.rs
index 1e2bd66ec..702302c07 100644
--- a/runtime/ops/http.rs
+++ b/runtime/ops/http.rs
@@ -14,11 +14,14 @@ use deno_http::http_create_conn_resource;
use deno_http::HttpRequestReader;
use deno_http::HttpStreamResource;
use deno_net::io::TcpStreamResource;
+use deno_net::io::UnixStreamResource;
use deno_net::ops_tls::TlsStream;
use deno_net::ops_tls::TlsStreamResource;
use hyper::upgrade::Parts;
use serde::Serialize;
use tokio::net::TcpStream;
+#[cfg(unix)]
+use tokio::net::UnixStream;
pub fn init() -> Extension {
Extension::builder()
@@ -121,6 +124,24 @@ async fn op_http_upgrade(
}
Err(transport) => transport,
};
+ #[cfg(unix)]
+ let transport = match transport.downcast::<UnixStream>() {
+ Ok(Parts {
+ io: unix_stream,
+ read_buf,
+ ..
+ }) => {
+ return Ok(HttpUpgradeResult {
+ conn_type: "unix",
+ conn_rid: state
+ .borrow_mut()
+ .resource_table
+ .add(UnixStreamResource::new(unix_stream.into_split())),
+ read_buf: read_buf.to_vec().into(),
+ });
+ }
+ Err(transport) => transport,
+ };
match transport.downcast::<TlsStream>() {
Ok(Parts {
io: tls_stream,