Skip to content

Draft: update hyper/http #740

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lambda-events/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ edition = "2021"

[dependencies]
base64 = "0.21"
http = { version = "0.2", optional = true }
http-body = { version = "0.4", optional = true }
http-serde = { version = "^1", optional = true }
http = { version = "1.0", optional = true }
http-body = { version = "1.0", optional = true }
http-serde = { version = "2.0", optional = true }
serde = { version = "^1", features = ["derive"] }
serde_with = { version = "^3", features = ["json"], optional = true }
serde_json = "^1"
Expand Down
31 changes: 12 additions & 19 deletions lambda-events/src/encodings/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,25 +218,6 @@ impl HttpBody for Body {
type Data = Bytes;
type Error = super::Error;

fn poll_data(
self: Pin<&mut Self>,
_cx: &mut std::task::Context<'_>,
) -> Poll<Option<Result<Self::Data, Self::Error>>> {
let body = take(self.get_mut());
Poll::Ready(match body {
Body::Empty => None,
Body::Text(s) => Some(Ok(s.into())),
Body::Binary(b) => Some(Ok(b.into())),
})
}

fn poll_trailers(
self: Pin<&mut Self>,
_cx: &mut std::task::Context<'_>,
) -> Poll<Result<Option<http::HeaderMap>, Self::Error>> {
Poll::Ready(Ok(None))
}

fn is_end_stream(&self) -> bool {
matches!(self, Body::Empty)
}
Expand All @@ -248,6 +229,18 @@ impl HttpBody for Body {
Body::Binary(ref b) => SizeHint::with_exact(b.len() as u64),
}
}

fn poll_frame(
self: Pin<&mut Self>,
_cx: &mut std::task::Context<'_>,
) -> Poll<Option<Result<http_body::Frame<Self::Data>, Self::Error>>> {
let body = take(self.get_mut());
Poll::Ready(match body {
Body::Empty => None,
Body::Text(s) => Some(Ok(http_body::Frame::data(s.into()))),
Body::Binary(b) => Some(Ok(http_body::Frame::data(b.into()))),
})
}
}

#[cfg(test)]
Expand Down
18 changes: 14 additions & 4 deletions lambda-extension/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,23 @@ readme = "README.md"
async-stream = "0.3"
bytes = "1.0"
chrono = { version = "0.4", features = ["serde"] }
http = "0.2"
hyper = { version = "0.14.20", features = ["http1", "client", "server", "stream", "runtime"] }
http = "1.0"
hyper = { version = "0.14.20", features = [
"http1",
"client",
"server",
"stream",
"runtime",
] }
lambda_runtime_api_client = { version = "0.8", path = "../lambda-runtime-api-client" }
serde = { version = "1", features = ["derive"] }
serde_json = "^1"
tracing = { version = "0.1", features = ["log"] }
tokio = { version = "1.0", features = ["macros", "io-util", "sync", "rt-multi-thread"] }
tokio = { version = "1.0", features = [
"macros",
"io-util",
"sync",
"rt-multi-thread",
] }
tokio-stream = "0.1.2"
tower = { version = "0.4", features = ["make", "util"] }

6 changes: 3 additions & 3 deletions lambda-http/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ alb = []
base64 = "0.21"
bytes = "1.4"
futures = "0.3"
http = "0.2"
http-body = "0.4"
hyper = "0.14"
http = "1.0"
http-body = "1.0"
hyper = "1.0"
lambda_runtime = { path = "../lambda-runtime", version = "0.8.3" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Expand Down
6 changes: 3 additions & 3 deletions lambda-runtime-api-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.8.0"
edition = "2021"
authors = [
"David Calavera <[email protected]>",
"Harold Sun <[email protected]>"
"Harold Sun <[email protected]>",
]
description = "AWS Lambda Runtime interaction API"
license = "Apache-2.0"
Expand All @@ -14,7 +14,7 @@ keywords = ["AWS", "Lambda", "API"]
readme = "README.md"

[dependencies]
http = "0.2"
hyper = { version = "0.14.20", features = ["http1", "client", "stream", "tcp"] }
http = "1.0"
hyper = { version = "1.0", features = ["http1", "client"] }
tower-service = "0.3"
tokio = { version = "1.0", features = ["io-util"] }
2 changes: 1 addition & 1 deletion lambda-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ futures = "0.3"
serde = { version = "1", features = ["derive", "rc"] }
serde_json = "^1"
bytes = "1.0"
http = "0.2"
http = "1.0"
async-stream = "0.3"
tracing = { version = "0.1.37", features = ["log"] }
tower = { version = "0.4", features = ["util"] }
Expand Down