passenger 4.0.21 → 4.0.23

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 (39) hide show
  1. checksums.yaml +8 -8
  2. checksums.yaml.gz.asc +7 -7
  3. data.tar.gz.asc +7 -7
  4. data/NEWS +15 -0
  5. data/Rakefile +4 -2
  6. data/bin/passenger-install-apache2-module +10 -0
  7. data/build/debian.rb +9 -3
  8. data/build/test_basics.rb +2 -1
  9. data/debian.template/rules.template +7 -0
  10. data/doc/Users guide Apache.idmap.txt +65 -59
  11. data/doc/Users guide Apache.txt +169 -164
  12. data/doc/Users guide Standalone.idmap.txt +20 -14
  13. data/doc/Users guide Standalone.txt +38 -17
  14. data/doc/Users guide.txt +6 -6
  15. data/doc/users_guide_snippets/deployment_basics.txt +37 -0
  16. data/doc/users_guide_snippets/installation.txt +45 -26
  17. data/doc/users_guide_snippets/tips.txt +2 -2
  18. data/ext/boost/atomic/atomic.hpp +1 -1
  19. data/ext/common/ApplicationPool2/AppTypes.h +1 -1
  20. data/ext/common/ApplicationPool2/Spawner.h +17 -0
  21. data/ext/common/Constants.h +1 -1
  22. data/ext/common/Utils/Dechunker.h +12 -2
  23. data/ext/common/Utils/ProcessMetricsCollector.h +4 -2
  24. data/ext/common/Utils/VariantMap.h +21 -2
  25. data/ext/common/agents/HelperAgent/RequestHandler.cpp +8 -0
  26. data/ext/common/agents/HelperAgent/RequestHandler.h +13 -2
  27. data/ext/common/agents/Watchdog/Main.cpp +91 -2
  28. data/ext/ruby/extconf.rb +9 -0
  29. data/helper-scripts/meteor-loader.rb +10 -1
  30. data/lib/phusion_passenger.rb +1 -1
  31. data/lib/phusion_passenger/console_text_template.rb +4 -2
  32. data/lib/phusion_passenger/platform_info.rb +1 -1
  33. data/lib/phusion_passenger/platform_info/apache_detector.rb +17 -22
  34. data/test/cxx/DechunkerTest.cpp +34 -0
  35. data/test/cxx/ProcessMetricsCollectorTest.cpp +5 -3
  36. data/test/cxx/RequestHandlerTest.cpp +27 -0
  37. data/test/stub/wsgi/passenger_wsgi.py +16 -0
  38. metadata +3 -2
  39. metadata.gz.asc +7 -7
@@ -68,31 +68,37 @@
68
68
 
69
69
  3. Usage => usage-1eyt33o
70
70
 
71
- 4. Troubleshooting => troubleshooting-o7g75o
71
+ 4. Configuration => configuration-10trfau
72
72
 
73
- 4.1. Generic troubleshooting tips => generic-troubleshooting-tips-2vokcr
73
+ 4.1. Command line options => command-line-options-1njv6kt
74
74
 
75
- 4.2. Upon uploading a file, Phusion Passenger reports "client_body_temp/00000000xx failed (2: No such file or directory)" => upon-uploading-a-file-phusion-passenger-reports-client-body-temp-00000000xx-failed-2-no-such-file-or-directory--d01goe
75
+ 4.2. Advanced configuration => advanced-configuration-e3v4pk
76
76
 
77
- 5. Appendix: About environment variables => appendix-about-environment-variables-1ct91x3
77
+ 5. Troubleshooting => troubleshooting-o7g75o
78
78
 
79
- 5.1. Working with environment variables => working-with-environment-variables-11cmwlv
79
+ 5.1. Generic troubleshooting tips => generic-troubleshooting-tips-2vokcr
80
80
 
