Skip to content
Browse files

prepare for language independent home concept

  • Loading branch information...
1 parent 2263c6a commit 1b8920393233b95d480e00279fac89ee40451818 @unbit committed Apr 4, 2013
Showing with 15 additions and 9 deletions.
  1. +8 −2 core/protocol.c
  2. +5 −5 plugins/python/pyloader.c
  3. +2 −2 uwsgi.h
View
10 core/protocol.c
@@ -312,6 +312,12 @@ static int uwsgi_proto_check_10(struct wsgi_request *wsgi_req, char *key, char *
return 0;
}
+ if (!uwsgi_proto_key("UWSGI_HOME", 10)) {
+ wsgi_req->home = buf;
+ wsgi_req->home_len = len;
+ return 0;
+ }
+
return 0;
}
@@ -416,8 +422,8 @@ static int uwsgi_proto_check_12(struct wsgi_request *wsgi_req, char *key, char *
}
if (!uwsgi_proto_key("UWSGI_PYHOME", 12)) {
- wsgi_req->pyhome = buf;
- wsgi_req->pyhome_len = len;
+ wsgi_req->home = buf;
+ wsgi_req->home_len = len;
return 0;
}
View
10 plugins/python/pyloader.c
@@ -33,12 +33,12 @@ void set_dyn_pyhome(char *home, uint16_t pyhome_len) {
}
// simulate a pythonhome directive
- if (uwsgi.wsgi_req->pyhome_len > 0) {
+ if (uwsgi.wsgi_req->home_len > 0) {
- PyObject *venv_path = UWSGI_PYFROMSTRINGSIZE(uwsgi.wsgi_req->pyhome, uwsgi.wsgi_req->pyhome_len);
+ PyObject *venv_path = UWSGI_PYFROMSTRINGSIZE(uwsgi.wsgi_req->home, uwsgi.wsgi_req->home_len);
#ifdef UWSGI_DEBUG
- uwsgi_debug("setting dynamic virtualenv to %.*s\n", uwsgi.wsgi_req->pyhome_len, uwsgi.wsgi_req->pyhome);
+ uwsgi_debug("setting dynamic virtualenv to %.*s\n", uwsgi.wsgi_req->home_len, uwsgi.wsgi_req->home);
#endif
PyDict_SetItemString(pysys_dict, "prefix", venv_path);
@@ -177,8 +177,8 @@ int init_uwsgi_app(int loader, void *arg1, struct wsgi_request *wsgi_req, PyThre
wi->interpreter = up.main_thread;
}
- if (wsgi_req->pyhome_len) {
- set_dyn_pyhome(wsgi_req->pyhome, wsgi_req->pyhome_len);
+ if (wsgi_req->home_len) {
+ set_dyn_pyhome(wsgi_req->home, wsgi_req->home_len);
}
if (wsgi_req->touch_reload_len > 0 && wsgi_req->touch_reload_len < 0xff) {
View
4 uwsgi.h
@@ -1265,8 +1265,8 @@ struct uwsgi_router {
uint16_t module_len;
char *callable;
uint16_t callable_len;
- char *pyhome;
- uint16_t pyhome_len;
+ char *home;
+ uint16_t home_len;
char *file;
uint16_t file_len;

0 comments on commit 1b89203

Please sign in to comment.
Something went wrong with that request. Please try again.