diff --git a/ntex-router/src/resource.rs b/ntex-router/src/resource.rs index a8009398..0301ff55 100644 --- a/ntex-router/src/resource.rs +++ b/ntex-router/src/resource.rs @@ -500,6 +500,18 @@ mod tests { tree.insert(&ResourceDef::new("/name/"), 2); assert_eq!(tree.find(&mut Path::new("/name")), Some(1)); assert_eq!(tree.find(&mut Path::new("/name/")), Some(2)); + + let mut tree = Tree::new(&ResourceDef::new(""), 1); + tree.insert(&ResourceDef::new("/test/index.html"), 2); + assert_eq!(tree.find_checked(&mut Path::new(""), &|_, _| true), Some(1)); + assert_eq!( + tree.find_checked(&mut Path::new("index.html"), &|_, _| true), + None + ); + assert_eq!( + tree.find_checked(&mut Path::new("test/index.html"), &|_, _| true), + Some(2) + ); } #[test] diff --git a/ntex-router/src/tree.rs b/ntex-router/src/tree.rs index 0f15af28..f47e8316 100644 --- a/ntex-router/src/tree.rs +++ b/ntex-router/src/tree.rs @@ -247,23 +247,7 @@ impl Tree { return Some(v); } } - Item::Subtree(ref tree) => { - let result = tree.find_inner_wrapped( - "", - resource, - check, - 1, - &mut segments, - insensitive, - base_skip, - ); - if let Some((val, skip)) = result { - let path = resource.resource_path(); - path.segments = segments; - path.skip += skip as u16; - return Some(val); - } - } + _ => continue, } } } else { diff --git a/ntex/src/http/h1/dispatcher.rs b/ntex/src/http/h1/dispatcher.rs index 133f1211..225efcf9 100644 --- a/ntex/src/http/h1/dispatcher.rs +++ b/ntex/src/http/h1/dispatcher.rs @@ -446,11 +446,11 @@ where } // stop io tasks and call upgrade service State::Upgrade(ref mut req) => { - log::trace!("switching to upgrade service"); - let io = this.inner.io.take(); let req = req.take().unwrap(); + log::trace!("switching to upgrade service for {:?}", req); + // Handle UPGRADE request crate::rt::spawn(this.inner.config.upgrade.as_ref().unwrap().call(( req,