mirror of
https://github.com/php/php-src.git
synced 2026-04-27 18:23:26 +02:00
- ws and cosmetics
This commit is contained in:
@@ -194,7 +194,7 @@ int fcgi_init(void)
|
||||
socklen_t len = sizeof(sa);
|
||||
#endif
|
||||
zend_hash_init(&fcgi_mgmt_vars, 0, NULL, fcgi_free_mgmt_var_cb, 1);
|
||||
fcgi_set_mgmt_var("FCGI_MPXS_CONNS", sizeof("FCGI_MPXS_CONNS")-1, "0", sizeof("0")-1);
|
||||
fcgi_set_mgmt_var("FCGI_MPXS_CONNS", sizeof("FCGI_MPXS_CONNS") - 1, "0", sizeof("0")-1);
|
||||
|
||||
is_initialized = 1;
|
||||
#ifdef _WIN32
|
||||
|
||||
+27
-27
@@ -24,20 +24,20 @@
|
||||
#include "zlog.h"
|
||||
|
||||
struct fpm_globals_s fpm_globals = {
|
||||
.parent_pid = 0,
|
||||
.argc = 0,
|
||||
.argv = NULL,
|
||||
.config = NULL,
|
||||
.prefix = NULL,
|
||||
.pid = NULL,
|
||||
.running_children = 0,
|
||||
.error_log_fd = 0,
|
||||
.log_level = 0,
|
||||
.listening_socket = 0,
|
||||
.max_requests = 0,
|
||||
.is_child = 0,
|
||||
.test_successful = 0
|
||||
};
|
||||
.parent_pid = 0,
|
||||
.argc = 0,
|
||||
.argv = NULL,
|
||||
.config = NULL,
|
||||
.prefix = NULL,
|
||||
.pid = NULL,
|
||||
.running_children = 0,
|
||||
.error_log_fd = 0,
|
||||
.log_level = 0,
|
||||
.listening_socket = 0,
|
||||
.max_requests = 0,
|
||||
.is_child = 0,
|
||||
.test_successful = 0
|
||||
};
|
||||
|
||||
int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf) /* {{{ */
|
||||
{
|
||||
@@ -49,19 +49,19 @@ int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int t
|
||||
fpm_globals.prefix = prefix;
|
||||
fpm_globals.pid = pid;
|
||||
|
||||
if (0 > fpm_php_init_main() ||
|
||||
0 > fpm_stdio_init_main() ||
|
||||
0 > fpm_conf_init_main(test_conf) ||
|
||||
0 > fpm_unix_init_main() ||
|
||||
0 > fpm_scoreboard_init_main() ||
|
||||
0 > fpm_pctl_init_main() ||
|
||||
0 > fpm_env_init_main() ||
|
||||
0 > fpm_signals_init_main() ||
|
||||
0 > fpm_children_init_main() ||
|
||||
0 > fpm_sockets_init_main() ||
|
||||
0 > fpm_worker_pool_init_main() ||
|
||||
0 > fpm_event_init_main()) {
|
||||
|
||||
if (0 > fpm_php_init_main() ||
|
||||
0 > fpm_stdio_init_main() ||
|
||||
0 > fpm_conf_init_main(test_conf) ||
|
||||
0 > fpm_unix_init_main() ||
|
||||
0 > fpm_scoreboard_init_main() ||
|
||||
0 > fpm_pctl_init_main() ||
|
||||
0 > fpm_env_init_main() ||
|
||||
0 > fpm_signals_init_main() ||
|
||||
0 > fpm_children_init_main() ||
|
||||
0 > fpm_sockets_init_main() ||
|
||||
0 > fpm_worker_pool_init_main() ||
|
||||
0 > fpm_event_init_main()) {
|
||||
|
||||
if (fpm_globals.test_successful) {
|
||||
exit(0);
|
||||
} else {
|
||||
|
||||
+80
-80
@@ -67,47 +67,47 @@ static int ini_lineno = 0;
|
||||
static char *ini_include = NULL;
|
||||
|
||||
static struct ini_value_parser_s ini_fpm_global_options[] = {
|
||||
{ "emergency_restart_threshold", &fpm_conf_set_integer, GO(emergency_restart_threshold) },
|
||||
{ "emergency_restart_interval", &fpm_conf_set_time, GO(emergency_restart_interval) },
|
||||
{ "process_control_timeout", &fpm_conf_set_time, GO(process_control_timeout) },
|
||||
{ "daemonize", &fpm_conf_set_boolean, GO(daemonize) },
|
||||
{ "pid", &fpm_conf_set_string, GO(pid_file) },
|
||||
{ "error_log", &fpm_conf_set_string, GO(error_log) },
|
||||
{ "log_level", &fpm_conf_set_log_level, 0 },
|
||||
{ "rlimit_files", &fpm_conf_set_integer, GO(rlimit_files) },
|
||||
{ "rlimit_core", &fpm_conf_set_rlimit_core,GO(rlimit_core) },
|
||||
{ "emergency_restart_threshold", &fpm_conf_set_integer, GO(emergency_restart_threshold) },
|
||||
{ "emergency_restart_interval", &fpm_conf_set_time, GO(emergency_restart_interval) },
|
||||
{ "process_control_timeout", &fpm_conf_set_time, GO(process_control_timeout) },
|
||||
{ "daemonize", &fpm_conf_set_boolean, GO(daemonize) },
|
||||
{ "pid", &fpm_conf_set_string, GO(pid_file) },
|
||||
{ "error_log", &fpm_conf_set_string, GO(error_log) },
|
||||
{ "log_level", &fpm_conf_set_log_level, 0 },
|
||||
{ "rlimit_files", &fpm_conf_set_integer, GO(rlimit_files) },
|
||||
{ "rlimit_core", &fpm_conf_set_rlimit_core, GO(rlimit_core) },
|
||||
{ 0, 0, 0 }
|
||||
};
|
||||
|
||||
static struct ini_value_parser_s ini_fpm_pool_options[] = {
|
||||
{ "prefix", &fpm_conf_set_string, WPO(prefix) },
|
||||
{ "user", &fpm_conf_set_string, WPO(user) },
|
||||
{ "group", &fpm_conf_set_string, WPO(group) },
|
||||
{ "chroot", &fpm_conf_set_string, WPO(chroot) },
|
||||
{ "chdir", &fpm_conf_set_string, WPO(chdir) },
|
||||
{ "request_terminate_timeout", &fpm_conf_set_time, WPO(request_terminate_timeout) },
|
||||
{ "request_slowlog_timeout", &fpm_conf_set_time, WPO(request_slowlog_timeout) },
|
||||
{ "slowlog", &fpm_conf_set_string, WPO(slowlog) },
|
||||
{ "rlimit_files", &fpm_conf_set_integer, WPO(rlimit_files) },
|
||||
{ "rlimit_core", &fpm_conf_set_rlimit_core, WPO(rlimit_core) },
|
||||
{ "catch_workers_output", &fpm_conf_set_boolean, WPO(catch_workers_output) },
|
||||
{ "listen", &fpm_conf_set_string, WPO(listen_address) },
|
||||
{ "listen.owner", &fpm_conf_set_string, WPO(listen_owner) },
|
||||
{ "listen.group", &fpm_conf_set_string, WPO(listen_group) },
|
||||
{ "listen.mode", &fpm_conf_set_string, WPO(listen_mode) },
|
||||
{ "listen.backlog", &fpm_conf_set_integer, WPO(listen_backlog) },
|
||||
{ "listen.allowed_clients", &fpm_conf_set_string, WPO(listen_allowed_clients) },
|
||||
{ "pm", &fpm_conf_set_pm, WPO(pm) },
|
||||
{ "pm.max_requests", &fpm_conf_set_integer, WPO(pm_max_requests) },
|
||||
{ "pm.max_children", &fpm_conf_set_integer, WPO(pm_max_children) },
|
||||
{ "pm.start_servers", &fpm_conf_set_integer, WPO(pm_start_servers) },
|
||||
{ "pm.min_spare_servers", &fpm_conf_set_integer, WPO(pm_min_spare_servers) },
|
||||
{ "pm.max_spare_servers", &fpm_conf_set_integer, WPO(pm_max_spare_servers) },
|
||||
{ "pm.status_path", &fpm_conf_set_string, WPO(pm_status_path) },
|
||||
{ "ping.path", &fpm_conf_set_string, WPO(ping_path) },
|
||||
{ "ping.response", &fpm_conf_set_string, WPO(ping_response) },
|
||||
{ "access.log", &fpm_conf_set_string, WPO(access_log) },
|
||||
{ "access.format", &fpm_conf_set_string, WPO(access_format) },
|
||||
{ "prefix", &fpm_conf_set_string, WPO(prefix) },
|
||||
{ "user", &fpm_conf_set_string, WPO(user) },
|
||||
{ "group", &fpm_conf_set_string, WPO(group) },
|
||||
{ "chroot", &fpm_conf_set_string, WPO(chroot) },
|
||||
{ "chdir", &fpm_conf_set_string, WPO(chdir) },
|
||||
{ "request_terminate_timeout", &fpm_conf_set_time, WPO(request_terminate_timeout) },
|
||||
{ "request_slowlog_timeout", &fpm_conf_set_time, WPO(request_slowlog_timeout) },
|
||||
{ "slowlog", &fpm_conf_set_string, WPO(slowlog) },
|
||||
{ "rlimit_files", &fpm_conf_set_integer, WPO(rlimit_files) },
|
||||
{ "rlimit_core", &fpm_conf_set_rlimit_core, WPO(rlimit_core) },
|
||||
{ "catch_workers_output", &fpm_conf_set_boolean, WPO(catch_workers_output) },
|
||||
{ "listen", &fpm_conf_set_string, WPO(listen_address) },
|
||||
{ "listen.owner", &fpm_conf_set_string, WPO(listen_owner) },
|
||||
{ "listen.group", &fpm_conf_set_string, WPO(listen_group) },
|
||||
{ "listen.mode", &fpm_conf_set_string, WPO(listen_mode) },
|
||||
{ "listen.backlog", &fpm_conf_set_integer, WPO(listen_backlog) },
|
||||
{ "listen.allowed_clients", &fpm_conf_set_string, WPO(listen_allowed_clients) },
|
||||
{ "pm", &fpm_conf_set_pm, WPO(pm) },
|
||||
{ "pm.max_requests", &fpm_conf_set_integer, WPO(pm_max_requests) },
|
||||
{ "pm.max_children", &fpm_conf_set_integer, WPO(pm_max_children) },
|
||||
{ "pm.start_servers", &fpm_conf_set_integer, WPO(pm_start_servers) },
|
||||
{ "pm.min_spare_servers", &fpm_conf_set_integer, WPO(pm_min_spare_servers) },
|
||||
{ "pm.max_spare_servers", &fpm_conf_set_integer, WPO(pm_max_spare_servers) },
|
||||
{ "pm.status_path", &fpm_conf_set_string, WPO(pm_status_path) },
|
||||
{ "ping.path", &fpm_conf_set_string, WPO(ping_path) },
|
||||
{ "ping.response", &fpm_conf_set_string, WPO(ping_response) },
|
||||
{ "access.log", &fpm_conf_set_string, WPO(access_log) },
|
||||
{ "access.format", &fpm_conf_set_string, WPO(access_format) },
|
||||
{ 0, 0, 0 }
|
||||
};
|
||||
|
||||
@@ -198,7 +198,7 @@ static char *fpm_conf_set_integer(zval *value, void **config, intptr_t offset) /
|
||||
char *val = Z_STRVAL_P(value);
|
||||
char *p;
|
||||
|
||||
for(p=val; *p; p++) {
|
||||
for (p = val; *p; p++) {
|
||||
if ( p == val && *p == '-' ) continue;
|
||||
if (*p < '0' || *p > '9') {
|
||||
return "is not a valid number (greater or equal than zero)";
|
||||
@@ -627,7 +627,7 @@ static int fpm_conf_process_all_pools() /* {{{ */
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i=0; i<strlen(ping); i++) {
|
||||
for (i = 0; i < strlen(ping); i++) {
|
||||
if (!isalnum(ping[i]) && ping[i] != '/' && ping[i] != '-' && ping[i] != '_' && ping[i] != '.') {
|
||||
zlog(ZLOG_ERROR, "[pool %s] the ping path '%s' must containt only the following characters '[alphanum]/_-.'", wp->config->name, ping);
|
||||
return -1;
|
||||
@@ -664,7 +664,7 @@ static int fpm_conf_process_all_pools() /* {{{ */
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i=0; i<strlen(status); i++) {
|
||||
for (i = 0; i < strlen(status); i++) {
|
||||
if (!isalnum(status[i]) && status[i] != '/' && status[i] != '-' && status[i] != '_' && status[i] != '.') {
|
||||
zlog(ZLOG_ERROR, "[pool %s] the status path '%s' must contain only the following characters '[alphanum]/_-.'", wp->config->name, status);
|
||||
return -1;
|
||||
@@ -727,14 +727,14 @@ static int fpm_conf_process_all_pools() /* {{{ */
|
||||
char **p;
|
||||
|
||||
for (kv = wp->config->php_values; kv; kv = kv->next) {
|
||||
for (p=options; *p; p++) {
|
||||
for (p = options; *p; p++) {
|
||||
if (!strcasecmp(kv->key, *p)) {
|
||||
fpm_evaluate_full_path(&kv->value, wp, NULL, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (kv = wp->config->php_admin_values; kv; kv = kv->next) {
|
||||
for (p=options; *p; p++) {
|
||||
for (p = options; *p; p++) {
|
||||
if (!strcasecmp(kv->key, *p)) {
|
||||
fpm_evaluate_full_path(&kv->value, wp, NULL, 0);
|
||||
}
|
||||
@@ -864,7 +864,7 @@ static void fpm_conf_ini_parser_include(char *inc, void *arg TSRMLS_DC) /* {{{ *
|
||||
return;
|
||||
}
|
||||
|
||||
for(i=0; i<g.gl_pathc; i++) {
|
||||
for (i = 0; i < g.gl_pathc; i++) {
|
||||
int len = strlen(g.gl_pathv[i]);
|
||||
if (len < 1) continue;
|
||||
if (g.gl_pathv[i][len - 1] == '/') continue; /* don't parse directories */
|
||||
@@ -958,7 +958,7 @@ static void fpm_conf_ini_parser_entry(zval *name, zval *value, void *arg TSRMLS_
|
||||
config = current_wp->config;
|
||||
}
|
||||
|
||||
for (;parser->name; parser++) {
|
||||
for (; parser->name; parser++) {
|
||||
if (!strcasecmp(parser->name, Z_STRVAL_P(name))) {
|
||||
char *ret;
|
||||
if (!parser->parser) {
|
||||
@@ -1107,7 +1107,7 @@ int fpm_conf_load_ini_file(char *filename TSRMLS_DC) /* {{{ */
|
||||
while (nb_read > 0) {
|
||||
int tmp;
|
||||
memset(buf, 0, sizeof(char) * (1024 + 1));
|
||||
for (n=0; n<1024 && (nb_read = read(fd, &c, sizeof(char))) == sizeof(char) && c != '\n'; n++) {
|
||||
for (n = 0; n < 1024 && (nb_read = read(fd, &c, sizeof(char))) == sizeof(char) && c != '\n'; n++) {
|
||||
buf[n] = c;
|
||||
}
|
||||
buf[n++] = '\n';
|
||||
@@ -1148,49 +1148,49 @@ static void fpm_conf_dump() /* {{{ */
|
||||
struct fpm_worker_pool_s *wp;
|
||||
|
||||
zlog(ZLOG_NOTICE, "[General]");
|
||||
zlog(ZLOG_NOTICE, "\tpid = %s", STR2STR(fpm_global_config.pid_file));
|
||||
zlog(ZLOG_NOTICE, "\tdaemonize = %s", BOOL2STR(fpm_global_config.daemonize));
|
||||
zlog(ZLOG_NOTICE, "\terror_log = %s", STR2STR(fpm_global_config.error_log));
|
||||
zlog(ZLOG_NOTICE, "\tlog_level = %s", zlog_get_level_name());
|
||||
zlog(ZLOG_NOTICE, "\tprocess_control_timeout = %ds", fpm_global_config.process_control_timeout);
|
||||
zlog(ZLOG_NOTICE, "\tpid = %s", STR2STR(fpm_global_config.pid_file));
|
||||
zlog(ZLOG_NOTICE, "\tdaemonize = %s", BOOL2STR(fpm_global_config.daemonize));
|
||||
zlog(ZLOG_NOTICE, "\terror_log = %s", STR2STR(fpm_global_config.error_log));
|
||||
zlog(ZLOG_NOTICE, "\tlog_level = %s", zlog_get_level_name());
|
||||
zlog(ZLOG_NOTICE, "\tprocess_control_timeout = %ds", fpm_global_config.process_control_timeout);
|
||||
zlog(ZLOG_NOTICE, "\temergency_restart_interval = %ds", fpm_global_config.emergency_restart_interval);
|
||||
zlog(ZLOG_NOTICE, "\temergency_restart_threshold = %d", fpm_global_config.emergency_restart_threshold);
|
||||
zlog(ZLOG_NOTICE, "\trlimit_files = %d", fpm_global_config.rlimit_files);
|
||||
zlog(ZLOG_NOTICE, "\trlimit_core = %d", fpm_global_config.rlimit_core);
|
||||
zlog(ZLOG_NOTICE, "\trlimit_files = %d", fpm_global_config.rlimit_files);
|
||||
zlog(ZLOG_NOTICE, "\trlimit_core = %d", fpm_global_config.rlimit_core);
|
||||
zlog(ZLOG_NOTICE, " ");
|
||||
|
||||
for (wp = fpm_worker_all_pools; wp; wp = wp->next) {
|
||||
struct key_value_s *kv;
|
||||
if (!wp->config) continue;
|
||||
zlog(ZLOG_NOTICE, "[%s]", STR2STR(wp->config->name));
|
||||
zlog(ZLOG_NOTICE, "\tprefix = %s", STR2STR(wp->config->prefix));
|
||||
zlog(ZLOG_NOTICE, "\tuser = %s", STR2STR(wp->config->user));
|
||||
zlog(ZLOG_NOTICE, "\tgroup = %s", STR2STR(wp->config->group));
|
||||
zlog(ZLOG_NOTICE, "\tchroot = %s", STR2STR(wp->config->chroot));
|
||||
zlog(ZLOG_NOTICE, "\tchdir = %s", STR2STR(wp->config->chdir));
|
||||
zlog(ZLOG_NOTICE, "\tlisten = %s", STR2STR(wp->config->listen_address));
|
||||
zlog(ZLOG_NOTICE, "\tlisten.backlog = %d", wp->config->listen_backlog);
|
||||
zlog(ZLOG_NOTICE, "\tlisten.owner = %s", STR2STR(wp->config->listen_owner));
|
||||
zlog(ZLOG_NOTICE, "\tlisten.group = %s", STR2STR(wp->config->listen_group));
|
||||
zlog(ZLOG_NOTICE, "\tlisten.mode = %s", STR2STR(wp->config->listen_mode));
|
||||
zlog(ZLOG_NOTICE, "\tlisten.allowed_clients = %s", STR2STR(wp->config->listen_allowed_clients));
|
||||
zlog(ZLOG_NOTICE, "\tpm = %s", PM2STR(wp->config->pm));
|
||||
zlog(ZLOG_NOTICE, "\tpm.max_children = %d", wp->config->pm_max_children);
|
||||
zlog(ZLOG_NOTICE, "\tpm.max_requests = %d", wp->config->pm_max_requests);
|
||||
zlog(ZLOG_NOTICE, "\tpm.start_servers = %d", wp->config->pm_start_servers);
|
||||
zlog(ZLOG_NOTICE, "\tpm.min_spare_servers = %d", wp->config->pm_min_spare_servers);
|
||||
zlog(ZLOG_NOTICE, "\tpm.max_spare_servers = %d", wp->config->pm_max_spare_servers);
|
||||
zlog(ZLOG_NOTICE, "\tpm.status_path = %s", STR2STR(wp->config->pm_status_path));
|
||||
zlog(ZLOG_NOTICE, "\tping.path = %s", STR2STR(wp->config->ping_path));
|
||||
zlog(ZLOG_NOTICE, "\tping.response = %s", STR2STR(wp->config->ping_response));
|
||||
zlog(ZLOG_NOTICE, "\taccess.log = %s", STR2STR(wp->config->access_log));
|
||||
zlog(ZLOG_NOTICE, "\taccess.format = %s", STR2STR(wp->config->access_format));
|
||||
zlog(ZLOG_NOTICE, "\tcatch_workers_output = %s", BOOL2STR(wp->config->catch_workers_output));
|
||||
zlog(ZLOG_NOTICE, "[%s]", STR2STR(wp->config->name));
|
||||
zlog(ZLOG_NOTICE, "\tprefix = %s", STR2STR(wp->config->prefix));
|
||||
zlog(ZLOG_NOTICE, "\tuser = %s", STR2STR(wp->config->user));
|
||||
zlog(ZLOG_NOTICE, "\tgroup = %s", STR2STR(wp->config->group));
|
||||
zlog(ZLOG_NOTICE, "\tchroot = %s", STR2STR(wp->config->chroot));
|
||||
zlog(ZLOG_NOTICE, "\tchdir = %s", STR2STR(wp->config->chdir));
|
||||
zlog(ZLOG_NOTICE, "\tlisten = %s", STR2STR(wp->config->listen_address));
|
||||
zlog(ZLOG_NOTICE, "\tlisten.backlog = %d", wp->config->listen_backlog);
|
||||
zlog(ZLOG_NOTICE, "\tlisten.owner = %s", STR2STR(wp->config->listen_owner));
|
||||
zlog(ZLOG_NOTICE, "\tlisten.group = %s", STR2STR(wp->config->listen_group));
|
||||
zlog(ZLOG_NOTICE, "\tlisten.mode = %s", STR2STR(wp->config->listen_mode));
|
||||
zlog(ZLOG_NOTICE, "\tlisten.allowed_clients = %s", STR2STR(wp->config->listen_allowed_clients));
|
||||
zlog(ZLOG_NOTICE, "\tpm = %s", PM2STR(wp->config->pm));
|
||||
zlog(ZLOG_NOTICE, "\tpm.max_children = %d", wp->config->pm_max_children);
|
||||
zlog(ZLOG_NOTICE, "\tpm.max_requests = %d", wp->config->pm_max_requests);
|
||||
zlog(ZLOG_NOTICE, "\tpm.start_servers = %d", wp->config->pm_start_servers);
|
||||
zlog(ZLOG_NOTICE, "\tpm.min_spare_servers = %d", wp->config->pm_min_spare_servers);
|
||||
zlog(ZLOG_NOTICE, "\tpm.max_spare_servers = %d", wp->config->pm_max_spare_servers);
|
||||
zlog(ZLOG_NOTICE, "\tpm.status_path = %s", STR2STR(wp->config->pm_status_path));
|
||||
zlog(ZLOG_NOTICE, "\tping.path = %s", STR2STR(wp->config->ping_path));
|
||||
zlog(ZLOG_NOTICE, "\tping.response = %s", STR2STR(wp->config->ping_response));
|
||||
zlog(ZLOG_NOTICE, "\taccess.log = %s", STR2STR(wp->config->access_log));
|
||||
zlog(ZLOG_NOTICE, "\taccess.format = %s", STR2STR(wp->config->access_format));
|
||||
zlog(ZLOG_NOTICE, "\tcatch_workers_output = %s", BOOL2STR(wp->config->catch_workers_output));
|
||||
zlog(ZLOG_NOTICE, "\trequest_terminate_timeout = %ds", wp->config->request_terminate_timeout);
|
||||
zlog(ZLOG_NOTICE, "\trequest_slowlog_timeout = %ds", wp->config->request_slowlog_timeout);
|
||||
zlog(ZLOG_NOTICE, "\tslowlog = %s", STR2STR(wp->config->slowlog));
|
||||
zlog(ZLOG_NOTICE, "\trlimit_files = %d", wp->config->rlimit_files);
|
||||
zlog(ZLOG_NOTICE, "\trlimit_core = %d", wp->config->rlimit_core);
|
||||
zlog(ZLOG_NOTICE, "\trequest_slowlog_timeout = %ds", wp->config->request_slowlog_timeout);
|
||||
zlog(ZLOG_NOTICE, "\tslowlog = %s", STR2STR(wp->config->slowlog));
|
||||
zlog(ZLOG_NOTICE, "\trlimit_files = %d", wp->config->rlimit_files);
|
||||
zlog(ZLOG_NOTICE, "\trlimit_core = %d", wp->config->rlimit_core);
|
||||
|
||||
for (kv = wp->config->env; kv; kv = kv->next) {
|
||||
zlog(ZLOG_NOTICE, "\tenv[%s] = %s", kv->key, kv->value);
|
||||
|
||||
@@ -72,7 +72,10 @@ struct ini_value_parser_s {
|
||||
intptr_t offset;
|
||||
};
|
||||
|
||||
enum { PM_STYLE_STATIC = 1, PM_STYLE_DYNAMIC = 2 };
|
||||
enum {
|
||||
PM_STYLE_STATIC = 1,
|
||||
PM_STYLE_DYNAMIC = 2
|
||||
};
|
||||
|
||||
int fpm_conf_init_main(int test_conf);
|
||||
int fpm_worker_pool_config_free(struct fpm_worker_pool_config_s *wpc);
|
||||
|
||||
@@ -141,7 +141,7 @@ int fpm_env_init_child(struct fpm_worker_pool_s *wp) /* {{{ */
|
||||
struct key_value_s *kv;
|
||||
char *title;
|
||||
spprintf(&title, 0, "pool %s", wp->config->name);
|
||||
fpm_env_setproctitle(title);
|
||||
fpm_env_setproctitle(title);
|
||||
efree(title);
|
||||
|
||||
clearenv();
|
||||
|
||||
+25
-24
@@ -422,8 +422,8 @@ static int sapi_cgi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
|
||||
} else {
|
||||
h = (sapi_header_struct*)zend_llist_get_first_ex(&sapi_headers->headers, &pos);
|
||||
while (h) {
|
||||
if (h->header_len > sizeof("Status:")-1 &&
|
||||
strncasecmp(h->header, "Status:", sizeof("Status:")-1) == 0
|
||||
if (h->header_len > sizeof("Status:") - 1 &&
|
||||
strncasecmp(h->header, "Status:", sizeof("Status:") - 1) == 0
|
||||
) {
|
||||
has_status = 1;
|
||||
break;
|
||||
@@ -458,16 +458,16 @@ static int sapi_cgi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
|
||||
while (h) {
|
||||
/* prevent CRLFCRLF */
|
||||
if (h->header_len) {
|
||||
if (h->header_len > sizeof("Status:")-1 &&
|
||||
strncasecmp(h->header, "Status:", sizeof("Status:")-1) == 0
|
||||
if (h->header_len > sizeof("Status:") - 1 &&
|
||||
strncasecmp(h->header, "Status:", sizeof("Status:") - 1) == 0
|
||||
) {
|
||||
if (!ignore_status) {
|
||||
ignore_status = 1;
|
||||
PHPWRITE_H(h->header, h->header_len);
|
||||
PHPWRITE_H("\r\n", 2);
|
||||
}
|
||||
} else if (response_status == 304 && h->header_len > sizeof("Content-Type:")-1 &&
|
||||
strncasecmp(h->header, "Content-Type:", sizeof("Content-Type:")-1) == 0
|
||||
} else if (response_status == 304 && h->header_len > sizeof("Content-Type:") - 1 &&
|
||||
strncasecmp(h->header, "Content-Type:", sizeof("Content-Type:") - 1) == 0
|
||||
) {
|
||||
h = (sapi_header_struct*)zend_llist_get_next_ex(&sapi_headers->headers, &pos);
|
||||
continue;
|
||||
@@ -498,7 +498,7 @@ static int sapi_cgi_read_post(char *buffer, uint count_bytes TSRMLS_DC)
|
||||
fcgi_request *request = (fcgi_request*) SG(server_context);
|
||||
if (request_body_fd == -1) {
|
||||
char *request_body_filename = sapi_cgibin_getenv((char *) "REQUEST_BODY_FILE",
|
||||
sizeof("REQUEST_BODY_FILE")-1 TSRMLS_CC);
|
||||
sizeof("REQUEST_BODY_FILE") - 1 TSRMLS_CC);
|
||||
|
||||
if (request_body_filename && *request_body_filename) {
|
||||
request_body_fd = open(request_body_filename, O_RDONLY);
|
||||
@@ -605,7 +605,7 @@ static char *_sapi_cgibin_putenv(char *name, char *value TSRMLS_DC)
|
||||
|
||||
static char *sapi_cgi_read_cookies(TSRMLS_D)
|
||||
{
|
||||
return sapi_cgibin_getenv((char *) "HTTP_COOKIE", sizeof("HTTP_COOKIE")-1 TSRMLS_CC);
|
||||
return sapi_cgibin_getenv((char *) "HTTP_COOKIE", sizeof("HTTP_COOKIE") - 1 TSRMLS_CC);
|
||||
}
|
||||
|
||||
void cgi_php_import_environment_variables(zval *array_ptr TSRMLS_DC)
|
||||
@@ -674,12 +674,13 @@ static void sapi_cgi_register_variables(zval *track_vars_array TSRMLS_DC)
|
||||
if (CGIG(fix_pathinfo)) {
|
||||
char *script_name = SG(request_info).request_uri;
|
||||
unsigned int script_name_len = script_name ? strlen(script_name) : 0;
|
||||
char *path_info = sapi_cgibin_getenv("PATH_INFO", sizeof("PATH_INFO")-1 TSRMLS_CC);
|
||||
char *path_info = sapi_cgibin_getenv("PATH_INFO", sizeof("PATH_INFO") - 1 TSRMLS_CC);
|
||||
unsigned int path_info_len = path_info ? strlen(path_info) : 0;
|
||||
|
||||
php_self_len = script_name_len + path_info_len;
|
||||
php_self = emalloc(php_self_len + 1);
|
||||
|
||||
/* Concat script_name and path_info into php_self */
|
||||
if (script_name) {
|
||||
memcpy(php_self, script_name, script_name_len + 1);
|
||||
}
|
||||
@@ -1083,8 +1084,8 @@ static int is_valid_path(const char *path)
|
||||
*/
|
||||
static void init_request_info(TSRMLS_D)
|
||||
{
|
||||
char *env_script_filename = sapi_cgibin_getenv("SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME")-1 TSRMLS_CC);
|
||||
char *env_path_translated = sapi_cgibin_getenv("PATH_TRANSLATED", sizeof("PATH_TRANSLATED")-1 TSRMLS_CC);
|
||||
char *env_script_filename = sapi_cgibin_getenv("SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME") - 1 TSRMLS_CC);
|
||||
char *env_path_translated = sapi_cgibin_getenv("PATH_TRANSLATED", sizeof("PATH_TRANSLATED") - 1 TSRMLS_CC);
|
||||
char *script_path_translated = env_script_filename;
|
||||
char *ini;
|
||||
int apache_was_here = 0;
|
||||
@@ -1112,17 +1113,17 @@ static void init_request_info(TSRMLS_D)
|
||||
* of the script will be retreived later via argc/argv */
|
||||
if (script_path_translated) {
|
||||
const char *auth;
|
||||
char *content_length = sapi_cgibin_getenv("CONTENT_LENGTH", sizeof("CONTENT_LENGTH")-1 TSRMLS_CC);
|
||||
char *content_type = sapi_cgibin_getenv("CONTENT_TYPE", sizeof("CONTENT_TYPE")-1 TSRMLS_CC);
|
||||
char *env_path_info = sapi_cgibin_getenv("PATH_INFO", sizeof("PATH_INFO")-1 TSRMLS_CC);
|
||||
char *env_script_name = sapi_cgibin_getenv("SCRIPT_NAME", sizeof("SCRIPT_NAME")-1 TSRMLS_CC);
|
||||
char *content_length = sapi_cgibin_getenv("CONTENT_LENGTH", sizeof("CONTENT_LENGTH") - 1 TSRMLS_CC);
|
||||
char *content_type = sapi_cgibin_getenv("CONTENT_TYPE", sizeof("CONTENT_TYPE") - 1 TSRMLS_CC);
|
||||
char *env_path_info = sapi_cgibin_getenv("PATH_INFO", sizeof("PATH_INFO") - 1 TSRMLS_CC);
|
||||
char *env_script_name = sapi_cgibin_getenv("SCRIPT_NAME", sizeof("SCRIPT_NAME") - 1 TSRMLS_CC);
|
||||
|
||||
/* Hack for buggy IIS that sets incorrect PATH_INFO */
|
||||
char *env_server_software = sapi_cgibin_getenv("SERVER_SOFTWARE", sizeof("SERVER_SOFTWARE")-1 TSRMLS_CC);
|
||||
char *env_server_software = sapi_cgibin_getenv("SERVER_SOFTWARE", sizeof("SERVER_SOFTWARE") - 1 TSRMLS_CC);
|
||||
if (env_server_software &&
|
||||
env_script_name &&
|
||||
env_path_info &&
|
||||
strncmp(env_server_software, "Microsoft-IIS", sizeof("Microsoft-IIS")-1) == 0 &&
|
||||
strncmp(env_server_software, "Microsoft-IIS", sizeof("Microsoft-IIS") - 1) == 0 &&
|
||||
strncmp(env_path_info, env_script_name, strlen(env_script_name)) == 0
|
||||
) {
|
||||
env_path_info = _sapi_cgibin_putenv("ORIG_PATH_INFO", env_path_info TSRMLS_CC);
|
||||
@@ -1160,8 +1161,8 @@ static void init_request_info(TSRMLS_D)
|
||||
if (CGIG(fix_pathinfo)) {
|
||||
struct stat st;
|
||||
char *real_path = NULL;
|
||||
char *env_redirect_url = sapi_cgibin_getenv("REDIRECT_URL", sizeof("REDIRECT_URL")-1 TSRMLS_CC);
|
||||
char *env_document_root = sapi_cgibin_getenv("DOCUMENT_ROOT", sizeof("DOCUMENT_ROOT")-1 TSRMLS_CC);
|
||||
char *env_redirect_url = sapi_cgibin_getenv("REDIRECT_URL", sizeof("REDIRECT_URL") - 1 TSRMLS_CC);
|
||||
char *env_document_root = sapi_cgibin_getenv("DOCUMENT_ROOT", sizeof("DOCUMENT_ROOT") - 1 TSRMLS_CC);
|
||||
char *orig_path_translated = env_path_translated;
|
||||
char *orig_path_info = env_path_info;
|
||||
char *orig_script_name = env_script_name;
|
||||
@@ -1396,19 +1397,19 @@ static void init_request_info(TSRMLS_D)
|
||||
SG(request_info).path_translated = estrdup(script_path_translated);
|
||||
}
|
||||
|
||||
SG(request_info).request_method = sapi_cgibin_getenv("REQUEST_METHOD", sizeof("REQUEST_METHOD")-1 TSRMLS_CC);
|
||||
SG(request_info).request_method = sapi_cgibin_getenv("REQUEST_METHOD", sizeof("REQUEST_METHOD") - 1 TSRMLS_CC);
|
||||
/* FIXME - Work out proto_num here */
|
||||
SG(request_info).query_string = sapi_cgibin_getenv("QUERY_STRING", sizeof("QUERY_STRING")-1 TSRMLS_CC);
|
||||
SG(request_info).query_string = sapi_cgibin_getenv("QUERY_STRING", sizeof("QUERY_STRING") - 1 TSRMLS_CC);
|
||||
SG(request_info).content_type = (content_type ? content_type : "" );
|
||||
SG(request_info).content_length = (content_length ? atoi(content_length) : 0);
|
||||
|
||||
/* The CGI RFC allows servers to pass on unvalidated Authorization data */
|
||||
auth = sapi_cgibin_getenv("HTTP_AUTHORIZATION", sizeof("HTTP_AUTHORIZATION")-1 TSRMLS_CC);
|
||||
auth = sapi_cgibin_getenv("HTTP_AUTHORIZATION", sizeof("HTTP_AUTHORIZATION") - 1 TSRMLS_CC);
|
||||
php_handle_auth_data(auth TSRMLS_CC);
|
||||
}
|
||||
|
||||
/* INI stuff */
|
||||
ini = sapi_cgibin_getenv("PHP_VALUE", sizeof("PHP_VALUE")-1 TSRMLS_CC);
|
||||
ini = sapi_cgibin_getenv("PHP_VALUE", sizeof("PHP_VALUE") - 1 TSRMLS_CC);
|
||||
if (ini) {
|
||||
int mode = ZEND_INI_USER;
|
||||
char *tmp;
|
||||
@@ -1417,7 +1418,7 @@ static void init_request_info(TSRMLS_D)
|
||||
efree(tmp);
|
||||
}
|
||||
|
||||
ini = sapi_cgibin_getenv("PHP_ADMIN_VALUE", sizeof("PHP_ADMIN_VALUE")-1 TSRMLS_CC);
|
||||
ini = sapi_cgibin_getenv("PHP_ADMIN_VALUE", sizeof("PHP_ADMIN_VALUE") - 1 TSRMLS_CC);
|
||||
if (ini) {
|
||||
int mode = ZEND_INI_SYSTEM;
|
||||
char *tmp;
|
||||
|
||||
@@ -57,7 +57,7 @@ int fpm_scoreboard_init_main() /* {{{ */
|
||||
return -1;
|
||||
}
|
||||
wp->scoreboard->nprocs = wp->config->pm_max_children;
|
||||
for (i=0; i<wp->scoreboard->nprocs; i++) {
|
||||
for (i = 0; i < wp->scoreboard->nprocs; i++) {
|
||||
wp->scoreboard->procs[i] = fpm_shm_alloc(sizeof(struct fpm_scoreboard_proc_s));
|
||||
if (!wp->scoreboard->procs[i]) {
|
||||
return -1;
|
||||
@@ -231,7 +231,7 @@ void fpm_scoreboard_free(struct fpm_scoreboard_s *scoreboard) /* {{{ */
|
||||
return;
|
||||
}
|
||||
|
||||
for (i=0; i<scoreboard->nprocs; i++) {
|
||||
for (i = 0; i < scoreboard->nprocs; i++) {
|
||||
if (!scoreboard->procs[i]) {
|
||||
continue;
|
||||
}
|
||||
@@ -291,7 +291,7 @@ int fpm_scoreboard_proc_alloc(struct fpm_scoreboard_s *scoreboard, int *child_in
|
||||
|
||||
if (i < 0) { /* the supposed free slot is not, let's search for a free slot */
|
||||
zlog(ZLOG_DEBUG, "[pool %s] the proc->free_slot was not free. Let's search", scoreboard->pool);
|
||||
for (i=0; i<scoreboard->nprocs; i++) {
|
||||
for (i = 0; i < scoreboard->nprocs; i++) {
|
||||
if (scoreboard->procs[i] && !scoreboard->procs[i]->used) { /* found */
|
||||
break;
|
||||
}
|
||||
|
||||
+10
-10
@@ -201,11 +201,11 @@ int fpm_signals_init_main() /* {{{ */
|
||||
sigfillset(&act.sa_mask);
|
||||
|
||||
if (0 > sigaction(SIGTERM, &act, 0) ||
|
||||
0 > sigaction(SIGINT, &act, 0) ||
|
||||
0 > sigaction(SIGUSR1, &act, 0) ||
|
||||
0 > sigaction(SIGUSR2, &act, 0) ||
|
||||
0 > sigaction(SIGCHLD, &act, 0) ||
|
||||
0 > sigaction(SIGQUIT, &act, 0)) {
|
||||
0 > sigaction(SIGINT, &act, 0) ||
|
||||
0 > sigaction(SIGUSR1, &act, 0) ||
|
||||
0 > sigaction(SIGUSR2, &act, 0) ||
|
||||
0 > sigaction(SIGCHLD, &act, 0) ||
|
||||
0 > sigaction(SIGQUIT, &act, 0)) {
|
||||
|
||||
zlog(ZLOG_SYSERROR, "sigaction() failed");
|
||||
return -1;
|
||||
@@ -230,11 +230,11 @@ int fpm_signals_init_child() /* {{{ */
|
||||
close(sp[1]);
|
||||
|
||||
if (0 > sigaction(SIGTERM, &act_dfl, 0) ||
|
||||
0 > sigaction(SIGINT, &act_dfl, 0) ||
|
||||
0 > sigaction(SIGUSR1, &act_dfl, 0) ||
|
||||
0 > sigaction(SIGUSR2, &act_dfl, 0) ||
|
||||
0 > sigaction(SIGCHLD, &act_dfl, 0) ||
|
||||
0 > sigaction(SIGQUIT, &act, 0)) {
|
||||
0 > sigaction(SIGINT, &act_dfl, 0) ||
|
||||
0 > sigaction(SIGUSR1, &act_dfl, 0) ||
|
||||
0 > sigaction(SIGUSR2, &act_dfl, 0) ||
|
||||
0 > sigaction(SIGCHLD, &act_dfl, 0) ||
|
||||
0 > sigaction(SIGQUIT, &act, 0)) {
|
||||
|
||||
zlog(ZLOG_SYSERROR, "sigaction() failed");
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user