summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/http/http_next.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/ext/http/http_next.rs b/ext/http/http_next.rs
index 7edffed65..7a02757c0 100644
--- a/ext/http/http_next.rs
+++ b/ext/http/http_next.rs
@@ -53,6 +53,7 @@ use hyper1::service::service_fn;
use hyper1::service::HttpService;
use hyper1::StatusCode;
+use once_cell::sync::Lazy;
use pin_project::pin_project;
use pin_project::pinned_drop;
use std::borrow::Cow;
@@ -68,6 +69,16 @@ use tokio::io::AsyncWriteExt;
type Request = hyper1::Request<Incoming>;
type Response = hyper1::Response<ResponseBytes>;
+static USE_WRITEV: Lazy<bool> = Lazy::new(|| {
+ let disable_writev = std::env::var("DENO_HYPER_USE_WRITEV").ok();
+
+ if let Some(val) = disable_writev {
+ return val != "0";
+ }
+
+ true
+});
+
/// All HTTP/2 connections start with this byte string.
///
/// In HTTP/2, each endpoint is required to send a connection preface as a final confirmation
@@ -597,6 +608,7 @@ fn serve_http11_unconditional(
) -> impl Future<Output = Result<(), AnyError>> + 'static {
let conn = http1::Builder::new()
.keep_alive(true)
+ .writev(*USE_WRITEV)
.serve_connection(io, svc);
conn.with_upgrades().map_err(AnyError::from)