mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-08 06:31:58 +00:00
fixed paste support: Plone threaded works perfectly
This commit is contained in:
@@ -407,11 +407,9 @@ PyObject *uwsgi_mount_loader(void *arg1) {
|
||||
if ( !strcmp(what+strlen(what)-3, ".py") || !strcmp(what+strlen(what)-5, ".wsgi")) {
|
||||
callable = uwsgi_file_loader((void *)what);
|
||||
}
|
||||
#ifdef UWSGI_PASTE
|
||||
else if (!strcmp(what+strlen(what)-4, ".ini")) {
|
||||
callable = uwsgi_paste_loader((void *)what);
|
||||
}
|
||||
#endif
|
||||
else if (strchr(what, ':')) {
|
||||
callable = uwsgi_uwsgi_loader((void *)what);
|
||||
}
|
||||
@@ -451,14 +449,14 @@ PyObject *uwsgi_dyn_loader(void *arg1) {
|
||||
callable = uwsgi_file_loader((void *)tmpstr);
|
||||
free(tmpstr);
|
||||
}
|
||||
#ifdef UWSGI_PASTE
|
||||
// MANAGE UWSGI_PASTE
|
||||
// TODO MANAGE UWSGI_PASTE
|
||||
/*
|
||||
else if (wsgi_req->wsgi_paste_len > 0) {
|
||||
tmpstr = uwsgi_strncopy(wsgi_req->paste, wsgi_req->paste_len);
|
||||
callable = uwsgi_paste_loader((void *)tmpstr);
|
||||
free(tmpstr);
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
|
||||
return callable;
|
||||
}
|
||||
@@ -496,7 +494,6 @@ PyObject *uwsgi_file_loader(void *arg1) {
|
||||
|
||||
}
|
||||
|
||||
#ifdef UWSGI_PASTE
|
||||
PyObject *uwsgi_paste_loader(void *arg1) {
|
||||
|
||||
char *paste = (char *) arg1;
|
||||
@@ -543,8 +540,6 @@ PyObject *uwsgi_paste_loader(void *arg1) {
|
||||
return paste_app;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
PyObject *uwsgi_eval_loader(void *arg1) {
|
||||
|
||||
char *code = (char *) arg1;
|
||||
|
||||
@@ -17,11 +17,9 @@ struct option uwsgi_python_options[] = {
|
||||
{"pp", required_argument, 0, LONG_ARGS_PYTHONPATH},
|
||||
{"pyargv", required_argument, 0, LONG_ARGS_PYARGV},
|
||||
{"optimize", required_argument, 0, 'O'},
|
||||
#ifdef UWSGI_PASTE
|
||||
{"paste", required_argument, 0, LONG_ARGS_PASTE},
|
||||
#ifdef UWSGI_INI
|
||||
{"ini-paste", required_argument, 0, LONG_ARGS_INI_PASTE},
|
||||
#endif
|
||||
#endif
|
||||
{"catch-exceptions", no_argument, &up.catch_exceptions, 1},
|
||||
{"ignore-script-name", no_argument, &up.ignore_script_name, 1},
|
||||
@@ -112,9 +110,7 @@ int uwsgi_python_init() {
|
||||
#endif
|
||||
up.loaders[LOADER_UWSGI] = uwsgi_uwsgi_loader;
|
||||
up.loaders[LOADER_FILE] = uwsgi_file_loader;
|
||||
#ifdef UWSGI_PASTE
|
||||
up.loaders[LOADER_PASTE] = uwsgi_paste_loader;
|
||||
#endif
|
||||
up.loaders[LOADER_EVAL] = uwsgi_eval_loader;
|
||||
up.loaders[LOADER_MOUNT] = uwsgi_mount_loader;
|
||||
up.loaders[LOADER_CALLABLE] = uwsgi_callable_loader;
|
||||
@@ -631,6 +627,22 @@ int uwsgi_python_magic(char *mountpoint, char *lazy) {
|
||||
case LONG_ARGS_CALLABLE:
|
||||
up.callable = optarg;
|
||||
return 1;
|
||||
|
||||
|
||||
case LONG_ARGS_INI_PASTE:
|
||||
uwsgi.ini = optarg;
|
||||
if (uwsgi.ini[0] != '/') {
|
||||
up.paste = uwsgi_concat4("config:", uwsgi.cwd, "/", uwsgi.ini);
|
||||
} else {
|
||||
up.paste = uwsgi_concat2("config:", uwsgi.ini);
|
||||
}
|
||||
return 1;
|
||||
case LONG_ARGS_PASTE:
|
||||
up.paste = optarg;
|
||||
return 1;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -656,11 +668,9 @@ int uwsgi_python_mount_app(char *mountpoint, char *app) {
|
||||
if (up.file_config != NULL) {
|
||||
init_uwsgi_app(LOADER_FILE, up.file_config, uwsgi.wsgi_req, up.main_thread);
|
||||
}
|
||||
#ifdef UWSGI_PASTE
|
||||
if (up.paste != NULL) {
|
||||
init_uwsgi_app(LOADER_PASTE, up.paste, uwsgi.wsgi_req, up.main_thread);
|
||||
}
|
||||
#endif
|
||||
if (up.eval != NULL) {
|
||||
init_uwsgi_app(LOADER_EVAL, up.eval, uwsgi.wsgi_req, up.main_thread);
|
||||
}
|
||||
|
||||
@@ -135,9 +135,7 @@ void init_uwsgi_embedded_module(void);
|
||||
|
||||
|
||||
void uwsgi_wsgi_config(char *);
|
||||
#ifdef UWSGI_PASTE
|
||||
void uwsgi_paste_config(char *);
|
||||
#endif
|
||||
void uwsgi_file_config(char *);
|
||||
void uwsgi_eval_config(char *);
|
||||
|
||||
|
||||
@@ -143,9 +143,7 @@ int uwsgi_request_wsgi(struct wsgi_request *wsgi_req) {
|
||||
if (wsgi_req->script_len > 0
|
||||
|| wsgi_req->module_len > 0
|
||||
|| wsgi_req->file_len > 0
|
||||
#ifdef UWSGI_PASTE
|
||||
|| wsgi_req->paste_len > 0
|
||||
#endif
|
||||
) {
|
||||
// a bit of magic: 1-1 = 0 / 0-1 = -1
|
||||
// this part must be heavy locked in threaded modes
|
||||
|
||||
Reference in New Issue
Block a user