From 21e4cc19c8f25dafa882952f6b209c2f66b792c7 Mon Sep 17 00:00:00 2001 From: "roberto@sirius" Date: Sat, 11 Sep 2010 17:40:52 +0200 Subject: [PATCH] export x-wsgiorg.uwsgi.version in WSGI env --- uwsgi.c | 2 ++ wsgi_handlers.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/uwsgi.c b/uwsgi.c index fa89bced..7b7b1539 100644 --- a/uwsgi.c +++ b/uwsgi.c @@ -2593,6 +2593,7 @@ void uwsgi_wsgi_config(char *filename) { } } + wsgi_dict = PyModule_GetDict(wsgi_module); if (!wsgi_dict) { PyErr_Print(); @@ -2658,6 +2659,7 @@ void uwsgi_wsgi_config(char *filename) { } } else { + app_app = PyDict_GetItemString(wsgi_dict, quick_callable); } if (app_app) { diff --git a/wsgi_handlers.c b/wsgi_handlers.c index 64c423ab..0805f530 100644 --- a/wsgi_handlers.c +++ b/wsgi_handlers.c @@ -81,11 +81,17 @@ int uwsgi_request_wsgi(struct uwsgi_server *uwsgi, struct wsgi_request *wsgi_req PyObject *pydictkey, *pydictvalue; + static PyObject *uwsgi_version = NULL; + char *path_info; struct uwsgi_app *wi ; int tmp_stderr; + if (uwsgi_version == NULL) { + uwsgi_version = PyString_FromString(UWSGI_VERSION); + } + #ifdef UWSGI_ASYNC if (wsgi_req->async_status == UWSGI_AGAIN) { // get rid of timeout @@ -347,6 +353,8 @@ int uwsgi_request_wsgi(struct uwsgi_server *uwsgi, struct wsgi_request *wsgi_req PyDict_SetItemString(uwsgi->embedded_dict, "env", wsgi_req->async_environ); + PyDict_SetItemString(wsgi_req->async_environ, "x-wsgiorg.uwsgi.version", uwsgi_version); + #ifdef UWSGI_ROUTING uwsgi_log("routing %d routes %d\n", uwsgi->routing, uwsgi->nroutes);