Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
When looking up url handlers, libprocess is looking for the longest URL prefix that corresponds to a http endpoint handler registered by the handling process.
For example if a process did setup route `/foo` and `/foo/bar`, an incoming http request for `/foo/bar/baz` would be dispatched onto the `/foo/bar` handler.
However, if a process registers a route `/` the lookup will only succeed if the request is exactly for `/`, and a request for `/baz` will return a 404 Not Found response.
The root cause of this is the implementation of the handler lookup:
// ProcessBase::consume(HttpEvent&&) name = strings::trim(name, strings::PREFIX, "/"); [...] while (Path(name, '/').dirname() != name) { [...] }
where `dirname()` returns "." when given an input string that does not contain any `/` as `name`.