81
- 5.2. The PATH environment variable => the-path-environment-variable-yzfn3k
81
+ 5.2. Upon uploading a file, Phusion Passenger reports "client_body_temp/00000000xx failed (2: No such file or directory)" => upon-uploading-a-file-phusion-passenger-reports-client-body-temp-00000000xx-failed-2-no-such-file-or-directory--d01goe
82
82
 
83
- 5.2.1. Adding Phusion Passenger’s administration tools to PATH => adding-phusion-passenger-s-administration-tools-to-path-d7k5mh
83
+ 6. Appendix: About environment variables => appendix-about-environment-variables-1ct91x3
84
84
 
85
- 5.3. Making environment variables permanent => making-environment-variables-permanent-mkq46d
85
+ 6.1. Working with environment variables => working-with-environment-variables-11cmwlv
86
86
 
87
- 5.3.1. bash => bash-hmcscc
87
+ 6.2. The PATH environment variable => the-path-environment-variable-yzfn3k
88
88
 
89
- 5.3.2. Apache => apache-15y3bm0
89
+ 6.2.1. Adding Phusion Passenger’s administration tools to PATH => adding-phusion-passenger-s-administration-tools-to-path-d7k5mh
90
90
 
91
- 5.3.3. Nginx => nginx-uarf27
91
+ 6.3. Making environment variables permanent => making-environment-variables-permanent-mkq46d
92
92
 
93
- 5.3.4. cron => cron-6272ar
93
+ 6.3.1. bash => bash-hmcscc
94
94
 
95
- 5.3.5. Phusion Passenger-served apps => phusion-passenger-served-apps-127wbl2
95
+ 6.3.2. Apache => apache-15y3bm0
96
96
 
97
- 5.4. Environment variables and sudo => environment-variables-and-sudo-znzmif
97
+ 6.3.3. Nginx => nginx-uarf27
98
+
99
+ 6.3.4. cron => cron-6272ar
100
+
101
+ 6.3.5. Phusion Passenger-served apps => phusion-passenger-served-apps-127wbl2
102
+
103
+ 6.4. Environment variables and sudo => environment-variables-and-sudo-znzmif
98
104
 
@@ -2,20 +2,13 @@
2
2
 
3
3
  image:images/phusion_banner.png[link="http://www.phusion.nl/"]
4
4
 
5
- Phusion Passenger Standalone is a web server that allows one to run Ruby web applications.
6
- Here are some of the highlights:
5
+ link:https://www.phusionpassenger.com/[Phusion Passenger] is a web server and application server, designed to be fast, robust and lightweight. It runs your web apps with the least amount of hassle by taking care of almost all administrative heavy lifting for you. Advanced administration tools allow you to gain deep insight into your web applications' operations and to keep your servers healthy. Phusion Passenger is polyglot by design, and currently supports Ruby (Rack), Python (WSGI) and Node.js.
7
6
 
8
- - Unlike Phusion Passenger for Apache and Phusion Passenger for Nginx, Phusion Passenger
9
- Standalone does not require an external web server, it is its own and therefore
10
- extremely easy to get started.
11
- - It is powered by an Nginx core. This allows it to serve static files at blazing speeds,
12
- makes it secure enough to be directly attached to port 80, and allows it to handle slow
13
- clients. You don't need to have Nginx already installed.
14
- - Automatically spawns and shuts down application processes. One Phusion Passenger
15
- Standalone instance can therefore handle multiple simultaneous connections and handles
16
- resource management for you. Crashing application processes are automatically restarted.
17
- - Can listen on a Unix socket, for use in reverse proxy setups.
7
+ In the Standalone mode, Phusion Passenger operates as a fully-featured, secure standalone HTTP server. You do not need to have an existing web server like Apache or Nginx. This mode is ideal...
18
8
 
9
+ * ...if you are not familiar with Apache or Nginx
10
+ * ...when you want to quickly start up a server without editing configuration files (e.g. during development)
11
+ * ...or when you want to decouple the web server from the application server, by setting up reverse proxies.
19
12
 
