Skip to content

Commit 1a08fbb

Browse files
fix compile errors
1 parent d7c0354 commit 1a08fbb

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ where
199199

200200
debug!("Accepted connection from {remote_addr}");
201201

202-
let conn = http_server.serve_connection(TokioIo::new(socket), service);
202+
let conn = http_server.serve_connection(TokioIo::new(socket), service.clone());
203203
let conn = graceful.watch(conn.into_owned());
204204
tokio::spawn(async move {
205205
if let Err(err) = conn.await {

src/service.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
use bytes::Bytes;
2-
use http::StatusCode;
1+
use hyper::StatusCode;
32
use hyper::service::Service;
43
use hyper::{Method, Request, Response, body::Incoming};
54
use reqwest::Url;
@@ -12,6 +11,7 @@ type BoxFuture<T> = Pin<Box<dyn Future<Output = T> + Send + 'static>>;
1211
/// Wraps an S3 service and short-circuits `GET /` and `GET /health` requests,
1312
/// returning `200 OK` with a plain-text `"Status OK"` body without forwarding
1413
/// them to the S3 layer or requiring authentication.
14+
#[derive(Clone)]
1515
pub struct S3CachingServiceProxy<S> {
1616
inner: S,
1717
upstream_health_endpoint: Url,
@@ -40,8 +40,9 @@ where
4040
let response = Response::builder().status(200).body(Body::empty()).unwrap();
4141
Box::pin(std::future::ready(Ok(response)))
4242
} else if req.method() == Method::GET && req.uri().path() == "/upstream-health" {
43-
let upstream_health_request_future = async {
44-
let upstream_status = reqwest::get(self.upstream_health_endpoint.clone())
43+
let upstream_health_endpoint = self.upstream_health_endpoint.clone();
44+
let upstream_health_request_future = async move {
45+
let upstream_status = reqwest::get(upstream_health_endpoint)
4546
.await
4647
.map(|res| res.status())
4748
.unwrap_or_else(|e| {

0 commit comments

Comments
 (0)