diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2012-11-22 00:46:57 +0000 |
---|---|---|
committer | Matthieu Patou <mat@matws.net> | 2012-11-22 14:57:42 -0800 |
commit | ac635d02de202523d8921ce752d7f93e2377bb07 (patch) | |
tree | 546c91a7aaa6a730d3a3dc63ae299d677db4ee38 /source4/web_server | |
parent | 3bffb585ba36753cf1ebd5c00e7a47f1974b0d85 (diff) | |
download | samba-ac635d02de202523d8921ce752d7f93e2377bb07.tar.gz samba-ac635d02de202523d8921ce752d7f93e2377bb07.tar.bz2 samba-ac635d02de202523d8921ce752d7f93e2377bb07.zip |
web_server: Properly set SCRIPT_NAME and PATH_INFO.
Reviewed-by: Matthieu Patou <mat@matws.net>
Diffstat (limited to 'source4/web_server')
-rw-r--r-- | source4/web_server/wsgi.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/source4/web_server/wsgi.c b/source4/web_server/wsgi.c index 4d2b36358b..e3e5a0fa31 100644 --- a/source4/web_server/wsgi.c +++ b/source4/web_server/wsgi.c @@ -292,12 +292,15 @@ static PyObject *create_environ(bool tls, int content_length, struct http_header } PyDict_SetItemString(env, "REQUEST_METHOD", PyString_FromString(request_method)); + /* There is always a single wsgi app to which all requests are redirected, + * so SCRIPT_NAME will be / */ + PyDict_SetItemString(env, "SCRIPT_NAME", PyString_FromString("/")); questionmark = strchr(request_string, '?'); if (questionmark == NULL) { - PyDict_SetItemString(env, "SCRIPT_NAME", PyString_FromString(request_string)); + PyDict_SetItemString(env, "PATH_INFO", PyString_FromString(request_string)); } else { PyDict_SetItemString(env, "QUERY_STRING", PyString_FromString(questionmark+1)); - PyDict_SetItemString(env, "SCRIPT_NAME", PyString_FromStringAndSize(request_string, questionmark-request_string)); + PyDict_SetItemString(env, "PATH_INFO", PyString_FromStringAndSize(request_string, questionmark-request_string)); } PyDict_SetItemString(env, "SERVER_NAME", PyString_FromString(servername)); |