httpswift / swifter

Tiny http server engine written in Swift programming language.
BSD 3-Clause "New" or "Revised" License
3.9k stars 539 forks source link

Routing regression in 1.4.7 #441

Open danoconnor opened 4 years ago

danoconnor commented 4 years ago

Routing behavior for variable paths has changed in 1.4.7 compared to 1.4.6. The variable path can no longer match multiple sub-paths.

For example, I have this route: "/foo/bar/:path"

I expect it to be able to match anything after "foo/bar/", such as "foo/bar/a/b/c". As of 1.4.6, the HttpRouter behaved as expected, but this change (line 116 of HttpRouter.swift) that was released with 1.4.7 added a new behavior that requires the path to be the same length as the route.

Now, the route will only match on a path such as '"foo/bar/a"' and will not match on '"foo/bar/a/b"', since the path goes deeper than the length of the route.

Was this an intentional change or can this be reverted to the old behavior?

Vkt0r commented 4 years ago

You can read more about it here https://github.com/httpswift/swifter/issues/405.