20
13
  == Support information
21
14
 
@@ -36,15 +29,43 @@ Go to your application's root directory, and run:
36
29
  passenger start
37
30
  ------------------------------
38
31
 
39
- This will start Phusion Passenger on port 3000. If you want to run it on a different port,
40
- use the `-p` option, e.g.:
32
+ == Configuration
41
33
 
42
- ------------------------------
43
- passenger start -p 8000
44
- ------------------------------
34
+ === Command line options
35
+
36
+ Most configuration is done by customizing the arguments passed to the `passenger` command. The most important ones are:
37
+
38
+ `--port NUMBER`::
39
+ The port number that Phusion Passenger should listen on. Defaults to 3000.
40
+ `--environment NAME`::
41
+ Customizes the value of the `RAILS_ENV`, `RACK_ENV` and `PASSENGER_ENV` environment variable. The default is "development".
42
+ `--max-pool-size NUMBER`::
43
+ The maximum number of application processes to run. The maximum number that you can run depends on the amount of memory your server has. The article link:http://blog.phusion.nl/2013/03/12/tuning-phusion-passengers-concurrency-settings/[Tuning Phusion Passenger's concurrency settings] explains how you can infer a good number for this option.
44
+ `--min-instances NUMBER`::
45
+ If you don't want the number of application processes to scale dynamically, then use this option to set it to a value equal to `--max-pool-size`.
46
+ `--spawn-method NAME`::
47
+ When set to "smart" (the default), Phusion Passenger preloads your app and utilizes copy-on-write in order to save memory. You can disable this by setting this option to "direct". Preloading is only supported for Ruby apps. For apps written in other languages, it is as if "direct" is always used.
48
+ `--no-friendly-error-pages`::
49
+ If your app fails to start, Phusion Passenger will tell you by showing a friendly error page in the browser. This option disables it.
45
50
 
46
51
  See `--help` for all available options.
47
52
 
53
+ === Advanced configuration
54
+
55
+ Phusion Passenger Standalone is built on the same technology that powers link:Users%20guide%20Nginx.html[Phusion Passenger for Nginx], so any configuration option supported by Phusion Passenger for Nginx can be applied to Standalone as well. You can do this by editing the Standalone configuration template directly.
56
+
57
+ First, go to the directory where Phusion Passenger is installed:
58
+
59
+ -------------------------------------
60
+ cd $(passenger-config --root)
61
+ -------------------------------------
62
+
63
+ Then open the file `resources/templates/standalone/config.erb`.
64
+
65
+ NOTE: If you installed Phusion Passenger using the Debian or Ubuntu packages, then the filename is `/usr/share/passenger/templates/standalone/config.erb` or `/usr/share/passenger-enterprise/templates/standalone/config.erb`.
66
+
67
+ Please note that changes to this file only last until you reinstall or upgrade Phusion Passenger. We are currently working on a mechanism for permanently editing the configuration file.
68
+
48
69
 
49
70
  [[troubleshooting]]
50
71
  == Troubleshooting
@@ -14,13 +14,13 @@ Phusion Passenger has several integration modes, each mode with its own document
14
14
 
15
15
  In this mode, Phusion Passenger integrates directly into Nginx as an Nginx module. You operate Phusion Passenger mostly through Nginx and through Nginx configuration files. The Nginx integration mode is, along with the Standalone mode, highly optimized for performance.
16
16
 
17
- link:Users%20Guide%20Nginx.html[**Read the documentation for the Nginx integration mode >>**]
17
+ link:Users%20guide%20Nginx.html[**Read the documentation for the Nginx integration mode >>**]
18
18
 
19
19
  === Apache integration mode
20
20
 
21
21
  In this mode, Phusion Passenger integrates directly into Apache as an Apache module. You operate Phusion Passenger mostly through Apache and through Apache configuration files.
22
22
 
