@@ -102,7 +102,7 @@ pub(crate) struct WorkerConfig {
102102 pub http1_opts : HTTP1Config ,
103103 pub http2_opts : HTTP2Config ,
104104 pub websockets_enabled : bool ,
105- pub static_files : Option < ( String , String , Option < String > , Option < String > ) > ,
105+ pub static_files : Option < ( Vec < ( String , String ) > , Option < String > , Option < String > ) > ,
106106 pub tls_opts : Option < WorkerTlsConfig > ,
107107 pub metrics : (
108108 Option < std:: time:: Duration > ,
@@ -134,7 +134,7 @@ impl WorkerConfig {
134134 http1_opts : HTTP1Config ,
135135 http2_opts : HTTP2Config ,
136136 websockets_enabled : bool ,
137- static_files : Option < ( String , String , Option < String > , Option < String > ) > ,
137+ static_files : Option < ( Vec < ( String , String ) > , Option < String > , Option < String > ) > ,
138138 ssl_enabled : bool ,
139139 ssl_cert : Option < String > ,
140140 ssl_key : Option < String > ,
@@ -264,8 +264,7 @@ impl<M> WorkerCTXBase<M> {
264264pub ( crate ) struct WorkerCTXFiles < M > {
265265 pub callback : crate :: callbacks:: ArcCBScheduler ,
266266 pub metrics : M ,
267- pub static_prefix : String ,
268- pub static_mount : String ,
267+ pub static_mounts : Vec < ( String , String ) > ,
269268 pub static_dir_to_file : Option < String > ,
270269 pub static_expires : Option < String > ,
271270}
@@ -274,14 +273,13 @@ impl<M> WorkerCTXFiles<M> {
274273 pub fn new (
275274 callback : crate :: callbacks:: PyCBScheduler ,
276275 metrics : M ,
277- files : Option < ( String , String , Option < String > , Option < String > ) > ,
276+ files : Option < ( Vec < ( String , String ) > , Option < String > , Option < String > ) > ,
278277 ) -> Self {
279- let ( static_prefix , static_mount , static_dir_to_file, static_expires) = files. unwrap ( ) ;
278+ let ( static_mounts , static_dir_to_file, static_expires) = files. unwrap ( ) ;
280279 Self {
281280 callback : Arc :: new ( callback) ,
282281 metrics,
283- static_prefix,
284- static_mount,
282+ static_mounts,
285283 static_dir_to_file,
286284 static_expires,
287285 }
@@ -406,8 +404,7 @@ macro_rules! service_impl {
406404 fn call( & self , req: crate :: http:: HTTPRequest ) -> Self :: Future {
407405 if let Some ( static_match) = crate :: files:: match_static_file(
408406 req. uri( ) . path( ) ,
409- & self . ctx. static_prefix,
410- & self . ctx. static_mount,
407+ & self . ctx. static_mounts,
411408 self . ctx. static_dir_to_file. as_ref( ) ,
412409 ) {
413410 if static_match. is_err( ) {
@@ -484,8 +481,7 @@ macro_rules! service_impl {
484481
485482 if let Some ( static_match) = crate :: files:: match_static_file(
486483 req. uri( ) . path( ) ,
487- & self . ctx. static_prefix,
488- & self . ctx. static_mount,
484+ & self . ctx. static_mounts,
489485 self . ctx. static_dir_to_file. as_ref( ) ,
490486 ) {
491487 self . ctx
0 commit comments