Skip to content

Commit

Permalink
added --dynamic-apps
Browse files Browse the repository at this point in the history
  • Loading branch information
unbit committed Mar 2, 2018
1 parent cd19c48 commit f2e0142
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
2 changes: 2 additions & 0 deletions core/init.c
Expand Up @@ -95,6 +95,8 @@ void uwsgi_init_default() {
uwsgi.cores = 1;
uwsgi.threads = 1;

uwsgi.need_app = 1;

This comment has been minimized.

Copy link
@funkybob

funkybob Apr 29, 2018

Contributor

In this patch you've forced need_app to default to 1, but the only option for setting it sets it to 1.

core/uwsgi.c:	{"need-app", no_argument, 0, "exit if no app can be loaded", uwsgi_opt_true, &uwsgi.need_app, 0},

Should this option be inverted to allow clearing this option?


// default max number of rpc slot
uwsgi.rpc_max = 64;

Expand Down
10 changes: 5 additions & 5 deletions core/protocol.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions core/uwsgi.c
Expand Up @@ -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},
Expand Down
2 changes: 2 additions & 0 deletions uwsgi.h
Expand Up @@ -2910,6 +2910,8 @@ struct uwsgi_server {

size_t argv_len;
size_t environ_len;

int dynamic_apps;
};

struct uwsgi_rpc {
Expand Down

0 comments on commit f2e0142

Please sign in to comment.