23
- link:Users%20Guide%20Apache.html[**Read the documentation for the Apache integration mode >>**]
23
+ link:Users%20guide%20Apache.html[**Read the documentation for the Apache integration mode >>**]
24
24
 
25
25
  === Standalone mode
26
26
 
@@ -32,16 +32,16 @@ In this mode, Phusion Passenger operates as a fully-featured, secure standalone
32
32
 
33
33
  Along with the Nginx mode, the Standalone mode is highly optimized for performance.
34
34
 
35
- link:Users%20Guide%20Standalone.html[**Read the documentation for the Standalone mode >>**]
35
+ link:Users%20guide%20Standalone.html[**Read the documentation for the Standalone mode >>**]
36
36
 
37
37
  [[installation]]
38
38
  == Installation and upgrade
39
39
 
40
40
  Please refer to:
41
41
 
42
- * link:Users%20Guide%20Nginx.html#installation[**Nginx** mode installation & upgrade]
43
- * link:Users%20Guide%20Apache.html#installation[**Apache** mode installation & upgrade]
44
- * link:Users%20Guide%20Standalone.html#installation[**Standalone** mode installation & upgrade]
42
+ * link:Users%20guide%20Nginx.html#installation[**Nginx** mode installation & upgrade]
43
+ * link:Users%20guide%20Apache.html#installation[**Apache** mode installation & upgrade]
44
+ * link:Users%20guide%20Standalone.html#installation[**Standalone** mode installation & upgrade]
45
45
 
46
46
  [[support]]
47
47
  == Where to get support
@@ -0,0 +1,37 @@
1
+ == Deploying a web application: the basics
2
+
3
+ === Anatomy of a web application
4
+
5
+ ==== Ruby
6
+
7
+ ==== Python
8
+
9
+ ===== Django
10
+
11
+ For Django >= 1.4, `passenger_wsgi.py` should contain the following. Replace "mysite" with your application's actual module name.
12
+
13
+ --------------------------------------------------------------------
14
+ from mysite.wsgi import application
15
+ --------------------------------------------------------------------
16
+
17
+ For earlier Django versions, it should contain:
18
+
19
+ --------------------------------------------------------------------
20
+ import os
21
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
22
+
23
+ from django.core.wsgi import get_wsgi_application
24
+ application = get_wsgi_application()
25
+ --------------------------------------------------------------------
26
+
27
+ ==== Node.js
28
+
29
+ === Attaching to a virtual host's root URI
30
+
31
+ === Attaching to a sub-URI
32
+
33
+ ==== How to fix broken images/CSS/JavaScript URIs in sub-URI deployments
34
+
35
+ === Restarting the web application
36
+
37
+ === Inspecting the status
@@ -63,46 +63,59 @@ If you use these packages to install Phusion Passenger then you do not need to r
63
63
 
64
64
  Packages are available for the x86 and x86_64 architectures. Our policy is to support all Ubuntu LTS releases that are still supported by Canonical, plus the latest non-LTS Ubuntu release, plus all Debian releases that are still supported by Debian.
65
65
 
66
+ [[install_add_apt_repo]]
66
67
  ==== Adding our APT repository
67
68
 
68
- Packages are signed by "Phusion Automated Software Signing (auto-software-signing@phusion.nl)", fingerprint 1637 8A33 A6EF 1676 2922 526E 561F 9B9C AC40 B2F7. Install our PGP key:
69
-
69
+ 1. Install our PGP key. Packages are signed by "Phusion Automated Software Signing (auto-software-signing@phusion.nl)", fingerprint 1637 8A33 A6EF 1676 2922 526E 561F 9B9C AC40 B2F7.
70
+ +
70
71
  --------------------------------------------------------------
71
72
  sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7
72
73
  --------------------------------------------------------------
73
74
 
