default fallback for unknown SCRIPT_NAME

This commit is contained in:
roberto@sirius
2010-09-03 12:19:27 +02:00
parent 7310b73289
commit b60e22b4e5
3 changed files with 12 additions and 2 deletions
+2
View File
@@ -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 <logfile|addr>\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 <inifile>\t\t\tpath of ini config file\n\
\t--ini-paste <inifile>\t\tpath of ini config file that contains paste configuration\n\
\t--ldap <url>\t\t\turl of LDAP uWSGIConfig resource\n\
+2
View File
@@ -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;
+8 -2
View File
@@ -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;
}
}