-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpassenger.diff
207 lines (193 loc) · 7.3 KB
/
passenger.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
diff --git a/bin/passenger-install-nginx-module b/bin/passenger-install-nginx-module
index 07762dcf..969ad958 100755
--- a/bin/passenger-install-nginx-module
+++ b/bin/passenger-install-nginx-module
@@ -109,6 +109,7 @@ def run_steps
check_whether_system_has_enough_ram
download_and_install = should_we_download_and_install_nginx_automatically?
+ no_make_install = should_we_do_not_run_nginx_install?
if pcre_is_installed?
@pcre_source_dir = nil
else
@@ -133,7 +134,7 @@ def run_steps
check_whether_other_nginx_installations_exist(nginx_prefix)
extra_nginx_configure_flags = ask_for_extra_nginx_configure_flags(nginx_prefix)
end
- check_whether_we_can_write_to(nginx_prefix) || exit(1)
+ no_make_install || check_whether_we_can_write_to(nginx_prefix) || exit(1)
nginx_config_already_exists_before_installing = nginx_config_exists?(nginx_prefix)
if needs_compiling_support_files?
if !compile_passenger_support_files
@@ -141,8 +142,8 @@ def run_steps
exit(1)
end
end
- if install_nginx(nginx_source_dir, nginx_prefix, extra_nginx_configure_flags)
- if nginx_config_already_exists_before_installing || !locate_nginx_config_file(nginx_prefix)
+ if install_nginx(nginx_source_dir, nginx_prefix, extra_nginx_configure_flags, no_make_install)
+ if no_make_install || nginx_config_already_exists_before_installing || !locate_nginx_config_file(nginx_prefix)
show_passenger_config_snippets(nginx_prefix)
else
insert_passenger_config_snippets(nginx_prefix)
@@ -265,6 +266,15 @@ def should_we_download_and_install_nginx_automatically?
end
end
+ def should_we_do_not_run_nginx_install?
+ if @nginx_no_install
+ puts "<b>Proceeding with no make install.</b>"
+ return true
+ else
+ return false
+ end
+ end
+
def download_and_extract_pcre
new_screen
puts "<banner>PCRE (required by Nginx) not installed, downloading it...</banner>"
@@ -474,13 +484,17 @@ def nginx_config_exists?(prefix)
return !!locate_nginx_config_file(prefix)
end
- def install_nginx(source_dir, prefix, extra_configure_flags)
+ def install_nginx(source_dir, prefix, extra_configure_flags, no_make_install)
Dir.chdir(source_dir) do
new_screen
- puts "<banner>Compiling and installing Nginx...</banner>"
+ if no_make_install
+ puts "<banner>Compiling and installing Nginx...</banner>"
+ else
+ puts "<banner>Compiling without installing Nginx...</banner>"
+ end
if !sh(build_nginx_configure_command(prefix, extra_configure_flags)) ||
!sh("make") ||
- !sh("make install")
+ !(no_make_install || sh("make install"))
return false
end
end
@@ -647,6 +661,9 @@ def boolean_option(name)
"#{indent}directory. Conflicts with --auto-download.") do |dir|
options[:nginx_source_dir] = dir
end
+ opts.on("--nginx-no-install", "Do not install NGINX?") do |dir|
+ options[:nginx_no_install] = true
+ end
opts.on("--extra-configure-flags=STRING", String, "Pass these extra flags to Nginx's\n" <<
"#{indent}'configure' script, instead of asking for\n" <<
"#{indent}it interactively. Specify 'none' if you\n" <<
diff --git a/src/agent/Core/Controller/SendRequest.cpp b/src/agent/Core/Controller/SendRequest.cpp
index f1b642c3..01c67d16 100644
--- a/src/agent/Core/Controller/SendRequest.cpp
+++ b/src/agent/Core/Controller/SendRequest.cpp
@@ -796,7 +796,6 @@ Controller::constructHeaderBuffersForHttpProtocol(Request *req, struct iovec *bu
if (req->https) {
PUSH_STATIC_BUFFER("X-Forwarded-Proto: https\r\n");
- PUSH_STATIC_BUFFER("!~Passenger-Proto: https\r\n");
}
if (cache.remoteAddr != NULL && cache.remoteAddr->size > 0) {
@@ -815,34 +814,6 @@ Controller::constructHeaderBuffersForHttpProtocol(Request *req, struct iovec *bu
dataSize += cache.remoteAddr->size;
PUSH_STATIC_BUFFER("\r\n");
-
- PUSH_STATIC_BUFFER("!~Passenger-Client-Address: ");
-
- part = cache.remoteAddr->start;
- while (part != NULL) {
- if (buffers != NULL) {
- BEGIN_PUSH_NEXT_BUFFER();
- buffers[i].iov_base = (void *) part->data;
- buffers[i].iov_len = part->size;
- }
- INC_BUFFER_ITER(i);
- part = part->next;
- }
- dataSize += cache.remoteAddr->size;
-
- PUSH_STATIC_BUFFER("\r\n");
- }
-
- if (req->envvars != NULL) {
- PUSH_STATIC_BUFFER("!~Passenger-Envvars: ");
- if (buffers != NULL) {
- BEGIN_PUSH_NEXT_BUFFER();
- buffers[i].iov_base = (void *) req->envvars->start->data;
- buffers[i].iov_len = req->envvars->size;
- }
- INC_BUFFER_ITER(i);
- dataSize += req->envvars->size;
- PUSH_STATIC_BUFFER("\r\n");
}
PUSH_STATIC_BUFFER("\r\n");
diff --git a/src/agent/Core/CoreMain.cpp b/src/agent/Core/CoreMain.cpp
index 9594201e..3e4cd525 100644
--- a/src/agent/Core/CoreMain.cpp
+++ b/src/agent/Core/CoreMain.cpp
@@ -1347,7 +1347,6 @@ runCore() {
initializeCurl();
initializeNonPrivilegedWorkingObjects();
initializeSecurityUpdateChecker();
- initializeTelemetryCollector();
initializeAdminPanelConnector();
prestartWebApps();
diff --git a/src/nginx_module/ngx_http_passenger_module.c b/src/nginx_module/ngx_http_passenger_module.c
index 9f4d2383..d9a9b378 100644
--- a/src/nginx_module/ngx_http_passenger_module.c
+++ b/src/nginx_module/ngx_http_passenger_module.c
@@ -192,6 +192,29 @@ save_master_process_pid(ngx_cycle_t *cycle) {
return NGX_OK;
}
+static ngx_int_t
+save_child_process_pid(ngx_cycle_t *cycle) {
+ u_char filename[NGX_MAX_PATH];
+ u_char *last;
+ FILE *f;
+
+ last = ngx_snprintf(filename, sizeof(filename) - 1, "%s/web_server_info/child_processes.pid",
+ psg_watchdog_launcher_get_instance_dir(psg_watchdog_launcher, NULL));
+ *last = (u_char) '\0';
+
+ f = fopen((const char *) filename, "a");
+ if (f != NULL) {
+ fprintf(f, "%ld\n", (long) getpid());
+ fclose(f);
+ } else {
+ ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
+ "could not create %s", filename);
+ }
+
+ return NGX_OK;
+}
+
+
typedef struct {
ngx_cycle_t *cycle;
int log_fd;
@@ -464,6 +487,18 @@ start_watchdog(ngx_cycle_t *cycle) {
result = NGX_ERROR;
goto cleanup;
}
+ last = ngx_snprintf(filename, sizeof(filename) - 1,
+ "%s/web_server_info/child_processes.pid",
+ psg_watchdog_launcher_get_instance_dir(psg_watchdog_launcher, NULL));
+ *last = (u_char) '\0';
+ if (create_file(cycle, filename, (const u_char *) "", 0, (uid_t) core_conf->user, (gid_t) -1) != NGX_OK) {
+ result = NGX_ERROR;
+ goto cleanup;
+ }
+ if (ret == -1) {
+ result = NGX_ERROR;
+ goto cleanup;
+ }
cleanup:
psg_json_value_free(w_config);
@@ -509,7 +544,6 @@ pre_config_init(ngx_conf_t *cf)
{
char *error_message;
- shutdown_watchdog();
ngx_memzero(&passenger_main_conf, sizeof(passenger_main_conf_t));
pp_schema_string.data = (u_char *) "passenger:";
@@ -571,6 +605,7 @@ init_worker_process(ngx_cycle_t *cycle) {
if (passenger_main_conf.autogenerated.root_dir.len != 0 && !ngx_test_config) {
save_master_process_pid(cycle);
+ save_child_process_pid(cycle);
core_conf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
if (core_conf->master) {