74
- Our APT repository is stored on an HTTPS server so you may need to add HTTPS support for APT:
75
-
75
+ 2. Add HTTPS support for APT. Our APT repository is stored on an HTTPS server.
76
+ +
76
77
  --------------------------------------------------------------
77
78
  sudo apt-get install apt-transport-https
78
79
  --------------------------------------------------------------
79
80
 
80
- Next, create a file `/etc/apt/sources.list.d/passenger.list` and insert one of the following lines, depending on your distribution.
81
-
82
- Phusion Passenger open source:
83
-
81
+ 3. Create a file `/etc/apt/sources.list.d/passenger.list` and insert one of the following lines, depending on your distribution.
82
+ +
83
+ **Open source**:::
84
+ +
85
+ [source,sh]
84
86
  --------------------------------------------------------------
85
- deb https://oss-binaries.phusionpassenger.com/apt/passenger lucid main
86
- deb https://oss-binaries.phusionpassenger.com/apt/passenger precise main
87
+ # Ubuntu 13.10
87
88
  deb https://oss-binaries.phusionpassenger.com/apt/passenger saucy main
88
- deb https://oss-binaries.phusionpassenger.com/apt/passenger squeeze main
89
+ # Ubuntu 12.04
90
+ deb https://oss-binaries.phusionpassenger.com/apt/passenger precise main
91
+ # Ubuntu 10.04
92
+ deb https://oss-binaries.phusionpassenger.com/apt/passenger lucid main
93
+ # Debian 7
89
94
  deb https://oss-binaries.phusionpassenger.com/apt/passenger wheezy main
95
+ # Debian 6
96
+ deb https://oss-binaries.phusionpassenger.com/apt/passenger squeeze main
90
97
  --------------------------------------------------------------
91
-
92
- Phusion Passenger Enterprise:
93
-
98
+ +
99
+ **Enterprise**:::
100
+ +
101
+ [source,sh]
94
102
  --------------------------------------------------------------
95
- deb https://YOUR_ORDER_REFERENCE:YOUR_PASSWORD@www.phusionpassenger.com/enterprise_apt lucid main
96
- deb https://YOUR_ORDER_REFERENCE:YOUR_PASSWORD@www.phusionpassenger.com/enterprise_apt precise main
103
+ # Ubuntu 13.10
97
104
  deb https://YOUR_ORDER_REFERENCE:YOUR_PASSWORD@www.phusionpassenger.com/enterprise_apt saucy main
98
- deb https://YOUR_ORDER_REFERENCE:YOUR_PASSWORD@www.phusionpassenger.com/enterprise_apt squeeze main
105
+ # Ubuntu 12.04
106
+ deb https://YOUR_ORDER_REFERENCE:YOUR_PASSWORD@www.phusionpassenger.com/enterprise_apt precise main
107
+ # Ubuntu 10.04
108
+ deb https://YOUR_ORDER_REFERENCE:YOUR_PASSWORD@www.phusionpassenger.com/enterprise_apt lucid main
109
+ # Debian 7
99
110
  deb https://YOUR_ORDER_REFERENCE:YOUR_PASSWORD@www.phusionpassenger.com/enterprise_apt wheezy main
111
+ # Debian 6
112
+ deb https://YOUR_ORDER_REFERENCE:YOUR_PASSWORD@www.phusionpassenger.com/enterprise_apt squeeze main
100
113
  --------------------------------------------------------------
101
-
114
+ +
102
115
  Please replace 'YOUR_ORDER_REFERENCE' and 'YOUR_PASSWORD' with your link:https://www.phusionpassenger.com/orders[Customer Area] login credentials.
103
116
 
104
- After creating `/etc/apt/sources.list.d/passenger.list`, run:
105
-
117
+ 4. Secure `passenger.list` and update your APT cache:
118
+ +
106
119
  --------------------------------------------------------------
107
120
  sudo chown root: /etc/apt/sources.list.d/passenger.list
108
121
  sudo chmod 600 /etc/apt/sources.list.d/passenger.list
