diff --git a/uwsgi.c b/uwsgi.c index 2dfa357a..f96afa88 100644 --- a/uwsgi.c +++ b/uwsgi.c @@ -105,6 +105,7 @@ static struct option long_options[] = { {"post-buffering", required_argument, 0, LONG_ARGS_POST_BUFFERING}, {"post-buffering-bufsize", required_argument, 0, LONG_ARGS_POST_BUFFERING_SIZE}, {"ignore-script-name", no_argument, &uwsgi.ignore_script_name, 1}, + {"no-default-app", no_argument, &uwsgi.no_default_app, 1}, #ifdef UWSGI_UDP {"udp", required_argument, 0, LONG_ARGS_UDP}, #endif @@ -3191,6 +3192,7 @@ void manage_opt(int i, char *optarg) { \t--logto \t\tlog to file/udp\n\ \t--logdate\t\t\tadd timestamp to loglines\n\ \t--ignore-script-name\t\tdisable uWSGI management of SCRIPT_NAME\n\ +\t--no-default-app\t\tdo not fallback unknown SCRIPT_NAME requests\n\ \t--ini \t\t\tpath of ini config file\n\ \t--ini-paste \t\tpath of ini config file that contains paste configuration\n\ \t--ldap \t\t\turl of LDAP uWSGIConfig resource\n\ diff --git a/uwsgi.h b/uwsgi.h index d2694db0..13ea102c 100644 --- a/uwsgi.h +++ b/uwsgi.h @@ -177,6 +177,7 @@ PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromString(char *, Py_ssize_t); #define LONG_ARGS_INI_PASTE 17041 #define LONG_ARGS_CALLABLE 17042 #define LONG_ARGS_HTTP_VAR 17043 +#define LONG_ARGS_NO_DEFAULT_APP 17044 @@ -463,6 +464,7 @@ struct uwsgi_server { #endif int ignore_script_name; + int no_default_app; int logdate; int serverfd; diff --git a/wsgi_handlers.c b/wsgi_handlers.c index 04c05bd6..afd3696f 100644 --- a/wsgi_handlers.c +++ b/wsgi_handlers.c @@ -165,8 +165,14 @@ int uwsgi_request_wsgi(struct uwsgi_server *uwsgi, struct wsgi_request *wsgi_req if (wsgi_req->app_id == -1) { - internal_server_error(wsgi_req->poll.fd, "wsgi application not found"); - goto clear2; + // TODO: use default app ? + if (!uwsgi->no_default_app && uwsgi->default_app >= 0) { + wsgi_req->app_id = uwsgi->default_app ; + } + else { + internal_server_error(wsgi_req->poll.fd, "wsgi application not found"); + goto clear2; + } }