diff --git a/async.c b/async.c index 4d8c6074..ca5b4f57 100644 --- a/async.c +++ b/async.c @@ -212,6 +212,10 @@ void *async_loop(void *arg1) { uwsgi.async_runqueue = NULL; uwsgi.async_runqueue_cnt = 0; + if (uwsgi.signal_socket > -1) { + event_queue_add_fd_read(uwsgi.async_queue, uwsgi.signal_socket); + } + // set a default request manager if (!uwsgi.schedule_to_req) uwsgi.schedule_to_req = async_schedule_to_req; diff --git a/plugins/python/python_plugin.c b/plugins/python/python_plugin.c index 135cc949..87f656a1 100644 --- a/plugins/python/python_plugin.c +++ b/plugins/python/python_plugin.c @@ -12,6 +12,7 @@ struct option uwsgi_python_options[] = { {"file", required_argument, 0, LONG_ARGS_FILE_CONFIG}, {"eval", required_argument, 0, LONG_ARGS_EVAL_CONFIG}, {"module", required_argument, 0, 'w'}, + {"wsgi", required_argument, 0, 'w'}, {"callable", required_argument, 0, LONG_ARGS_CALLABLE}, {"test", required_argument, 0, 'j'}, {"home", required_argument, 0, 'H'}, diff --git a/proto/http.c b/proto/http.c index eac2d55d..57655b78 100644 --- a/proto/http.c +++ b/proto/http.c @@ -46,7 +46,7 @@ static uint16_t http_add_uwsgi_header(struct wsgi_request *wsgi_req, char *hh, i wsgi_req->if_modified_since = val; wsgi_req->if_modified_since_len = vallen; } - else if (!uwsgi_strncmp("HOST", 4, hh, keylen) && uwsgi.vhost_host) { + else if (uwsgi.vhost_host && !uwsgi_strncmp("HOST", 4, hh, keylen)) { wsgi_req->host = val; wsgi_req->host_len = vallen; } diff --git a/uwsgi.c b/uwsgi.c index 1e515c41..5aa322dc 100644 --- a/uwsgi.c +++ b/uwsgi.c @@ -35,6 +35,9 @@ UWSGI_DECLARE_EMBEDDED_PLUGINS; static struct option long_base_options[] = { {"socket", required_argument, 0, 's'}, + {"uwsgi-socket", required_argument, 0, 's'}, + {"http-socket", required_argument, 0, LONG_ARGS_HTTP_SOCKET}, + {"fastcgi-socket", required_argument, 0, LONG_ARGS_FASTCGI_SOCKET}, {"protocol", required_argument, 0, LONG_ARGS_PROTOCOL}, {"socket-protocol", required_argument, 0, LONG_ARGS_SOCKET_PROTOCOL}, {"shared-socket", required_argument, 0, LONG_ARGS_SHARED_SOCKET}, @@ -1848,7 +1851,12 @@ skipzero: exit(1); } - if (uwsgi.protocol && !strcmp("http", uwsgi.protocol)) { + char *requested_protocol = uwsgi_sock->proto_name; + if (!requested_protocol) { + requested_protocol = uwsgi.protocol; + } + + if (requested_protocol && !strcmp("http", requested_protocol)) { uwsgi_sock->proto = uwsgi_proto_http_parser; uwsgi_sock->proto_accept = uwsgi_proto_base_accept; uwsgi_sock->proto_write = uwsgi_proto_http_write; @@ -1858,7 +1866,7 @@ skipzero: uwsgi_sock->proto_sendfile = NULL; uwsgi_sock->proto_close = uwsgi_proto_base_close; } - else if (uwsgi.protocol && (!strcmp("fastcgi", uwsgi.protocol) || !strcmp("fcgi", uwsgi.protocol))) { + else if (requested_protocol && (!strcmp("fastcgi", requested_protocol) || !strcmp("fcgi", requested_protocol))) { uwsgi.shared->options[UWSGI_OPTION_CGI_MODE] = 1; uwsgi_sock->proto = uwsgi_proto_fastcgi_parser; uwsgi_sock->proto_accept = uwsgi_proto_base_accept; @@ -2394,7 +2402,6 @@ skipzero: uwsgi.async_queue_unused_ptr = uwsgi.async - 1; - event_queue_add_fd_read(uwsgi.async_queue, uwsgi.signal_socket); } #endif @@ -2564,6 +2571,7 @@ static int manage_base_opt(int i, char *optarg) { struct uwsgi_static_map *usm, *old_usm; struct uwsgi_config_template *uct, *old_uct; struct uwsgi_cron *uc, *old_uc; + struct uwsgi_socket *uwsgi_sock = NULL; int zerg_fd; switch (i) { @@ -3109,7 +3117,16 @@ static int manage_base_opt(int i, char *optarg) { } return 1; case 's': - uwsgi_new_socket(generate_socket_name(optarg)); + uwsgi_sock = uwsgi_new_socket(generate_socket_name(optarg)); + uwsgi_sock->proto_name = "uwsgi"; + return 1; + case LONG_ARGS_HTTP_SOCKET: + uwsgi_sock = uwsgi_new_socket(generate_socket_name(optarg)); + uwsgi_sock->proto_name = "http"; + return 1; + case LONG_ARGS_FASTCGI_SOCKET: + uwsgi_sock = uwsgi_new_socket(generate_socket_name(optarg)); + uwsgi_sock->proto_name = "fastcgi"; return 1; case LONG_ARGS_ZERG: zerg_fd = uwsgi_connect(optarg, 30, 0); diff --git a/uwsgi.h b/uwsgi.h index c6cb9959..3d9d60b2 100644 --- a/uwsgi.h +++ b/uwsgi.h @@ -467,6 +467,8 @@ struct uwsgi_opt { #define LONG_ARGS_CACHE_SERVER 17129 #define LONG_ARGS_CACHE_SERVER_THREADS 17130 #define LONG_ARGS_CHOWN_SOCKET 17131 +#define LONG_ARGS_HTTP_SOCKET 17132 +#define LONG_ARGS_FASTCGI_SOCKET 17133 #define UWSGI_OK 0