@@ -113,25 +126,30 @@ sudo apt-get update
113
126
 
114
127
  **Open source**::
115
128
  +
129
+ 1. <<install_add_apt_repo,Add our APT repository.>>
116
130
  ifdef::nginx[]
117
- 1. Install the packages:
131
+ 2. Install the packages:
118
132
  +
119
133
  --------------------------------------------------------------
120
134
  sudo apt-get install nginx-full passenger
121
135
  --------------------------------------------------------------
122
- 2. Edit `/etc/nginx/nginx.conf` and uncomment `passenger_root` and `passenger_ruby`.
123
- 3. Restart Nginx:
136
+ 3. Edit `/etc/nginx/nginx.conf` and uncomment `passenger_root` and `passenger_ruby`.
137
+ 4. Restart Nginx:
124
138
  +
125
139
  --------------------------------------------------------------
126
140
  sudo service nginx restart
127
141
  --------------------------------------------------------------
128
142
  endif::[]
129
143
  ifdef::apache[]
144
+ 2. Install the package:
145
+ +
130
146
  --------------------------------------------------------------
131
147
  sudo apt-get install libapache2-mod-passenger
132
148
  --------------------------------------------------------------
133
149
  endif::[]
134
150
  ifdef::standalone[]
151
+ 2. Install the package:
152
+ +
135
153
  --------------------------------------------------------------
136
154
  sudo apt-get install passenger
137
155
  --------------------------------------------------------------
@@ -140,14 +158,15 @@ endif::[]
140
158
  **Enterprise**::
141
159
  +
142
160
  1. Download your license key from the link:https://www.phusionpassenger.com/orders[Customer Area] and save it as `/etc/passenger-enterprise-license`.
143
- 2. Install the packages:
161
+ 2. <<install_add_apt_repo,Add our APT repository.>>
162
+ 3. Install the packages:
144
163
  +
145
164
  ifdef::nginx[]
146
165
  --------------------------------------------------------------
147
166
  sudo apt-get install nginx-full passenger-enterprise
148
167
  --------------------------------------------------------------
149
- 3. Edit `/etc/nginx/nginx.conf` and uncomment `passenger_root` and `passenger_ruby`.
150
- 4. Restart Nginx:
168
+ 4. Edit `/etc/nginx/nginx.conf` and uncomment `passenger_root` and `passenger_ruby`.
169
+ 5. Restart Nginx:
151
170
  +
152
171
  --------------------------------------------------------------
153
172
  sudo service nginx restart
@@ -336,12 +336,12 @@ Applications can use Out-of-Band Work as follows:
336
336
  ifdef::apache[]
337
337
  <<PassengerMaxPoolSize,PassengerMaxPoolSize>>
338
338
  and
339
- <<PassengerMaxInstances,PassengerMaxInstances>>
339
+ <<PassengerMinInstances,PassengerMinInstances>>
340
340
  endif::[]
341
341
  ifdef::nginx[]
342
342
  <<PassengerMaxPoolSize,passenger_max_pool_size>>
343
343
  and
344
- <<PassengerMaxInstances,passenger_max_instances>>
344
+ <<PassengerMinInstances,passenger_min_instances>>
345
345
  endif::[]
346
346
  are both larger than 1. Out-of-band work only works if there are at least 2 application processes.
347
347
  2. Request out-of-band work by outputting the `X-Passenger-Request-OOB-Work` header during a request. It does not matter what the value is. At this time, it is not possible to request out-of-band work from outside requests.
@@ -194,7 +194,7 @@ typedef atomic<std::ptrdiff_t> atomic_ptrdiff_t;
194
194
  #if !defined(__PGIC__)
195
195
 
196
196
  #if (defined(BOOST_WINDOWS) && !defined(_WIN32_WCE)) \
