X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=contrib%2Fpackage%2Fuhttpd%2Fsrc%2Fuhttpd.c;fp=contrib%2Fpackage%2Fuhttpd%2Fsrc%2Fuhttpd.c;h=ea4ca00c0aa45e2bcd26ad048fdb8d785a13b478;hp=788606068d24afea78bcf163f7695af4b23a41af;hb=5fc3a1ceb01b2f55734373f70a311651092fefa8;hpb=0dd0fdad5589965489cdbf4baf01f3b62f1c24b7 diff --git a/contrib/package/uhttpd/src/uhttpd.c b/contrib/package/uhttpd/src/uhttpd.c index 788606068..ea4ca00c0 100644 --- a/contrib/package/uhttpd/src/uhttpd.c +++ b/contrib/package/uhttpd/src/uhttpd.c @@ -1,5 +1,5 @@ /* - * uhttpd - Tiny non-forking httpd - Main component + * uhttpd - Tiny single-threaded httpd - Main component * * Copyright (C) 2010 Jo-Philipp Wich * @@ -372,6 +372,19 @@ static struct http_request * uh_http_header_recv(struct client *cl) return NULL; } +static int uh_path_match(const char *prefix, const char *url) +{ + if( (strstr(url, prefix) == url) && + ((prefix[strlen(prefix)-1] == '/') || + (strlen(url) == strlen(prefix)) || + (url[strlen(prefix)] == '/')) + ) { + return 1; + } + + return 0; +} + int main (int argc, char **argv) { @@ -735,7 +748,7 @@ int main (int argc, char **argv) { #ifdef HAVE_LUA /* Lua request? */ - if( L && strstr(req->url, conf.lua_prefix) == req->url ) + if( L && uh_path_match(conf.lua_prefix, req->url) ) { uh_lua_request(cl, req, L); } @@ -748,7 +761,7 @@ int main (int argc, char **argv) if( uh_auth_check(cl, req, pin) ) { #ifdef HAVE_CGI - if( strstr(pin->name, conf.cgi_prefix) == pin->name ) + if( uh_path_match(conf.cgi_prefix, pin->name) ) { uh_cgi_request(cl, req, pin); }