|
1 | 1 | use crate::certification::constants::{ |
2 | | - EXACT_MATCH_TERMINATOR, IC_CERTIFICATE_EXPRESSION, IC_CERTIFICATE_EXPRESSION_HEADER, |
3 | | - IC_STATUS_CODE_PSEUDO_HEADER, LABEL_HTTP_EXPR, WILDCARD_MATCH_TERMINATOR, |
| 2 | + IC_CERTIFICATE_EXPRESSION, IC_CERTIFICATE_EXPRESSION_HEADER, IC_STATUS_CODE_PSEUDO_HEADER, |
| 3 | + LABEL_HTTP_EXPR, WILDCARD_MATCH_TERMINATOR, |
4 | 4 | }; |
5 | 5 | use crate::http::types::{HeaderField, StatusCode}; |
6 | 6 | use crate::types::state::FullPath; |
@@ -41,19 +41,18 @@ pub fn nested_tree_path(full_path: &str, terminator: &str) -> Vec<Blob> { |
41 | 41 | segments |
42 | 42 | } |
43 | 43 |
|
44 | | -pub fn fallback_paths(paths: Vec<Blob>) -> Vec<Blob> { |
| 44 | +pub fn fallback_paths(paths: Vec<Blob>) -> Vec<Vec<Blob>> { |
45 | 45 | let mut fallback_paths = Vec::new(); |
46 | 46 |
|
47 | | - // starting at 1 because "http_expr" is always the starting element |
48 | | - for i in 1..paths.len() { |
| 47 | + for i in 0..paths.len() { |
49 | 48 | let mut without_trailing_slash: Vec<Blob> = paths.as_slice()[0..i].to_vec(); |
50 | 49 | let mut with_trailing_slash = without_trailing_slash.clone(); |
51 | | - without_trailing_slash.push(EXACT_MATCH_TERMINATOR.as_bytes().to_vec()); |
| 50 | + without_trailing_slash.push(WILDCARD_MATCH_TERMINATOR.as_bytes().to_vec()); |
52 | 51 | with_trailing_slash.push("".as_bytes().to_vec()); |
53 | 52 | with_trailing_slash.push(WILDCARD_MATCH_TERMINATOR.as_bytes().to_vec()); |
54 | 53 |
|
55 | | - fallback_paths.extend(without_trailing_slash); |
56 | | - fallback_paths.extend(with_trailing_slash); |
| 54 | + fallback_paths.push(without_trailing_slash); |
| 55 | + fallback_paths.push(with_trailing_slash); |
57 | 56 | } |
58 | 57 |
|
59 | 58 | fallback_paths |
|
0 commit comments