summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/Cargo.toml1
-rw-r--r--cli/build.rs6
-rw-r--r--cli/dts/lib.deno.unstable.d.ts19
-rw-r--r--cli/main.rs1
-rw-r--r--cli/tsc.rs2
5 files changed, 29 insertions, 0 deletions
diff --git a/cli/Cargo.toml b/cli/Cargo.toml
index 3caddb69d..7fbd5b77d 100644
--- a/cli/Cargo.toml
+++ b/cli/Cargo.toml
@@ -25,6 +25,7 @@ deno_console = { version = "0.10.0", path = "../extensions/console" }
deno_core = { version = "0.92.0", path = "../core" }
deno_crypto = { version = "0.24.0", path = "../extensions/crypto" }
deno_fetch = { version = "0.32.0", path = "../extensions/fetch" }
+deno_http = { version = "0.1.0", path = "../extensions/http" }
deno_net = { version = "0.1.0", path = "../extensions/net" }
deno_timers = { version = "0.8.0", path = "../extensions/timers" }
deno_url = { version = "0.10.0", path = "../extensions/url" }
diff --git a/cli/build.rs b/cli/build.rs
index f932d5eff..548fbb501 100644
--- a/cli/build.rs
+++ b/cli/build.rs
@@ -71,6 +71,8 @@ fn create_compiler_snapshot(
op_crate_libs.insert("deno.net", deno_net::get_declaration());
op_crate_libs
.insert("deno.net_unstable", deno_net::get_unstable_declaration());
+ op_crate_libs
+ .insert("deno.http_unstable", deno_http::get_unstable_declaration());
// ensure we invalidate the build properly.
for (_, path) in op_crate_libs.iter() {
@@ -313,6 +315,10 @@ fn main() {
"cargo:rustc-env=DENO_NET_UNSTABLE_LIB_PATH={}",
deno_net::get_unstable_declaration().display()
);
+ println!(
+ "cargo:rustc-env=DENO_HTTP_UNSTABLE_LIB_PATH={}",
+ deno_http::get_unstable_declaration().display()
+ );
println!("cargo:rustc-env=TARGET={}", env::var("TARGET").unwrap());
println!("cargo:rustc-env=PROFILE={}", env::var("PROFILE").unwrap());
diff --git a/cli/dts/lib.deno.unstable.d.ts b/cli/dts/lib.deno.unstable.d.ts
index ac03e695c..199f05631 100644
--- a/cli/dts/lib.deno.unstable.d.ts
+++ b/cli/dts/lib.deno.unstable.d.ts
@@ -3,6 +3,7 @@
/// <reference no-default-lib="true" />
/// <reference lib="deno.ns" />
/// <reference lib="deno.net_unstable" />
+/// <reference lib="deno.http_unstable" />
declare namespace Deno {
/**
@@ -1098,6 +1099,24 @@ declare namespace Deno {
write?: "inherit" | boolean | Array<string | URL>;
};
}
+
+ /** **UNSTABLE**: new API, yet to be vetted.
+ *
+ * Services HTTP requests given a TCP or TLS socket.
+ *
+ * ```ts
+ * const conn = await Deno.connect({ port: 80, hostname: "127.0.0.1" });
+ * const httpConn = Deno.serveHttp(conn);
+ * const e = await httpConn.nextRequest();
+ * if (e) {
+ * e.respondWith(new Response("Hello World"));
+ * }
+ * ```
+ *
+ * If `httpConn.nextRequest()` encounters an error or returns `null`
+ * then the underlying HttpConn resource is closed automatically.
+ */
+ export function serveHttp(conn: Conn): HttpConn;
}
declare function fetch(
diff --git a/cli/main.rs b/cli/main.rs
index 93bae0220..77f8b34ba 100644
--- a/cli/main.rs
+++ b/cli/main.rs
@@ -348,6 +348,7 @@ pub fn get_types(unstable: bool) -> String {
if unstable {
types.push(crate::tsc::UNSTABLE_NS_LIB);
types.push(crate::tsc::DENO_NET_UNSTABLE_LIB);
+ types.push(crate::tsc::DENO_HTTP_UNSTABLE_LIB);
}
types.join("\n")
diff --git a/cli/tsc.rs b/cli/tsc.rs
index 593dd24fb..1b923aa3b 100644
--- a/cli/tsc.rs
+++ b/cli/tsc.rs
@@ -47,6 +47,8 @@ pub static DENO_BROADCAST_CHANNEL_LIB: &str =
pub static DENO_NET_LIB: &str = include_str!(env!("DENO_NET_LIB_PATH"));
pub static DENO_NET_UNSTABLE_LIB: &str =
include_str!(env!("DENO_NET_UNSTABLE_LIB_PATH"));
+pub static DENO_HTTP_UNSTABLE_LIB: &str =
+ include_str!(env!("DENO_HTTP_UNSTABLE_LIB_PATH"));
pub static SHARED_GLOBALS_LIB: &str =
include_str!("dts/lib.deno.shared_globals.d.ts");
pub static WINDOW_LIB: &str = include_str!("dts/lib.deno.window.d.ts");