197
- || (defined(_XOPEN_UNIX) && (_XOPEN_UNIX+0 > 0) && !defined(__UCLIBC__)) \
197
+ || (defined(_XOPEN_UNIX) && (_XOPEN_UNIX+0 > 0) && !defined(__UCLIBC__) && !defined(__GLIBC__)) \
198
198
  || defined(__CYGWIN__) \
199
199
  || defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) \
200
200
  || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
@@ -110,7 +110,7 @@ private:
110
110
  TRACE_POINT();
111
111
  throw RuntimeException("Not enough buffer space");
112
112
  }
113
- return fileExists(StaticString(buf, pos - buf), cstat, throttleRate);
113
+ return getFileType(StaticString(buf, pos - buf), cstat, throttleRate) != FT_NONEXISTANT;
114
114
  }
115
115
 
116
116
  public:
@@ -89,6 +89,7 @@
89
89
  #include <Utils/IOUtils.h>
90
90
  #include <Utils/StrIntUtils.h>
91
91
  #include <Utils/Base64.h>
92
+ #include <Utils/ProcessMetricsCollector.h>
92
93
 
93
94
  namespace tut {
94
95
  struct ApplicationPool2_DirectSpawnerTest;
@@ -497,6 +498,22 @@ private:
497
498
  SpawnException::APP_STARTUP_PROTOCOL_ERROR,
498
499
  details);
499
500
  }
501
+ } else if (key == "pid") {
502
+ // pid: <PID>
503
+ pid_t pid = atoi(value);
504
+ ProcessMetricsCollector collector;
505
+ vector<pid_t> pids;
506
+
507
+ pids.push_back(pid);
508
+ ProcessMetricMap result = collector.collect(pids);
509
+ if (result[pid].uid != details.preparation->uid) {
510
+ throwAppSpawnException("An error occurred while starting the "
511
+ "web application. The PID that the loader has returned does "
512
+ "not have the same UID as the loader itself.",
513
+ SpawnException::APP_STARTUP_PROTOCOL_ERROR,
514
+ details);
515
+ }
516
+ details.pid = pid;
500
517
  } else {
501
518
  throwAppSpawnException("An error occurred while starting the "
502
519
  "web application. It sent an unknown startup response line "
@@ -78,7 +78,7 @@
78
78
 
79
79
  #define NGINX_DOC_URL "http://www.modrails.com/documentation/Users%20guide%20Nginx.html"
80
80
 
81
- #define PASSENGER_VERSION "4.0.21"
81
+ #define PASSENGER_VERSION "4.0.23"
82
82
 
83
83
  #define POOL_HELPER_THREAD_STACK_SIZE 262144
84
84
 
@@ -27,7 +27,8 @@ using namespace std;
27
27
  */
28
28
  class Dechunker {
29
29
  public:
30
- typedef void (*Callback)(const char *data, size_t size, void *userData);
30
+ typedef void (*DataCallback)(const char *data, size_t size, void *userData);
31
+ typedef void (*Callback)(void *userData);
31
32
 
32
33
  private:
33
34
  static const char CR = '\x0D';
@@ -71,13 +72,21 @@ private:
71
72
  onData(data, size, userData);
72
73
  }
73
74
  }
75
+
76
+ void emitEndEvent() const {
77
+ if (onEnd != NULL) {
78
+ onEnd(userData);
79
+ }
80
+ }
74
81
 
75
82
  public:
76
- Callback onData;
83
+ DataCallback onData;
84
+ Callback onEnd;
77
85
  void *userData;
78
86
 
79
87
  Dechunker() {
80
88
  onData = NULL;
89
+ onEnd = NULL;
81
90
  userData = NULL;
82
91
  reset();
83
92
  }
@@ -198,6 +207,7 @@ public:
198
207
 
199
208
  case EXPECTING_FINAL_LF:
200
209
  if (*current == LF) {
210
+ emitEndEvent();
201
211
  state = DONE;
202
212
  current++;
203
213
  } else {