mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-10-03 23:48:22 +00:00
xml parsing and pluginized getopt_long stabilization
This commit is contained in:
@@ -20,7 +20,7 @@ evdis = false
|
||||
ldap = true
|
||||
routing = false
|
||||
stackless = false
|
||||
debug = true
|
||||
debug = false
|
||||
unbit = false
|
||||
xml_implementation = libxml2
|
||||
plugins = python
|
||||
|
||||
@@ -40,8 +40,6 @@ void log_request(struct wsgi_request *wsgi_req) {
|
||||
|
||||
struct uwsgi_app *wi;
|
||||
|
||||
uwsgi_log("LOGGING...\n");
|
||||
|
||||
if (wsgi_req->app_id >= 0) {
|
||||
wi = &uwsgi.apps[wsgi_req->app_id];
|
||||
if (wi->requests > 0) {
|
||||
|
||||
@@ -374,32 +374,32 @@ PyObject *uwsgi_dyn_loader(void *arg1) {
|
||||
struct wsgi_request *wsgi_req = (struct wsgi_request *) arg1;
|
||||
|
||||
// MANAGE UWSGI_SCRIPT
|
||||
if (wsgi_req->wsgi_script_len > 0) {
|
||||
tmpstr = uwsgi_strncopy(wsgi_req->wsgi_script, wsgi_req->wsgi_script_len);
|
||||
if (wsgi_req->script_len > 0) {
|
||||
tmpstr = uwsgi_strncopy(wsgi_req->script, wsgi_req->script_len);
|
||||
callable = uwsgi_uwsgi_loader((void *)tmpstr);
|
||||
free(tmpstr);
|
||||
}
|
||||
// MANAGE UWSGI_MODULE
|
||||
else if (wsgi_req->wsgi_module_len > 0) {
|
||||
if (wsgi_req->wsgi_callable_len > 0) {
|
||||
tmpstr = uwsgi_concat3n(wsgi_req->wsgi_module, wsgi_req->wsgi_module_len, ":", 1, wsgi_req->wsgi_callable, wsgi_req->wsgi_callable_len);
|
||||
else if (wsgi_req->module_len > 0) {
|
||||
if (wsgi_req->callable_len > 0) {
|
||||
tmpstr = uwsgi_concat3n(wsgi_req->module, wsgi_req->module_len, ":", 1, wsgi_req->callable, wsgi_req->callable_len);
|
||||
}
|
||||
else {
|
||||
tmpstr = uwsgi_strncopy(wsgi_req->wsgi_module, wsgi_req->wsgi_module_len);
|
||||
tmpstr = uwsgi_strncopy(wsgi_req->module, wsgi_req->module_len);
|
||||
}
|
||||
callable = uwsgi_uwsgi_loader((void *)tmpstr);
|
||||
free(tmpstr);
|
||||
}
|
||||
// MANAGE UWSGI_FILE
|
||||
else if (wsgi_req->wsgi_file_len > 0) {
|
||||
tmpstr = uwsgi_strncopy(wsgi_req->wsgi_file, wsgi_req->wsgi_file_len);
|
||||
else if (wsgi_req->file_len > 0) {
|
||||
tmpstr = uwsgi_strncopy(wsgi_req->file, wsgi_req->file_len);
|
||||
callable = uwsgi_file_loader((void *)tmpstr);
|
||||
free(tmpstr);
|
||||
}
|
||||
#ifdef UWSGI_PASTE
|
||||
// MANAGE UWSGI_PASTE
|
||||
else if (wsgi_req->wsgi_paste_len > 0) {
|
||||
tmpstr = uwsgi_strncopy(wsgi_req->wsgi_paste, wsgi_req->wsgi_paste_len);
|
||||
tmpstr = uwsgi_strncopy(wsgi_req->paste, wsgi_req->paste_len);
|
||||
callable = uwsgi_paste_loader((void *)tmpstr);
|
||||
free(tmpstr);
|
||||
}
|
||||
|
||||
@@ -592,6 +592,36 @@ void uwsgi_python_init_thread() {
|
||||
|
||||
}
|
||||
|
||||
int uwsgi_python_xml(char *node, char *content) {
|
||||
|
||||
if (!strcmp("script", node)) {
|
||||
return init_uwsgi_app(LOADER_UWSGI, content, uwsgi.wsgi_req, uwsgi.single_interpreter-1);
|
||||
}
|
||||
else if (!strcmp("file", node)) {
|
||||
return init_uwsgi_app(LOADER_FILE, content, uwsgi.wsgi_req, uwsgi.single_interpreter-1);
|
||||
}
|
||||
else if (!strcmp("eval", node)) {
|
||||
return init_uwsgi_app(LOADER_EVAL, content, uwsgi.wsgi_req, uwsgi.single_interpreter-1);
|
||||
}
|
||||
else if (!strcmp("module", node)) {
|
||||
uwsgi.wsgi_req->module = content;
|
||||
uwsgi.wsgi_req->module_len = strlen(content);
|
||||
return 1;
|
||||
}
|
||||
else if (!strcmp("pyhome", node)) {
|
||||
uwsgi.wsgi_req->pyhome = content;
|
||||
uwsgi.wsgi_req->pyhome_len = strlen(content);
|
||||
return 1;
|
||||
}
|
||||
else if (!strcmp("callable", node)) {
|
||||
uwsgi.wsgi_req->callable = content;
|
||||
uwsgi.wsgi_req->callable_len = strlen(content);
|
||||
return init_uwsgi_app(LOADER_DYN, uwsgi.wsgi_req, uwsgi.wsgi_req, uwsgi.single_interpreter-1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct uwsgi_plugin python_plugin = {
|
||||
|
||||
.name = "python",
|
||||
@@ -605,6 +635,7 @@ struct uwsgi_plugin python_plugin = {
|
||||
.init_apps = uwsgi_python_init_app,
|
||||
.enable_threads = uwsgi_python_enable_threads,
|
||||
.init_thread = uwsgi_python_init_thread,
|
||||
.manage_xml = uwsgi_python_xml,
|
||||
/*
|
||||
.magic = uwsgi_python_magic,
|
||||
.help = uwsgi_python_help,
|
||||
|
||||
@@ -12,9 +12,7 @@ PyObject *python_call(PyObject *callable, PyObject *args, int catch) {
|
||||
|
||||
PyObject *pyret;
|
||||
|
||||
uwsgi_log("CALLING %p %p\n", callable, args);
|
||||
pyret = PyEval_CallObject(callable, args);
|
||||
uwsgi_log("CALLED\n");
|
||||
|
||||
if (PyErr_Occurred()) {
|
||||
if (!catch) {
|
||||
@@ -28,8 +26,6 @@ PyObject *python_call(PyObject *callable, PyObject *args, int catch) {
|
||||
}
|
||||
#endif
|
||||
|
||||
uwsgi_log("called\n");
|
||||
|
||||
return pyret;
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
@@ -106,7 +106,6 @@ int uwsgi_request_wsgi(struct wsgi_request *wsgi_req) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
uwsgi_log("uno\n");
|
||||
|
||||
if (uwsgi.limit_post) {
|
||||
if (wsgi_req->post_cl > uwsgi.limit_post) {
|
||||
@@ -138,11 +137,11 @@ int uwsgi_request_wsgi(struct wsgi_request *wsgi_req) {
|
||||
if (wsgi_req->script_name_len > 1 || uwsgi.default_app < 0 || uwsgi.vhost) {
|
||||
/* unavailable app for this SCRIPT_NAME */
|
||||
wsgi_req->app_id = -1;
|
||||
if (wsgi_req->wsgi_script_len > 0
|
||||
|| wsgi_req->wsgi_module_len > 0
|
||||
|| wsgi_req->wsgi_file_len > 0
|
||||
if (wsgi_req->script_len > 0
|
||||
|| wsgi_req->module_len > 0
|
||||
|| wsgi_req->file_len > 0
|
||||
#ifdef UWSGI_PASTE
|
||||
|| wsgi_req->wsgi_paste_len > 0
|
||||
|| wsgi_req->paste_len > 0
|
||||
#endif
|
||||
) {
|
||||
// a bit of magic: 1-1 = 0 / 0-1 = -1
|
||||
@@ -275,7 +274,6 @@ int uwsgi_request_wsgi(struct wsgi_request *wsgi_req) {
|
||||
|
||||
|
||||
|
||||
uwsgi_log("OOOOOPS000\n");
|
||||
|
||||
if (uwsgi.post_buffering > 0 && wsgi_req->post_cl > (size_t) uwsgi.post_buffering) {
|
||||
UWSGI_RELEASE_GIL
|
||||
@@ -317,15 +315,12 @@ int uwsgi_request_wsgi(struct wsgi_request *wsgi_req) {
|
||||
wsgi_req->async_result = wi->request_subhandler(wsgi_req, wi);
|
||||
|
||||
|
||||
uwsgi_log("fase2\n");
|
||||
|
||||
if (wsgi_req->async_result) {
|
||||
|
||||
|
||||
UWSGI_RELEASE_GIL
|
||||
while ( (*wi->response_subhandler)(wsgi_req) != UWSGI_OK) {
|
||||
wsgi_req->switches++;
|
||||
uwsgi_log("again...\n");
|
||||
#ifdef UWSGI_ASYNC
|
||||
if (uwsgi.async > 1) {
|
||||
return UWSGI_AGAIN;
|
||||
@@ -369,7 +364,6 @@ int uwsgi_request_wsgi(struct wsgi_request *wsgi_req) {
|
||||
close(tmp_stderr);
|
||||
}
|
||||
|
||||
uwsgi_log("opps\n");
|
||||
|
||||
clear:
|
||||
|
||||
@@ -396,7 +390,6 @@ clear2:
|
||||
|
||||
void uwsgi_after_request_wsgi(struct wsgi_request *wsgi_req) {
|
||||
|
||||
uwsgi_log("LOGGING\n");
|
||||
|
||||
if (uwsgi.shared->options[UWSGI_OPTION_LOGGING]) {
|
||||
log_request(wsgi_req);
|
||||
|
||||
@@ -28,8 +28,6 @@ PyObject *py_uwsgi_spit(PyObject * self, PyObject * args) {
|
||||
}
|
||||
*/
|
||||
|
||||
uwsgi_log("HEADERS !!!!\n");
|
||||
|
||||
head = PyTuple_GetItem(args, 0+shift);
|
||||
if (!head) {
|
||||
goto clear;
|
||||
|
||||
@@ -75,7 +75,6 @@ void *uwsgi_request_subhandler_wsgi(struct wsgi_request *wsgi_req, struct uwsgi_
|
||||
PyDict_SetItemString(wsgi_req->async_environ, "wsgi.url_scheme", zero);
|
||||
Py_DECREF(zero);
|
||||
|
||||
uwsgi_log("subhandler ok\n");
|
||||
|
||||
wsgi_req->async_app = wi->callable ;
|
||||
|
||||
@@ -98,7 +97,6 @@ void *uwsgi_request_subhandler_wsgi(struct wsgi_request *wsgi_req, struct uwsgi_
|
||||
|
||||
|
||||
PyTuple_SetItem(wsgi_req->async_args, 0, wsgi_req->async_environ);
|
||||
uwsgi_log("subhandler2 ok %p %p %p\n", wsgi_req->async_app, wsgi_req->async_args, wsgi_req->async_environ );
|
||||
return python_call(wsgi_req->async_app, wsgi_req->async_args, up.catch_exceptions);
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -395,16 +395,16 @@ int uwsgi_parse_vars(struct wsgi_request *wsgi_req) {
|
||||
wsgi_req->scheme_len = strsize;
|
||||
}
|
||||
else if (!uwsgi_strncmp("UWSGI_SCRIPT", 12, wsgi_req->hvec[wsgi_req->var_cnt].iov_base, wsgi_req->hvec[wsgi_req->var_cnt].iov_len )) {
|
||||
wsgi_req->wsgi_script = ptrbuf;
|
||||
wsgi_req->wsgi_script_len = strsize;
|
||||
wsgi_req->script = ptrbuf;
|
||||
wsgi_req->script_len = strsize;
|
||||
}
|
||||
else if (!uwsgi_strncmp("UWSGI_MODULE", 12, wsgi_req->hvec[wsgi_req->var_cnt].iov_base, wsgi_req->hvec[wsgi_req->var_cnt].iov_len)) {
|
||||
wsgi_req->wsgi_module = ptrbuf;
|
||||
wsgi_req->wsgi_module_len = strsize;
|
||||
wsgi_req->module = ptrbuf;
|
||||
wsgi_req->module_len = strsize;
|
||||
}
|
||||
else if (!uwsgi_strncmp("UWSGI_CALLABLE", 14, wsgi_req->hvec[wsgi_req->var_cnt].iov_base, wsgi_req->hvec[wsgi_req->var_cnt].iov_len)) {
|
||||
wsgi_req->wsgi_callable = ptrbuf;
|
||||
wsgi_req->wsgi_callable_len = strsize;
|
||||
wsgi_req->callable = ptrbuf;
|
||||
wsgi_req->callable_len = strsize;
|
||||
}
|
||||
else if (!uwsgi_strncmp("UWSGI_PYHOME", 12, wsgi_req->hvec[wsgi_req->var_cnt].iov_base, wsgi_req->hvec[wsgi_req->var_cnt].iov_len)) {
|
||||
wsgi_req->pyhome = ptrbuf;
|
||||
|
||||
@@ -350,7 +350,6 @@ void uwsgi_close_request(struct wsgi_request *wsgi_req) {
|
||||
}
|
||||
|
||||
// after_request hook
|
||||
uwsgi_log("CALL LOG %p\n", uwsgi.shared->hook_after_request[wsgi_req->uh.modifier1]);
|
||||
uwsgi.shared->hook_after_request[wsgi_req->uh.modifier1](wsgi_req);
|
||||
|
||||
// leave harakiri mode
|
||||
@@ -412,10 +411,8 @@ int wsgi_req_recv(struct wsgi_request *wsgi_req) {
|
||||
set_harakiri(uwsgi.shared->options[UWSGI_OPTION_HARAKIRI]);
|
||||
}
|
||||
|
||||
uwsgi_log("oooops %p\n", uwsgi.shared->hook_request[wsgi_req->uh.modifier1]);
|
||||
wsgi_req->async_status = uwsgi.shared->hook_request[wsgi_req->uh.modifier1] (wsgi_req);
|
||||
|
||||
uwsgi_log("done\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -144,6 +144,7 @@ static struct option long_base_options[] = {
|
||||
{"cgroup", required_argument, 0, LONG_ARGS_CGROUP},
|
||||
{"cgroup-opt", required_argument, 0, LONG_ARGS_CGROUP_OPT},
|
||||
#endif
|
||||
{"plugins", required_argument, 0, LONG_ARGS_PLUGINS},
|
||||
{"version", no_argument, 0, LONG_ARGS_VERSION},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
@@ -459,55 +460,7 @@ int main(int argc, char *argv[], char *envp[]) {
|
||||
}
|
||||
}
|
||||
|
||||
int opt_count = count_options(long_base_options);
|
||||
uwsgi_log("count base %d\n", opt_count);
|
||||
for(i=0;i<0xFF;i++) {
|
||||
if (uwsgi.shared->hook_options[i]) {
|
||||
opt_count += count_options(uwsgi.shared->hook_options[i]);
|
||||
}
|
||||
}
|
||||
uwsgi_log("count new base %d\n", opt_count);
|
||||
|
||||
long_options = malloc( sizeof(struct option) * (opt_count+1));
|
||||
if (!long_options) {
|
||||
uwsgi_error("malloc()");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
struct option *lopt, *aopt;
|
||||
|
||||
opt_count = 0;
|
||||
lopt = long_base_options;
|
||||
while ((aopt = lopt)) {
|
||||
if (!aopt->name) break;
|
||||
long_options[opt_count].name = aopt->name;
|
||||
long_options[opt_count].has_arg = aopt->has_arg;
|
||||
long_options[opt_count].flag = aopt->flag;
|
||||
long_options[opt_count].val = aopt->val;
|
||||
opt_count++;
|
||||
lopt++;
|
||||
}
|
||||
|
||||
for(i=0;i<0xFF;i++) {
|
||||
lopt = uwsgi.shared->hook_options[i];
|
||||
if (!lopt) continue;
|
||||
|
||||
while ((aopt = lopt)) {
|
||||
if (!aopt->name) break;
|
||||
long_options[opt_count].name = aopt->name;
|
||||
long_options[opt_count].has_arg = aopt->has_arg;
|
||||
long_options[opt_count].flag = aopt->flag;
|
||||
long_options[opt_count].val = aopt->val;
|
||||
opt_count++;
|
||||
lopt++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
long_options[opt_count].name = 0;
|
||||
long_options[opt_count].has_arg = 0;
|
||||
long_options[opt_count].flag = 0;
|
||||
long_options[opt_count].val = 0;
|
||||
build_options();
|
||||
|
||||
while ((i = getopt_long(argc, argv, "s:p:t:x:d:l:O:v:b:mcaCTiMhrR:z:w:j:H:A:Q:L", long_options, &option_index)) != -1) {
|
||||
manage_opt(i, optarg);
|
||||
@@ -1233,10 +1186,6 @@ int main(int argc, char *argv[], char *envp[]) {
|
||||
|
||||
uwsgi_log(" ***\n");
|
||||
|
||||
#ifdef UWSGI_EMBED_PLUGINS
|
||||
embed_plugins();
|
||||
#endif
|
||||
|
||||
#ifdef UWSGI_ERLANG
|
||||
if (uwsgi.erlang_node) {
|
||||
uwsgi.erlang_nodes = 1;
|
||||
@@ -1576,9 +1525,19 @@ pid_t proxy_start(int has_master) {
|
||||
|
||||
static int manage_base_opt(int i, char *optarg) {
|
||||
|
||||
char *p;
|
||||
|
||||
switch (i) {
|
||||
|
||||
case LONG_ARGS_PLUGINS:
|
||||
p = strtok(optarg, ",");
|
||||
while(p != NULL) {
|
||||
uwsgi_log("loading plugin %s\n", p);
|
||||
uwsgi_load_plugin(0, p, NULL, 0);
|
||||
p = strtok(NULL, ",");
|
||||
}
|
||||
build_options();
|
||||
return 1;
|
||||
case LONG_ARGS_CHDIR:
|
||||
if (chdir(optarg)) {
|
||||
uwsgi_error("chdir()");
|
||||
@@ -2056,7 +2015,6 @@ void manage_opt(int i, char *optarg) {
|
||||
|
||||
for(j=0;j<0xFF;j++) {
|
||||
if (uwsgi.shared->hook_manage_opt[j]) {
|
||||
uwsgi_log("MANAGE_OPT\n");
|
||||
if (uwsgi.shared->hook_manage_opt[j](i, optarg)) {
|
||||
return;
|
||||
}
|
||||
@@ -2111,3 +2069,59 @@ void uwsgi_cluster_add_node(char *nodename, int workers) {
|
||||
uwsgi_log( "unable to add node %s\n", nodename);
|
||||
}
|
||||
|
||||
|
||||
void build_options() {
|
||||
|
||||
int i;
|
||||
struct option *lopt, *aopt;
|
||||
int opt_count = count_options(long_base_options);
|
||||
|
||||
for(i=0;i<0xFF;i++) {
|
||||
if (uwsgi.shared->hook_options[i]) {
|
||||
opt_count += count_options(uwsgi.shared->hook_options[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (long_options) {
|
||||
free(long_options);
|
||||
}
|
||||
|
||||
long_options = malloc( sizeof(struct option) * (opt_count+1));
|
||||
if (!long_options) {
|
||||
uwsgi_error("malloc()");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
opt_count = 0;
|
||||
lopt = long_base_options;
|
||||
while ((aopt = lopt)) {
|
||||
if (!aopt->name) break;
|
||||
long_options[opt_count].name = aopt->name;
|
||||
long_options[opt_count].has_arg = aopt->has_arg;
|
||||
long_options[opt_count].flag = aopt->flag;
|
||||
long_options[opt_count].val = aopt->val;
|
||||
opt_count++;
|
||||
lopt++;
|
||||
}
|
||||
|
||||
for(i=0;i<0xFF;i++) {
|
||||
lopt = uwsgi.shared->hook_options[i];
|
||||
if (!lopt) continue;
|
||||
|
||||
while ((aopt = lopt)) {
|
||||
if (!aopt->name) break;
|
||||
long_options[opt_count].name = aopt->name;
|
||||
long_options[opt_count].has_arg = aopt->has_arg;
|
||||
long_options[opt_count].flag = aopt->flag;
|
||||
long_options[opt_count].val = aopt->val;
|
||||
opt_count++;
|
||||
lopt++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
long_options[opt_count].name = 0;
|
||||
long_options[opt_count].has_arg = 0;
|
||||
long_options[opt_count].flag = 0;
|
||||
long_options[opt_count].val = 0;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
uwsgi.shared->hook_enable_threads[x] = up->enable_threads;\
|
||||
uwsgi.shared->hook_init_thread[x] = up->init_thread;\
|
||||
uwsgi.shared->hook_manage_udp[x] = up->manage_udp;\
|
||||
uwsgi.shared->hook_manage_xml[x] = up->manage_xml;\
|
||||
|
||||
|
||||
|
||||
@@ -211,6 +212,7 @@
|
||||
#define LONG_ARGS_THREADS 17054
|
||||
#define LONG_ARGS_LOG_SENDFILE 17055
|
||||
#define LONG_ARGS_HTTP_MODIFIER1 17056
|
||||
#define LONG_ARGS_PLUGINS 17057
|
||||
|
||||
|
||||
|
||||
@@ -416,20 +418,20 @@ struct wsgi_request {
|
||||
char *path_info;
|
||||
uint16_t path_info_len;
|
||||
|
||||
char *wsgi_script;
|
||||
uint16_t wsgi_script_len;
|
||||
char *wsgi_module;
|
||||
uint16_t wsgi_module_len;
|
||||
char *wsgi_callable;
|
||||
uint16_t wsgi_callable_len;
|
||||
char *script;
|
||||
uint16_t script_len;
|
||||
char *module;
|
||||
uint16_t module_len;
|
||||
char *callable;
|
||||
uint16_t callable_len;
|
||||
char *pyhome;
|
||||
uint16_t pyhome_len;
|
||||
|
||||
char *wsgi_file;
|
||||
uint16_t wsgi_file_len;
|
||||
char *file;
|
||||
uint16_t file_len;
|
||||
|
||||
char *wsgi_paste;
|
||||
uint16_t wsgi_paste_len;
|
||||
char *paste;
|
||||
uint16_t paste_len;
|
||||
|
||||
char *chdir;
|
||||
uint16_t chdir_len;
|
||||
@@ -779,6 +781,7 @@ struct uwsgi_shared {
|
||||
struct option *hook_options[0xFF];
|
||||
int (*hook_manage_opt[0xFF]) (int, char*);
|
||||
int (*hook_manage_udp[0xFF]) (char *, int, char*, int);
|
||||
int (*hook_manage_xml[0xFF]) (char *, char *);
|
||||
uint32_t options[256];
|
||||
|
||||
struct uwsgi_cluster_node nodes[MAX_CLUSTER_NODES];
|
||||
@@ -1088,6 +1091,7 @@ struct uwsgi_plugin {
|
||||
void (*after_request)(struct wsgi_request*);
|
||||
void (*init_apps)(void);
|
||||
int (*manage_udp)(char *, int, char *, int);
|
||||
int (*manage_xml)(char *, char *);
|
||||
|
||||
};
|
||||
|
||||
@@ -1100,3 +1104,5 @@ ssize_t uwsgi_do_sendfile(int , int , size_t , size_t , off_t *, int );
|
||||
|
||||
struct wsgi_request* simple_current_wsgi_req(void);
|
||||
struct wsgi_request* threaded_current_wsgi_req(void);
|
||||
|
||||
void build_options(void);
|
||||
|
||||
@@ -23,6 +23,7 @@ void uwsgi_xml_config(struct wsgi_request *wsgi_req, struct option *long_options
|
||||
char *colon ;
|
||||
|
||||
char *xml_id ;
|
||||
int i;
|
||||
|
||||
colon = strchr(uwsgi.xml_config, ':');
|
||||
if (colon) {
|
||||
@@ -166,86 +167,15 @@ next:
|
||||
|
||||
for (node2 = node->children; node2; node2 = node2->next) {
|
||||
if (node2->type == XML_ELEMENT_NODE) {
|
||||
if (!strcmp((char *) node2->name, "pyhome")) {
|
||||
if (!node2->children) {
|
||||
uwsgi_log( "no virtualenv defined. skip.\n");
|
||||
continue;
|
||||
//we have a mountpoint now pass every node to the xml handler of each plugin
|
||||
if (node2->children) {
|
||||
if (node2->children->content) {
|
||||
for(i=0;i<0xFF;i++) {
|
||||
if (uwsgi.shared->hook_manage_xml[i]) {
|
||||
if (uwsgi.shared->hook_manage_xml[i]( (char *)node2->name, (char *) node2->children->content)) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (node2->children->content == NULL) {
|
||||
uwsgi_log( "no virtualenv defined. skip.\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
wsgi_req->pyhome = (char *) node2->children->content;
|
||||
wsgi_req->pyhome_len = strlen((char *) node2->children->content);
|
||||
|
||||
}
|
||||
else if (!strcmp((char *) node2->name, "callable")) {
|
||||
/*
|
||||
if (!uwsgi.pyloader_dict) {
|
||||
uwsgi_log( "no module loaded in memory. skip.\n");
|
||||
continue;
|
||||
}
|
||||
*/
|
||||
if (!node2->children) {
|
||||
uwsgi_log( "no callable defined. skip.\n");
|
||||
continue;
|
||||
}
|
||||
if (node2->children->content == NULL) {
|
||||
uwsgi_log( "no callable defined. skip.\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
//init_uwsgi_app(LOADER_STRING_CALLABLE, (void *) node2->children->content, wsgi_req, uwsgi.single_interpreter-1);
|
||||
}
|
||||
else if (!strcmp((char *) node2->name, "eval")) {
|
||||
if (!node2->children) {
|
||||
uwsgi_log( "no code defined. skip.\n");
|
||||
continue;
|
||||
}
|
||||
if (node2->children->content == NULL) {
|
||||
uwsgi_log( "no code defined. skip.\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
//init_uwsgi_app(LOADER_EVAL, (void *) node2->children->content, wsgi_req, uwsgi.single_interpreter-1);
|
||||
|
||||
}
|
||||
else if (!strcmp((char *) node2->name, "file")) {
|
||||
if (!node2->children) {
|
||||
uwsgi_log( "no file defined. skip.\n");
|
||||
continue;
|
||||
}
|
||||
if (node2->children->content == NULL) {
|
||||
uwsgi_log( "no file defined. skip.\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
//init_uwsgi_app(LOADER_FILE, (void *) node2->children->content, wsgi_req, uwsgi.single_interpreter-1);
|
||||
|
||||
}
|
||||
else if (!strcmp((char *) node2->name, "module")) {
|
||||
if (!node2->children) {
|
||||
uwsgi_log( "no module defined. skip.\n");
|
||||
continue;
|
||||
}
|
||||
if (node2->children->content == NULL) {
|
||||
uwsgi_log( "no module defined. skip.\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
//init_uwsgi_app(LOADER_UWSGI, (void *) node2->children->content, wsgi_req, uwsgi.single_interpreter-1);
|
||||
}
|
||||
else if (!strcmp((char *) node2->name, "script")) {
|
||||
if (!node2->children) {
|
||||
uwsgi_log( "no script defined. skip.\n");
|
||||
continue;
|
||||
}
|
||||
if (node2->children->content == NULL) {
|
||||
uwsgi_log( "no script defined. skip.\n");
|
||||
continue;
|
||||
}
|
||||
//init_uwsgi_app(LOADER_UWSGI, (void *) node2->children->content, wsgi_req, uwsgi.single_interpreter-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user