/* Returns NULL on error.
** NB: improperly encoded URL should give client 400 [Bad Syntax]; returning
** NULL here causes 404 [Not Found], but that's not too unreasonable. */
-static struct path_info *
+struct path_info *
uh_path_lookup(struct client *cl, const char *url)
{
static char path_phys[PATH_MAX];
url = uh_handle_alias(url);
+ uh_handler_run(cl, &url, false);
+ if (!url)
+ return;
+
req->redirect_status = 200;
d = dispatch_find(url, NULL);
if (d)
if (__handle_file_request(cl, url))
return;
+ if (uh_handler_run(cl, &url, true) &&
+ (!url || __handle_file_request(cl, url)))
+ return;
+
req->redirect_status = 404;
if (conf.error_handler) {
error_handler = alloca(strlen(conf.error_handler) + 1);