passenger 4.0.3 → 4.0.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of passenger might be problematic. Click here for more details.

Files changed (46) hide show
  1. data.tar.gz.asc +7 -7
  2. data/NEWS +30 -0
  3. data/build/agents.rb +3 -0
  4. data/build/apache2.rb +2 -3
  5. data/build/basics.rb +20 -0
  6. data/build/common_library.rb +15 -0
  7. data/build/cxx_tests.rb +4 -1
  8. data/build/packaging.rb +22 -32
  9. data/doc/Packaging.html +792 -0
  10. data/doc/Users guide Nginx.html +2 -2
  11. data/doc/Users guide Nginx.txt +2 -2
  12. data/ext/apache2/Configuration.cpp +34 -62
  13. data/ext/apache2/Configuration.hpp +1 -14
  14. data/ext/apache2/DirectoryMapper.h +134 -104
  15. data/ext/apache2/Hooks.cpp +33 -19
  16. data/ext/common/AgentsStarter.cpp +22 -22
  17. data/ext/common/AgentsStarter.h +25 -25
  18. data/ext/common/ApplicationPool2/AppTypes.cpp +6 -6
  19. data/ext/common/ApplicationPool2/AppTypes.h +61 -9
  20. data/ext/common/ApplicationPool2/Implementation.cpp +14 -2
  21. data/ext/common/Constants.h +54 -23
  22. data/ext/common/Constants.h.erb +42 -0
  23. data/ext/common/ServerInstanceDir.h +6 -11
  24. data/ext/common/Utils/CachedFileStat.cpp +10 -9
  25. data/ext/common/Utils/CachedFileStat.h +8 -8
  26. data/ext/common/Utils/LargeFiles.cpp +12 -4
  27. data/ext/common/agents/HelperAgent/RequestHandler.h +1 -0
  28. data/ext/common/agents/Watchdog/Main.cpp +2 -2
  29. data/ext/nginx/Configuration.c +1 -1
  30. data/ext/nginx/Configuration.h +0 -1
  31. data/ext/nginx/ContentHandler.c +15 -15
  32. data/ext/nginx/ngx_http_passenger_module.c +48 -48
  33. data/ext/nginx/ngx_http_passenger_module.h +7 -9
  34. data/helper-scripts/wsgi-loader.py +2 -2
  35. data/lib/phusion_passenger.rb +1 -3
  36. data/lib/phusion_passenger/admin_tools/server_instance.rb +5 -11
  37. data/lib/phusion_passenger/constants.rb +42 -0
  38. data/lib/phusion_passenger/packaging.rb +8 -6
  39. data/lib/phusion_passenger/platform_info.rb +11 -6
  40. data/lib/phusion_passenger/standalone/command.rb +4 -2
  41. data/lib/phusion_passenger/standalone/runtime_installer.rb +1 -1
  42. data/resources/templates/standalone/config.erb +14 -2
  43. data/test/ruby/admin_tools_spec.rb +14 -16
  44. metadata +4 -3
  45. metadata.gz.asc +7 -7
  46. data/lib/phusion_passenger/wsgi/request_handler.py +0 -199
