File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,8 @@ impl VssService {
3030 }
3131}
3232
33+ const BASE_PATH_PREFIX : & str = "/vss" ;
34+
3335impl Service < Request < Incoming > > for VssService {
3436 type Response = Response < Full < Bytes > > ;
3537 type Error = hyper:: Error ;
@@ -39,8 +41,11 @@ impl Service<Request<Incoming>> for VssService {
3941 let store = Arc :: clone ( & self . store ) ;
4042 let authorizer = Arc :: clone ( & self . authorizer ) ;
4143 let path = req. uri ( ) . path ( ) . to_owned ( ) ;
44+
4245 Box :: pin ( async move {
43- match path. as_str ( ) {
46+ let prefix_stripped_path = path. strip_prefix ( BASE_PATH_PREFIX ) . unwrap_or ( "" ) ;
47+
48+ match prefix_stripped_path {
4449 "/getObject" => {
4550 handle_request ( store, authorizer, req, handle_get_object_request) . await
4651 } ,
@@ -54,10 +59,10 @@ impl Service<Request<Incoming>> for VssService {
5459 handle_request ( store, authorizer, req, handle_list_object_request) . await
5560 } ,
5661 _ => {
57- let error = format ! ( "Unknown request: {}" , path) . into_bytes ( ) ;
62+ let error_msg = "Invalid request path." . as_bytes ( ) ;
5863 Ok ( Response :: builder ( )
5964 . status ( StatusCode :: BAD_REQUEST )
60- . body ( Full :: new ( Bytes :: from ( error ) ) )
65+ . body ( Full :: new ( Bytes :: from ( error_msg ) ) )
6166 . unwrap ( ) )
6267 } ,
6368 }
You can’t perform that action at this time.
0 commit comments