src/url_handlers.c: Re-work the URI handling

Introduce a uri_map() function that takes the URI to check and the
URI handler function to run for the given URI.

e.g

    uri_map("/login/", login);

If the request URI is for /login/ then the login() function will be
called. This replaces

    if (match_uri(request_uri, "login/") {
        login();
        goto out;
    }

Due to uri_map being a function, we can't do the goto out; bit. However
we can use longjmp(3) to achieve the same thing, by using setjmp(3)
before calling the uri_map functions we will return to that setjmp with
a return value of 1 (in this case) to signal that we have matched a URI
and should skip the rest of the URI matching.

We do a setjmp before the uri_map's for the URIs that don't require
authentication and another setjmp before the uri_map's that do, as we
need to do some slightly different things in the two cases.

This results in a nice code reduction and certainly makes things quite a
bit cleaner and simpler going forward.

Signed-off-by: Andrew Clayton <andrew@digital-domain.net>
src/url_handlers.c: Cleanup match_uri() a little

Move the definition of request_uri to above this function and remove the
request_uri parameter.

Signed-off-by: Andrew Clayton <andrew@digital-domain.net>
src/url_handlers.c: Cleanup match_uri() a little more

Rename the match parameter to uri, this reads a little more clearly.

Signed-off-by: Andrew Clayton <andrew@digital-domain.net>