summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUnbit <info@unbit.it>2018-03-02 09:18:46 +0100
committerUnbit <info@unbit.it>2018-03-02 09:18:46 +0100
commit7e2cc2ef07a16662092f12a4c3aa40ba2c038b70 (patch)
tree01af2ece90f66f5f12446e57deff08cd237109bd
parentcd19c480691a2a7c4d1f42d76f2b6563e25fc595 (diff)
downloaduwsgi-3.0.tar.gz
added --dynamic-appsuwsgi-3.0
-rw-r--r--core/init.c2
-rw-r--r--core/protocol.c10
-rwxr-xr-xcore/uwsgi.c1
-rwxr-xr-xuwsgi.h2
4 files changed, 10 insertions, 5 deletions
diff --git a/core/init.c b/core/init.c
index b0660c8f..0c3178a3 100644
--- a/core/init.c
+++ b/core/init.c
@@ -95,6 +95,8 @@ void uwsgi_init_default() {
uwsgi.cores = 1;
uwsgi.threads = 1;
+ uwsgi.need_app = 1;
+
// default max number of rpc slot
uwsgi.rpc_max = 64;
diff --git a/core/protocol.c b/core/protocol.c
index f0743c94..e3941569 100644
--- a/core/protocol.c
+++ b/core/protocol.c
@@ -291,14 +291,14 @@ static int uwsgi_proto_check_10(struct wsgi_request *wsgi_req, char *key, char *
return 0;
}
- if (!uwsgi_proto_key("UWSGI_FILE", 10)) {
+ if (uwsgi.dynamic_apps && !uwsgi_proto_key("UWSGI_FILE", 10)) {
wsgi_req->file = buf;
wsgi_req->file_len = len;
wsgi_req->dynamic = 1;
return 0;
}
- if (!uwsgi_proto_key("UWSGI_HOME", 10)) {
+ if (uwsgi.dynamic_apps && !uwsgi_proto_key("UWSGI_HOME", 10)) {
wsgi_req->home = buf;
wsgi_req->home_len = len;
return 0;
@@ -399,14 +399,14 @@ static int uwsgi_proto_check_12(struct wsgi_request *wsgi_req, char *key, char *
return 0;
}
- if (!uwsgi_proto_key("UWSGI_SCRIPT", 12)) {
+ if (uwsgi.dynamic_apps && !uwsgi_proto_key("UWSGI_SCRIPT", 12)) {
wsgi_req->script = buf;
wsgi_req->script_len = len;
wsgi_req->dynamic = 1;
return 0;
}
- if (!uwsgi_proto_key("UWSGI_MODULE", 12)) {
+ if (uwsgi.dynamic_apps && !uwsgi_proto_key("UWSGI_MODULE", 12)) {
wsgi_req->module = buf;
wsgi_req->module_len = len;
wsgi_req->dynamic = 1;
@@ -471,7 +471,7 @@ static int uwsgi_proto_check_14(struct wsgi_request *wsgi_req, char *key, char *
return 0;
}
- if (!uwsgi_proto_key("UWSGI_CALLABLE", 14)) {
+ if (uwsgi.dynamic_apps && !uwsgi_proto_key("UWSGI_CALLABLE", 14)) {
wsgi_req->callable = buf;
wsgi_req->callable_len = len;
wsgi_req->dynamic = 1;
diff --git a/core/uwsgi.c b/core/uwsgi.c
index e2d7750a..e9a6f09f 100755
--- a/core/uwsgi.c
+++ b/core/uwsgi.c
@@ -210,6 +210,7 @@ static struct uwsgi_option uwsgi_base_options[] = {
{"single-interpreter", no_argument, 'i', "do not use multiple interpreters (where available)", uwsgi_opt_true, &uwsgi.single_interpreter, 0},
{"need-app", no_argument, 0, "exit if no app can be loaded", uwsgi_opt_true, &uwsgi.need_app, 0},
+ {"dynamic-apps", no_argument, 0, "allows apps to be dynamically loaded via uwsgi protocol", uwsgi_opt_true, &uwsgi.dynamic_apps, 0},
{"master", no_argument, 'M', "enable master process", uwsgi_opt_true, &uwsgi.master_process, 0},
{"honour-stdin", no_argument, 0, "do not remap stdin to /dev/null", uwsgi_opt_true, &uwsgi.honour_stdin, 0},
{"emperor", required_argument, 0, "run the Emperor", uwsgi_opt_add_string_list, &uwsgi.emperor, 0},
diff --git a/uwsgi.h b/uwsgi.h
index dbfb278e..c371a042 100755
--- a/uwsgi.h
+++ b/uwsgi.h
@@ -2910,6 +2910,8 @@ struct uwsgi_server {
size_t argv_len;
size_t environ_len;
+
+ int dynamic_apps;
};
struct uwsgi_rpc {