File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed
Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff 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 {
Original file line number Diff line number Diff line change 1- use bytes:: Bytes ;
2- use http:: StatusCode ;
1+ use hyper:: StatusCode ;
32use hyper:: service:: Service ;
43use hyper:: { Method , Request , Response , body:: Incoming } ;
54use 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 ) ]
1515pub struct S3CachingServiceProxy < S > {
1616 inner : S ,
1717 upstream_health_endpoint : Url ,
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| {
You can’t perform that action at this time.
0 commit comments