summaryrefslogtreecommitdiff
path: root/ext/http/service.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-12-22 01:54:28 +0100
committerGitHub <noreply@github.com>2023-12-22 01:54:28 +0100
commitf86456fc26d1c02f6c511125037efed576f87458 (patch)
treebe9615e8cec34cc21691132fa26d57ff47fde110 /ext/http/service.rs
parent3fb4f3fe5a18916aa95f8b035ca994c290c173dc (diff)
chore: update ext/http to hyper 1.0.1 and http 1.0 (#21588)
Closes https://github.com/denoland/deno/issues/21583.
Diffstat (limited to 'ext/http/service.rs')
-rw-r--r--ext/http/service.rs21
1 files changed, 11 insertions, 10 deletions
diff --git a/ext/http/service.rs b/ext/http/service.rs
index 4d909ec61..20e11e67f 100644
--- a/ext/http/service.rs
+++ b/ext/http/service.rs
@@ -7,12 +7,12 @@ use deno_core::futures::ready;
use deno_core::BufView;
use deno_core::OpState;
use deno_core::ResourceId;
-use http::request::Parts;
-use http::HeaderMap;
+use http_1::request::Parts;
use hyper1::body::Body;
use hyper1::body::Frame;
use hyper1::body::Incoming;
use hyper1::body::SizeHint;
+use hyper1::header::HeaderMap;
use hyper1::upgrade::OnUpgrade;
use scopeguard::guard;
@@ -209,9 +209,9 @@ pub(crate) async fn handle_request(
struct HttpRecordInner {
server_state: SignallingRc<HttpServerState>,
request_info: HttpConnectionProperties,
- request_parts: http::request::Parts,
+ request_parts: http_1::request::Parts,
request_body: Option<RequestBodyState>,
- response_parts: Option<http::response::Parts>,
+ response_parts: Option<http_1::response::Parts>,
response_ready: bool,
response_waker: Option<Waker>,
response_body: ResponseBytesInner,
@@ -244,7 +244,7 @@ impl HttpRecord {
) -> Rc<Self> {
let (request_parts, request_body) = request.into_parts();
let request_body = Some(request_body.into());
- let (mut response_parts, _) = http::Response::new(()).into_parts();
+ let (mut response_parts, _) = http_1::Response::new(()).into_parts();
let record =
if let Some((record, headers)) = server_state.borrow_mut().pool.pop() {
response_parts.headers = headers;
@@ -425,7 +425,7 @@ impl HttpRecord {
}
/// Get a mutable reference to the response status and headers.
- pub fn response_parts(&self) -> RefMut<'_, http::response::Parts> {
+ pub fn response_parts(&self) -> RefMut<'_, http_1::response::Parts> {
RefMut::map(self.self_mut(), |inner| {
inner.response_parts.as_mut().unwrap()
})
@@ -446,7 +446,7 @@ impl HttpRecord {
fn into_response(self: Rc<Self>) -> Response {
let parts = self.self_mut().response_parts.take().unwrap();
let body = HttpRecordResponse(ManuallyDrop::new(self));
- http::Response::from_parts(parts, body)
+ Response::from_parts(parts, body)
}
/// Get a reference to the connection properties.
@@ -590,7 +590,6 @@ impl Drop for HttpRecordResponse {
#[cfg(test)]
mod tests {
use super::*;
- use crate::hyper_util_tokioio::TokioIo;
use crate::response_body::Compression;
use crate::response_body::ResponseBytesInner;
use bytes::Buf;
@@ -598,11 +597,12 @@ mod tests {
use hyper1::body::Body;
use hyper1::service::service_fn;
use hyper1::service::HttpService;
+ use hyper_util::rt::TokioIo;
use std::error::Error as StdError;
/// Execute client request on service and concurrently map the response.
async fn serve_request<B, S, T, F>(
- req: http::Request<B>,
+ req: http_1::Request<B>,
service: S,
map_response: impl FnOnce(hyper1::Response<Incoming>) -> F,
) -> hyper1::Result<T>
@@ -655,7 +655,8 @@ mod tests {
)
});
- let client_req = http::Request::builder().uri("/").body("".to_string())?;
+ let client_req =
+ http_1::Request::builder().uri("/").body("".to_string())?;
// Response produced by concurrent tasks
tokio::try_join!(