summaryrefslogtreecommitdiff
path: root/ext/http/lib.rs
diff options
context:
space:
mode:
authorMatt Mastracci <matthew@mastracci.com>2023-12-23 08:58:20 -0700
committerGitHub <noreply@github.com>2023-12-23 08:58:20 -0700
commit1297c9a8f379d89691522c5cc0c6071c479e95a1 (patch)
tree7462b173b6b8106ea6255da67c265fcfd3a20c0d /ext/http/lib.rs
parent36536c784ca981ae01d258d4239b2a362017d533 (diff)
chore(ext/node): use BufView natively in http2 (#21688)
Node HTTP/2 was using the default h2 `Bytes` datatype when we can be making using of `BufView` like we do in `Deno.serve`. `fetch` and `Deno.serverHttp` can't make use of `BufView` because they are using `reqwest` which is stuck on hyper 0.x at this time.
Diffstat (limited to 'ext/http/lib.rs')
-rw-r--r--ext/http/lib.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/http/lib.rs b/ext/http/lib.rs
index 6a71c74e3..cae2fcfcc 100644
--- a/ext/http/lib.rs
+++ b/ext/http/lib.rs
@@ -739,7 +739,7 @@ fn http_response(
Some(data) => {
// If a buffer was passed, but isn't compressible, we use it to
// construct a response body.
- Ok((HttpResponseWriter::Closed, Bytes::from(data).into()))
+ Ok((HttpResponseWriter::Closed, data.to_vec().into()))
}
None if compressing => {
// Create a one way pipe that implements tokio's async io traits. To do
@@ -881,7 +881,7 @@ async fn op_http_write_resource(
}
}
HttpResponseWriter::BodyUncompressed(body) => {
- let bytes = Bytes::from(view);
+ let bytes = view.to_vec().into();
if let Err(err) = body.sender().send_data(bytes).await {
assert!(err.is_closed());
// Pull up the failure associated with the transport connection instead.
@@ -930,7 +930,7 @@ async fn op_http_write(
}
}
HttpResponseWriter::BodyUncompressed(body) => {
- let bytes = Bytes::from(buf);
+ let bytes = Bytes::from(buf.to_vec());
match body.sender().send_data(bytes).await {
Ok(_) => Ok(()),
Err(err) => {