diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2010-03-20 23:51:51 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2010-03-20 23:51:51 +0000 |
commit | 95b9bb0f69fa4ed2bc2c414a614d1723b1e59e21 (patch) | |
tree | 2ff64ee3b570d8e269e7e5a24e33a76944bf8d96 /contrib/package/uhttpd/src/uhttpd.c | |
parent | 1ecf7ac9fa9499d79ccebf805090b2fd1310f3d9 (diff) |
uhttpd: add basic auth infrastructure
Diffstat (limited to 'contrib/package/uhttpd/src/uhttpd.c')
-rw-r--r-- | contrib/package/uhttpd/src/uhttpd.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/contrib/package/uhttpd/src/uhttpd.c b/contrib/package/uhttpd/src/uhttpd.c index ccbc9efc6b..7a5f42ad61 100644 --- a/contrib/package/uhttpd/src/uhttpd.c +++ b/contrib/package/uhttpd/src/uhttpd.c @@ -268,7 +268,7 @@ static struct http_request * uh_http_header_parse(struct client *cl, char *buffe static struct http_request * uh_http_header_recv(struct client *cl) { - char buffer[UH_LIMIT_MSGHEAD]; + static char buffer[UH_LIMIT_MSGHEAD]; char *bufptr = &buffer[0]; char *idxptr = NULL; @@ -670,7 +670,7 @@ int main (int argc, char **argv) { #ifdef HAVE_LUA /* Lua request? */ - if( strstr(req->url, conf.lua_prefix) == req->url ) + if( L && strstr(req->url, conf.lua_prefix) == req->url ) { uh_lua_request(cl, req, L); } @@ -679,15 +679,19 @@ int main (int argc, char **argv) /* dispatch request */ if( (pin = uh_path_lookup(cl, req->url)) != NULL ) { -#ifdef HAVE_CGI - if( strstr(pin->name, conf.cgi_prefix) == pin->name ) + /* auth ok? */ + if( uh_auth_check(cl, req, pin) ) { - uh_cgi_request(cl, req, pin); - } - else +#ifdef HAVE_CGI + if( strstr(pin->name, conf.cgi_prefix) == pin->name ) + { + uh_cgi_request(cl, req, pin); + } + else #endif - { - uh_file_request(cl, req, pin); + { + uh_file_request(cl, req, pin); + } } } |