@@ -567,13 +567,25 @@ Group::spawnThreadOOBWRequest(GroupPtr self, ProcessPtr process) {
567
567
  {
568
568
  // Standard resource management boilerplate stuff...
569
569
  unique_lock<boost::mutex> lock(pool->syncher);
570
- if (OXT_UNLIKELY(!process->isAlive() || !isAlive())) {
570
+ if (OXT_UNLIKELY(!process->isAlive()
571
+ || process->enabled == Process::DETACHED
572
+ || !isAlive()))
573
+ {
574
+ return;
575
+ }
576
+
577
+ if (process->enabled != Process::DISABLED) {
578
+ UPDATE_TRACE_POINT();
579
+ P_INFO("Out-of-Band Work canceled: process " << process->inspect() <<
580
+ " was concurrently re-enabled.");
581
+ if (debug != NULL && debug->oobw) {
582
+ debug->debugger->send("OOBW request canceled");
583
+ }
571
584
  return;
572
585
  }
573
586
 
574
587
  assert(process->oobwStatus = Process::OOBW_IN_PROGRESS);
575
588
  assert(process->sessions == 0);
576
- assert(process->enabled == Process::DISABLED);
577
589
  socket = process->sessionSockets.top();
578
590
  assert(socket != NULL);
579
591
  }
@@ -25,31 +25,62 @@
25
25
  #ifndef _PASSENGER_CONSTANTS_H_
26
26
  #define _PASSENGER_CONSTANTS_H_
27
27
 
28
- /* Don't forget to update lib/phusion_passenger.rb too. */
29
- #define PASSENGER_VERSION "4.0.3"
30
-
31
- #define FEEDBACK_FD 3
32
-
33
- #define DEFAULT_LOG_LEVEL 0
34
- #define DEFAULT_RUBY "ruby"
35
- #define DEFAULT_PYTHON "python"
36
- #define DEFAULT_MAX_POOL_SIZE 6
37
- #define DEFAULT_POOL_IDLE_TIME 300
38
- #define DEFAULT_MAX_INSTANCES_PER_APP 0
39
- #define DEFAULT_WEB_APP_USER "nobody"
40
- #define DEFAULT_ANALYTICS_LOG_USER DEFAULT_WEB_APP_USER
41
- #define DEFAULT_ANALYTICS_LOG_GROUP ""
42
- #define DEFAULT_ANALYTICS_LOG_PERMISSIONS "u=rwx,g=rx,o=rx"
43
- #define DEFAULT_UNION_STATION_GATEWAY_ADDRESS "gateway.unionstationapp.com"
44
- #define DEFAULT_UNION_STATION_GATEWAY_PORT 443
45
-
46
- #define MESSAGE_SERVER_MAX_USERNAME_SIZE 100
47
- #define MESSAGE_SERVER_MAX_PASSWORD_SIZE 100
28
+ /* Constants.h is automatically generated from Constants.h.erb by the build system.
29
+ * Most constants are derived from lib/phusion_passenger/constants.rb.
30
+ *
31
+ * To force regenerating this file:
32
+ * rm -f ext/common/Constants.h
33
+ * rake ext/common/Constants.h
34
+ */
35
+
48
36
  #define DEFAULT_BACKEND_ACCOUNT_RIGHTS Account::DETACH
49
37
 
50
- #define POOL_HELPER_THREAD_STACK_SIZE (1024 * 256)
51
38
 
52
- #define PROCESS_SHUTDOWN_TIMEOUT 60 /* seconds */
53
- #define PROCESS_SHUTDOWN_TIMEOUT_DISPLAY "1 minute"
39
+ #define DEFAULT_LOG_LEVEL 0
40
+
41
+ #define DEFAULT_RUBY "ruby"
42
+
43
+ #define DEFAULT_PYTHON "python"
44
+
45
+ #define DEFAULT_MAX_POOL_SIZE 6
46
+
47
+ #define DEFAULT_POOL_IDLE_TIME 300
48
+
49
+ #define DEFAULT_MAX_INSTANCES_PER_APP 0
50
+
51
+ #define DEFAULT_WEB_APP_USER "nobody"
52
+
53
+ #define DEFAULT_ANALYTICS_LOG_USER "nobody"
54
+
55
+ #define DEFAULT_ANALYTICS_LOG_GROUP ""
56
+
57
+ #define DEFAULT_ANALYTICS_LOG_PERMISSIONS "u=rwx,g=rx,o=rx"
58
+
59
+ #define DEFAULT_UNION_STATION_GATEWAY_ADDRESS "gateway.unionstationapp.com"
60
+
61
+ #define DEFAULT_UNION_STATION_GATEWAY_PORT 443
62
+
63
+ #define MESSAGE_SERVER_MAX_USERNAME_SIZE 100
64
+
65
+ #define MESSAGE_SERVER_MAX_PASSWORD_SIZE 100
66
+
67
+ #define POOL_HELPER_THREAD_STACK_SIZE 262144
68
+
69
+ #define PROCESS_SHUTDOWN_TIMEOUT 60
70
+
71
+ #define PROCESS_SHUTDOWN_TIMEOUT_DISPLAY "1 minute"
72
+
73
+ #define PASSENGER_VERSION "4.0.3"
74
+
75
+ #define SERVER_INSTANCE_DIR_STRUCTURE_MAJOR_VERSION 1
76
+
77
+ #define SERVER_INSTANCE_DIR_STRUCTURE_MINOR_VERSION 0
78
+
79
+ #define SERVER_INSTANCE_DIR_GENERATION_STRUCTURE_MAJOR_VERSION 2
80
+
81
+ #define SERVER_INSTANCE_DIR_GENERATION_STRUCTURE_MINOR_VERSION 0
82
+
83
+ #define FEEDBACK_FD 3
84
+
54
85
 
55
86
  #endif /* _PASSENGER_CONSTANTS_H */
@@ -0,0 +1,42 @@
1
+ /*
2
+ * Phusion Passenger - https://www.phusionpassenger.com/
3
+ * Copyright (c) 2010-2013 Phusion
4
+ *
5
+ * "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ */
25
+ #ifndef _PASSENGER_CONSTANTS_H_
26
+ #define _PASSENGER_CONSTANTS_H_
27
+
28
+ /* Constants.h is automatically generated from Constants.h.erb by the build system.
29
+ * Most constants are derived from lib/phusion_passenger/constants.rb.
30
+ *
31
+ * To force regenerating this file:
32
+ * rm -f ext/common/Constants.h
33
+ * rake ext/common/Constants.h
34
+ */
35
+
36
+ #define DEFAULT_BACKEND_ACCOUNT_RIGHTS Account::DETACH
37
+
38
+ <% for constant_name in PhusionPassenger::SharedConstants.constants %>
39
+ #define <%= constant_name %> <%=PhusionPassenger::SharedConstants.const_get(constant_name).inspect %>
40
+ <% end %>
41
+
42
+ #endif /* _PASSENGER_CONSTANTS_H */
@@ -38,9 +38,10 @@
38
38
  #include <cstring>
39
39
  #include <string>
40
40
 
41
- #include "Exceptions.h"
42
- #include "Utils.h"
43
- #include "Utils/StrIntUtils.h"
41
+ #include <Constants.h>
42
+ #include <Exceptions.h>
43
+ #include <Utils.h>
44
+ #include <Utils/StrIntUtils.h>
44
45
 
45
46
  namespace Passenger {
46
47
 
@@ -49,12 +50,6 @@ using namespace boost;
49
50
 
50
51
  class ServerInstanceDir: public noncopyable {
51
52
  public:
52
- // Don't forget to update lib/phusion_passenger/admin_tools/server_instance.rb too.
53
- static const int DIR_STRUCTURE_MAJOR_VERSION = 1;
54
- static const int DIR_STRUCTURE_MINOR_VERSION = 0;
55
- static const int GENERATION_STRUCTURE_MAJOR_VERSION = 2;
56
- static const int GENERATION_STRUCTURE_MINOR_VERSION = 0;
57
-
58
53
  class Generation: public noncopyable {
59
54
  private:
60
55
  friend class ServerInstanceDir;
@@ -102,8 +97,8 @@ public:
102
97
  /* Write structure version file. */
103
98
  string structureVersionFile = path + "/structure_version.txt";
104
99
  createFile(structureVersionFile,
105
- toString(GENERATION_STRUCTURE_MAJOR_VERSION) + "." +
106
- toString(GENERATION_STRUCTURE_MINOR_VERSION),
100
+ toString(SERVER_INSTANCE_DIR_GENERATION_STRUCTURE_MAJOR_VERSION) + "." +
101
+ toString(SERVER_INSTANCE_DIR_GENERATION_STRUCTURE_MINOR_VERSION),
107
102
  S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
108
103
 
109
104
 
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Phusion Passenger - https://www.phusionpassenger.com/
3
- * Copyright (c) 2010 Phusion
3
+ * Copyright (c) 2010-2013 Phusion
4
4
  *
5
5
  * "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
6
6
  *
@@ -27,21 +27,22 @@
27
27
 
28
28
  extern "C" {
29
29
 
30
- PassengerCachedFileStat *
31
- cached_file_stat_new(unsigned int max_size) {
32
- return (PassengerCachedFileStat *) new Passenger::CachedFileStat(max_size);
30
+ PP_CachedFileStat *
31
+ pp_cached_file_stat_new(unsigned int max_size) {
32
+ return (PP_CachedFileStat *) new Passenger::CachedFileStat(max_size);
33
33
  }
34
34
 
35
35
  void
36
- cached_file_stat_free(PassengerCachedFileStat *cstat) {
36
+ pp_cached_file_stat_free(PP_CachedFileStat *cstat) {
37
37
  delete (Passenger::CachedFileStat *) cstat;
38
38
  }
39
39
 
40
40
  int
41
- cached_file_stat_perform(PassengerCachedFileStat *cstat,
42
- const char *filename,
43
- struct stat *buf,
44
- unsigned int throttle_rate) {
41
+ pp_cached_file_stat_perform(PP_CachedFileStat *cstat,
42
+ const char *filename,
43
+ struct stat *buf,
44
+ unsigned int throttle_rate)
45
+ {
45
46
  try {
46
47
  return ((Passenger::CachedFileStat *) cstat)->stat(filename, buf, throttle_rate);
47
48
  } catch (const Passenger::TimeRetrievalException &e) {
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Phusion Passenger - https://www.phusionpassenger.com/
3
- * Copyright (c) 2010 Phusion
3
+ * Copyright (c) 2010-2013 Phusion
4
4
  *
5
5
  * "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
6
6
  *
@@ -34,14 +34,14 @@ extern "C" {
34
34
 
35
35
  /** C bindings for Passenger::CachedFileStat. */
36
36
 
37
- typedef void PassengerCachedFileStat;
37
+ typedef void PP_CachedFileStat;
38
38
 
39
- PassengerCachedFileStat *cached_file_stat_new(unsigned int max_size);
40
- void cached_file_stat_free(PassengerCachedFileStat *cstat);
41
- int cached_file_stat_perform(PassengerCachedFileStat *cstat,
42
- const char *filename,
43
- struct stat *buf,
44
- unsigned int throttle_rate);
39
+ PP_CachedFileStat *pp_cached_file_stat_new(unsigned int max_size);
40
+ void pp_cached_file_stat_free(PP_CachedFileStat *cstat);
41
+ int pp_cached_file_stat_perform(PP_CachedFileStat *cstat,
42
+ const char *filename,
43
+ struct stat *buf,
44
+ unsigned int throttle_rate);
45
45
 
46
46
 
47
47
  #ifdef __cplusplus
@@ -1,7 +1,15 @@
1
- #define _FILE_OFFSET_BITS 64
2
- #define _LARGE_FILES 1
3
- #define _LARGEFILE_SOURCE
4
- #define _LARGEFILE64_SOURCE
1
+ #ifndef _FILE_OFFSET_BITS
2
+ #define _FILE_OFFSET_BITS 64
3
+ #endif
4
+ #ifndef _LARGE_FILES
5
+ #define _LARGE_FILES 1
6
+ #endif
7
+ #ifndef _LARGEFILE_SOURCE
8
+ #define _LARGEFILE_SOURCE
9
+ #endif
10
+ #ifndef _LARGEFILE64_SOURCE
11
+ #define _LARGEFILE64_SOURCE
12
+ #endif
5
13
 
6
14
  #include <Utils/LargeFiles.h>
7
15
  #include <stdlib.h>
@@ -1642,6 +1642,7 @@ private:
1642
1642
  options.baseURI = scriptName;
1643
1643
  }
1644
1644
 
1645
+ options.ruby = this->options.defaultRubyCommand;
1645
1646
  options.logLevel = getLogLevel();
1646
1647
  options.loggingAgentAddress = this->options.loggingAgentAddress;
1647
1648
  options.loggingAgentUsername = "logging";
@@ -458,8 +458,8 @@ initializeWorkingObjects() {
458
458
  */
459
459
  string path = tempDir +
460
460
  "/passenger." +
461
- toString(ServerInstanceDir::DIR_STRUCTURE_MAJOR_VERSION) + "." +
462
- toString(ServerInstanceDir::DIR_STRUCTURE_MINOR_VERSION) + "." +
461
+ toString(SERVER_INSTANCE_DIR_STRUCTURE_MAJOR_VERSION) + "." +
462
+ toString(SERVER_INSTANCE_DIR_STRUCTURE_MINOR_VERSION) + "." +
463
463
  toString<unsigned long long>(agentsOptions.getPid("web_server_pid"));
464
464
  serverInstanceDir.reset(new ServerInstanceDir(path));
465
465
  } else {
@@ -911,7 +911,7 @@ passenger_enabled(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
911
911
  * loading is done.
912
912
  */
913
913
  ngx_memzero(&upstream_url, sizeof(ngx_url_t));
914
- upstream_url.url = passenger_placeholder_upstream_address;
914
+ upstream_url.url = pp_placeholder_upstream_address;
915
915
  upstream_url.no_resolve = 1;
916
916
  passenger_conf->upstream_config.upstream = ngx_http_upstream_add(cf, &upstream_url, 0);
917
917
  if (passenger_conf->upstream_config.upstream == NULL) {
@@ -33,7 +33,6 @@
33
33
 
34
34
  typedef struct {
35
35
  ngx_http_upstream_conf_t upstream_config;
36
- ngx_str_t index;
37
36
  ngx_array_t *flushes;
38
37
  ngx_array_t *vars_len;
39
38
  ngx_array_t *vars;
@@ -65,10 +65,10 @@ get_file_type(const u_char *filename, unsigned int throttle_rate) {
65
65
  struct stat buf;
66
66
  int ret;
67
67
 
68
- ret = cached_file_stat_perform(passenger_stat_cache,
69
- (const char *) filename,
70
- &buf,
71
- throttle_rate);
68
+ ret = pp_cached_file_stat_perform(pp_stat_cache,
69
+ (const char *) filename,
70
+ &buf,
71
+ throttle_rate);
72
72
  if (ret == 0) {
73
73
  if (S_ISREG(buf.st_mode)) {
74
74
  return FT_FILE;
@@ -210,10 +210,10 @@ set_upstream_server_address(ngx_http_upstream_t *upstream, ngx_http_upstream_con
210
210
  * we substitute the placeholder filename with the real helper agent request
211
211
  * socket filename.
212
212
  */
213
- if (address->name.data == passenger_placeholder_upstream_address.data) {
213
+ if (address->name.data == pp_placeholder_upstream_address.data) {
214
214
  sockaddr = (struct sockaddr_un *) address->sockaddr;
215
215
  request_socket_filename =
216
- psg_agents_starter_get_request_socket_filename(passenger_agents_starter,
216
+ pp_agents_starter_get_request_socket_filename(pp_agents_starter,
217
217
  &request_socket_filename_len);
218
218
 
219
219
  address->name.data = (u_char *) request_socket_filename;
@@ -247,7 +247,7 @@ fix_peer_address(ngx_http_request_t *r) {
247
247
  rrp = r->upstream->peer.data;
248
248
  peers = rrp->peers;
249
249
  request_socket_filename =
250
- psg_agents_starter_get_request_socket_filename(passenger_agents_starter,
250
+ pp_agents_starter_get_request_socket_filename(pp_agents_starter,
251
251
  &request_socket_filename_len);
252
252
 
253
253
  while (peers != NULL) {
@@ -397,7 +397,7 @@ create_request(ngx_http_request_t *r)
397
397
  return NGX_HTTP_INTERNAL_SERVER_ERROR;
398
398
  }
399
399
 
400
- app_type_string = (const u_char *) passenger_get_app_type_name(context->app_type);
400
+ app_type_string = (const u_char *) pp_get_app_type_name(context->app_type);
401
401
  app_type_string_len = strlen((const char *) app_type_string) + 1; /* include null terminator */
402
402
 
403
403
 
@@ -590,7 +590,7 @@ create_request(ngx_http_request_t *r)
590
590
  **************************************************/
591
591
 
592
592
  helper_agent_request_socket_password_data =
593
- psg_agents_starter_get_request_socket_password(passenger_agents_starter,
593
+ pp_agents_starter_get_request_socket_password(pp_agents_starter,
594
594
  &helper_agent_request_socket_password_len);
595
595
  size = helper_agent_request_socket_password_len +
596
596
  /* netstring length + ":" + trailing "," */
@@ -1433,7 +1433,7 @@ passenger_content_handler(ngx_http_request_t *r)
1433
1433
 
1434
1434
  /* Find the base URI for this web application, if any. */
1435
1435
  if (find_base_uri(r, slcf, &base_uri)) {
1436
- /* Store the found base URI in context->public_dir. We infer that the 'public'
1436
+ /* Store the found base URI into context->public_dir. We infer that the 'public'
1437
1437
  * directory of the web application is document root + base URI.
1438
1438
  */
1439
1439
  len = root_path.len + base_uri.len + 1;
@@ -1467,13 +1467,13 @@ passenger_content_handler(ngx_http_request_t *r)
1467
1467
  }
1468
1468
 
1469
1469
  if (slcf->app_root.data == NULL) {
1470
- context->app_type = passenger_app_type_detector_check_document_root(
1471
- passenger_app_type_detector,
1470
+ context->app_type = pp_app_type_detector_check_document_root(
1471
+ pp_app_type_detector,
1472
1472
  (const char *) context->public_dir.data, context->public_dir.len,
1473
1473
  context->base_uri.len != 0);
1474
1474
  } else {
1475
- context->app_type = passenger_app_type_detector_check_app_root(
1476
- passenger_app_type_detector,
1475
+ context->app_type = pp_app_type_detector_check_app_root(
1476
+ pp_app_type_detector,
1477
1477
  (const char *) slcf->app_root.data, slcf->app_root.len);
1478
1478
  }
1479
1479
  if (context->app_type == PAT_NONE) {
@@ -1488,7 +1488,7 @@ passenger_content_handler(ngx_http_request_t *r)
1488
1488
  }
1489
1489
  u = r->upstream;
1490
1490
 
1491
- u->schema = passenger_schema_string;
1491
+ u->schema = pp_schema_string;
1492
1492
  u->output.tag = (ngx_buf_tag_t) &ngx_http_passenger_module;
1493
1493
  set_upstream_server_address(u, &slcf->upstream_config);
1494
1494
  u->conf = &slcf->upstream_config;
@@ -50,12 +50,12 @@
50
50
 
51
51
 
52
52
  static int first_start = 1;
53
- ngx_str_t passenger_schema_string;
54
- ngx_str_t passenger_placeholder_upstream_address;
55
- PassengerCachedFileStat *passenger_stat_cache;
56
- PassengerAppTypeDetector *passenger_app_type_detector;
57
- PSG_AgentsStarter *passenger_agents_starter = NULL;
58
- ngx_cycle_t *passenger_current_cycle;
53
+ ngx_str_t pp_schema_string;
54
+ ngx_str_t pp_placeholder_upstream_address;
55
+ PP_CachedFileStat *pp_stat_cache;
56
+ PP_AppTypeDetector *pp_app_type_detector;
57
+ PP_AgentsStarter *pp_agents_starter = NULL;
58
+ ngx_cycle_t *pp_current_cycle;
59
59
 
60
60
 
61
61
  /*
@@ -105,11 +105,11 @@ ngx_str_null_terminate(ngx_str_t *str) {
105
105
  }
106
106
 
107
107
  static void
108
- psg_variant_map_set_ngx_str(PSG_VariantMap *m,
108
+ pp_variant_map_set_ngx_str(PP_VariantMap *m,
109
109
  const char *name,
110
110
  ngx_str_t *value)
111
111
  {
112
- psg_variant_map_set(m, name, (const char *) value->data, value->len);
112
+ pp_variant_map_set(m, name, (const char *) value->data, value->len);
113
113
  }
114
114
 
115
115
  /**
@@ -129,7 +129,7 @@ save_master_process_pid(ngx_cycle_t *cycle) {
129
129
  FILE *f;
130
130
 
131
131
  last = ngx_snprintf(filename, sizeof(filename) - 1, "%s/control_process.pid",
132
- psg_agents_starter_get_server_instance_dir(passenger_agents_starter));
132
+ pp_agents_starter_get_server_instance_dir(pp_agents_starter));
133
133
  *last = (u_char) '\0';
134
134
 
135
135
  f = fopen((const char *) filename, "w");
@@ -250,14 +250,14 @@ start_helper_server(ngx_cycle_t *cycle) {
250
250
  ngx_str_t *prestart_uris;
251
251
  char **prestart_uris_ary = NULL;
252
252
  ngx_keyval_t *ctl = NULL;
253
- PSG_VariantMap *params = NULL;
253
+ PP_VariantMap *params = NULL;
254
254
  u_char filename[NGX_MAX_PATH], *last;
255
255
  char *passenger_root = NULL;
256
256
  char *error_message = NULL;
257
257
 
258
258
  core_conf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
259
259
  result = NGX_OK;
260
- params = psg_variant_map_new();
260
+ params = pp_variant_map_new();
261
261
  passenger_root = ngx_str_null_terminate(&passenger_main_conf.root_dir);
262
262
 
263
263
  prestart_uris = (ngx_str_t *) passenger_main_conf.prestart_uris->elts;
@@ -273,33 +273,33 @@ start_helper_server(ngx_cycle_t *cycle) {
273
273
  prestart_uris_ary[i][prestart_uris[i].len] = '\0';
274
274
  }
275
275
 
276
- psg_variant_map_set_int (params, "web_server_pid", getpid());
277
- psg_variant_map_set_int (params, "web_server_worker_uid", core_conf->user);
278
- psg_variant_map_set_int (params, "web_server_worker_gid", core_conf->group);
279
- psg_variant_map_set_int (params, "log_level", passenger_main_conf.log_level);
280
- psg_variant_map_set_ngx_str(params, "debug_log_file", &passenger_main_conf.debug_log_file);
281
- psg_variant_map_set_ngx_str(params, "temp_dir", &passenger_main_conf.temp_dir);
282
- psg_variant_map_set_bool (params, "user_switching", passenger_main_conf.user_switching);
283
- psg_variant_map_set_ngx_str(params, "default_user", &passenger_main_conf.default_user);
284
- psg_variant_map_set_ngx_str(params, "default_group", &passenger_main_conf.default_group);
285
- psg_variant_map_set_ngx_str(params, "default_ruby", &passenger_main_conf.default_ruby);
286
- psg_variant_map_set_int (params, "max_pool_size", passenger_main_conf.max_pool_size);
287
- psg_variant_map_set_int (params, "pool_idle_time", passenger_main_conf.pool_idle_time);
288
- psg_variant_map_set_ngx_str(params, "analytics_log_user", &passenger_main_conf.analytics_log_user);
289
- psg_variant_map_set_ngx_str(params, "analytics_log_group", &passenger_main_conf.analytics_log_group);
290
- psg_variant_map_set_ngx_str(params, "union_station_gateway_address", &passenger_main_conf.union_station_gateway_address);
291
- psg_variant_map_set_ngx_str(params, "union_station_gateway_cert", &passenger_main_conf.union_station_gateway_cert);
292
- psg_variant_map_set_ngx_str(params, "union_station_proxy_address", &passenger_main_conf.union_station_proxy_address);
293
- psg_variant_map_set_strset (params, "prestart_urls", (const char **) prestart_uris_ary, passenger_main_conf.prestart_uris->nelts);
276
+ pp_variant_map_set_int (params, "web_server_pid", getpid());
277
+ pp_variant_map_set_int (params, "web_server_worker_uid", core_conf->user);
278
+ pp_variant_map_set_int (params, "web_server_worker_gid", core_conf->group);
279
+ pp_variant_map_set_int (params, "log_level", passenger_main_conf.log_level);
280
+ pp_variant_map_set_ngx_str(params, "debug_log_file", &passenger_main_conf.debug_log_file);
281
+ pp_variant_map_set_ngx_str(params, "temp_dir", &passenger_main_conf.temp_dir);
282
+ pp_variant_map_set_bool (params, "user_switching", passenger_main_conf.user_switching);
283
+ pp_variant_map_set_ngx_str(params, "default_user", &passenger_main_conf.default_user);
284
+ pp_variant_map_set_ngx_str(params, "default_group", &passenger_main_conf.default_group);
285
+ pp_variant_map_set_ngx_str(params, "default_ruby", &passenger_main_conf.default_ruby);
286
+ pp_variant_map_set_int (params, "max_pool_size", passenger_main_conf.max_pool_size);
287
+ pp_variant_map_set_int (params, "pool_idle_time", passenger_main_conf.pool_idle_time);
288
+ pp_variant_map_set_ngx_str(params, "analytics_log_user", &passenger_main_conf.analytics_log_user);
289
+ pp_variant_map_set_ngx_str(params, "analytics_log_group", &passenger_main_conf.analytics_log_group);
290
+ pp_variant_map_set_ngx_str(params, "union_station_gateway_address", &passenger_main_conf.union_station_gateway_address);
291
+ pp_variant_map_set_ngx_str(params, "union_station_gateway_cert", &passenger_main_conf.union_station_gateway_cert);
292
+ pp_variant_map_set_ngx_str(params, "union_station_proxy_address", &passenger_main_conf.union_station_proxy_address);
293
+ pp_variant_map_set_strset (params, "prestart_urls", (const char **) prestart_uris_ary, passenger_main_conf.prestart_uris->nelts);
294
294
 
295
295
  ctl = (ngx_keyval_t *) passenger_main_conf.ctl->elts;
296
296
  for (i = 0; i < passenger_main_conf.ctl->nelts; i++) {
297
- psg_variant_map_set2(params,
297
+ pp_variant_map_set2(params,
298
298
  (const char *) ctl[i].key.data, ctl[i].key.len - 1,
299
299
  (const char *) ctl[i].value.data, ctl[i].value.len - 1);
300
300
  }
301
301
 
302
- ret = psg_agents_starter_start(passenger_agents_starter,
302
+ ret = pp_agents_starter_start(pp_agents_starter,
303
303
  passenger_root,
304
304
  params,
305
305
  starting_helper_server_after_fork,
@@ -317,7 +317,7 @@ start_helper_server(ngx_cycle_t *cycle) {
317
317
  */
318
318
  last = ngx_snprintf(filename, sizeof(filename) - 1,
319
319
  "%s/control_process.pid",
320
- psg_agents_starter_get_server_instance_dir(passenger_agents_starter));
320
+ pp_agents_starter_get_server_instance_dir(pp_agents_starter));
321
321
  *last = (u_char) '\0';
322
322
  if (create_file(cycle, filename, (const u_char *) "", 0) != NGX_OK) {
323
323
  result = NGX_ERROR;
@@ -334,7 +334,7 @@ start_helper_server(ngx_cycle_t *cycle) {
334
334
  /* Create various other info files. */
335
335
  last = ngx_snprintf(filename, sizeof(filename) - 1,
336
336
  "%s/web_server.txt",
337
- psg_agents_starter_get_generation_dir(passenger_agents_starter));
337
+ pp_agents_starter_get_generation_dir(pp_agents_starter));
338
338
  *last = (u_char) '\0';
339
339
  if (create_file(cycle, filename, (const u_char *) NGINX_VER, strlen(NGINX_VER)) != NGX_OK) {
340
340
  result = NGX_ERROR;
@@ -343,7 +343,7 @@ start_helper_server(ngx_cycle_t *cycle) {
343
343
 
344
344
  last = ngx_snprintf(filename, sizeof(filename) - 1,
345
345
  "%s/config_files.txt",
346
- psg_agents_starter_get_generation_dir(passenger_agents_starter));
346
+ pp_agents_starter_get_generation_dir(pp_agents_starter));
347
347
  *last = (u_char) '\0';
348
348
  if (create_file(cycle, filename, cycle->conf_file.data, cycle->conf_file.len) != NGX_OK) {
349
349
  result = NGX_ERROR;
@@ -351,7 +351,7 @@ start_helper_server(ngx_cycle_t *cycle) {
351
351
  }
352
352
 
353
353
  cleanup:
354
- psg_variant_map_free(params);
354
+ pp_variant_map_free(params);
355
355
  free(passenger_root);
356
356
  free(error_message);
357
357
  if (prestart_uris_ary != NULL) {
@@ -373,9 +373,9 @@ cleanup:
373
373
  */
374
374
  static void
375
375
  shutdown_helper_server() {
376
- if (passenger_agents_starter != NULL) {
377
- psg_agents_starter_free(passenger_agents_starter);
378
- passenger_agents_starter = NULL;
376
+ if (pp_agents_starter != NULL) {
377
+ pp_agents_starter_free(pp_agents_starter);
378
+ pp_agents_starter = NULL;
379
379
  }
380
380
  }
381
381
 
@@ -393,15 +393,15 @@ pre_config_init(ngx_conf_t *cf)
393
393
  shutdown_helper_server();
394
394
 
395
395
  ngx_memzero(&passenger_main_conf, sizeof(passenger_main_conf_t));
396
- passenger_schema_string.data = (u_char *) "passenger:";
397
- passenger_schema_string.len = sizeof("passenger:") - 1;
398
- passenger_placeholder_upstream_address.data = (u_char *) "unix:/passenger_helper_server";
399
- passenger_placeholder_upstream_address.len = sizeof("unix:/passenger_helper_server") - 1;
400
- passenger_stat_cache = cached_file_stat_new(1024);
401
- passenger_app_type_detector = passenger_app_type_detector_new();
402
- passenger_agents_starter = psg_agents_starter_new(AS_NGINX, &error_message);
396
+ pp_schema_string.data = (u_char *) "passenger:";
397
+ pp_schema_string.len = sizeof("passenger:") - 1;
398
+ pp_placeholder_upstream_address.data = (u_char *) "unix:/passenger_helper_server";
399
+ pp_placeholder_upstream_address.len = sizeof("unix:/passenger_helper_server") - 1;
400
+ pp_stat_cache = pp_cached_file_stat_new(1024);
401
+ pp_app_type_detector = pp_app_type_detector_new();
402
+ pp_agents_starter = pp_agents_starter_new(AS_NGINX, &error_message);
403
403
 
404
- if (passenger_agents_starter == NULL) {
404
+ if (pp_agents_starter == NULL) {
405
405
  ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno, "%s", error_message);
406
406
  free(error_message);
407
407
  return NGX_ERROR;
@@ -430,7 +430,7 @@ init_module(ngx_cycle_t *cycle) {
430
430
  passenger_main_conf.root_dir.len = 0;
431
431
  return NGX_OK;
432
432
  }
433
- passenger_current_cycle = cycle;
433
+ pp_current_cycle = cycle;
434
434
  }
435
435
  return NGX_OK;
436
436
  }
@@ -452,7 +452,7 @@ init_worker_process(ngx_cycle_t *cycle) {
452
452
 
453
453
  core_conf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
454
454
  if (core_conf->master) {
455
- psg_agents_starter_detach(passenger_agents_starter);
455
+ pp_agents_starter_detach(pp_agents_starter);
456
456
  }
457
457
  }
458
458
  return NGX_OK;