passenger 4.0.44 → 4.0.45
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.
- checksums.yaml +8 -8
- checksums.yaml.gz.asc +7 -7
- data.tar.gz.asc +7 -7
- data/.travis.yml +3 -0
- data/CHANGELOG +31 -0
- data/CONTRIBUTING.md +70 -10
- data/CONTRIBUTORS +4 -0
- data/README.md +1 -1
- data/Vagrantfile +50 -0
- data/bin/passenger-install-nginx-module +7 -2
- data/build/basics.rb +4 -1
- data/build/documentation.rb +6 -0
- data/build/node_tests.rb +7 -1
- data/build/packaging.rb +5 -0
- data/build/test_basics.rb +3 -3
- data/debian.template/copyright +1 -1
- data/debian.template/passenger.manpages +0 -1
- data/dev/rack.test/config.ru +5 -0
- data/dev/rack.test/public/asset.txt +1 -0
- data/dev/vagrant/apache_default_site.conf +35 -0
- data/dev/vagrant/apache_passenger.conf +5 -0
- data/dev/vagrant/apache_passenger.load +1 -0
- data/dev/vagrant/apache_ports.conf +24 -0
- data/dev/vagrant/apache_rack_test.conf +9 -0
- data/dev/vagrant/bashrc +21 -0
- data/dev/vagrant/nginx.conf +39 -0
- data/dev/vagrant/nginx_rakefile +34 -0
- data/dev/vagrant/nginx_start +32 -0
- data/dev/vagrant/provision.sh +115 -0
- data/dev/vagrant/sudoers.conf +5 -0
- data/doc/Design and Architecture.txt +515 -0
- data/doc/DeveloperQuickstart.md +70 -0
- data/doc/Users guide Apache.idmap.txt +24 -18
- data/doc/Users guide Apache.txt +200 -62
- data/doc/Users guide Nginx.idmap.txt +53 -45
- data/doc/Users guide Nginx.txt +501 -360
- data/doc/Users guide Standalone.txt +8 -0
- data/doc/images/direct_spawning.png +0 -0
- data/doc/images/direct_spawning.svg +16 -13
- data/doc/images/helper_agent_core_architecture.png +0 -0
- data/doc/images/passenger_architecture_overview.png +0 -0
- data/doc/images/smart_spawning.png +0 -0
- data/doc/images/{smart.svg → smart_spawning.svg} +23 -20
- data/doc/images/spawning_preparation_work.png +0 -0
- data/doc/images/startup_sequence.png +0 -0
- data/doc/users_guide_snippets/appendix_c_spawning_methods.txt +82 -121
- data/doc/users_guide_snippets/environment_variables.txt +1 -1
- data/doc/users_guide_snippets/support_information.txt +2 -0
- data/doc/users_guide_snippets/tips.txt +117 -9
- data/ext/apache2/Configuration.hpp +4 -2
- data/ext/apache2/ConfigurationCommands.cpp +14 -0
- data/ext/apache2/ConfigurationFields.hpp +4 -0
- data/ext/apache2/ConfigurationSetters.cpp +22 -0
- data/ext/apache2/CreateDirConfig.cpp +2 -0
- data/ext/apache2/Hooks.cpp +30 -14
- data/ext/apache2/MergeDirConfig.cpp +14 -0
- data/ext/apache2/SetHeaders.cpp +8 -0
- data/ext/common/ApplicationPool2/AppTypes.cpp +6 -1
- data/ext/common/ApplicationPool2/Implementation.cpp +1 -1
- data/ext/common/ApplicationPool2/Session.h +1 -1
- data/ext/common/Constants.h +9 -7
- data/ext/common/Utils/HttpHeaderBufferer.h +23 -4
- data/ext/common/Utils/StrIntUtils.h +35 -0
- data/ext/common/Utils/StringScanning.h +4 -10
- data/ext/common/agents/HelperAgent/RequestHandler.h +90 -49
- data/ext/nginx/CacheLocationConfig.c +40 -0
- data/ext/nginx/ConfigurationCommands.c +20 -0
- data/ext/nginx/ConfigurationFields.h +4 -0
- data/ext/nginx/ContentHandler.c +1 -1
- data/ext/nginx/CreateLocationConfig.c +9 -0
- data/ext/nginx/MergeLocationConfig.c +12 -0
- data/ext/nginx/config +2 -2
- data/ext/nginx/ngx_http_passenger_module.c +4 -4
- data/helper-scripts/node-loader.js +40 -27
- data/lib/phusion_passenger.rb +1 -1
- data/lib/phusion_passenger/apache2/config_options.rb +14 -2
- data/lib/phusion_passenger/constants.rb +7 -6
- data/lib/phusion_passenger/loader_shared_helpers.rb +11 -1
- data/lib/phusion_passenger/nginx/config_options.rb +8 -0
- data/lib/phusion_passenger/packaging.rb +8 -3
- data/lib/phusion_passenger/platform_info/apache.rb +3 -0
- data/lib/phusion_passenger/platform_info/ruby.rb +4 -1
- data/lib/phusion_passenger/standalone/command.rb +0 -1
- data/lib/phusion_passenger/standalone/package_runtime_command.rb +1 -0
- data/lib/phusion_passenger/standalone/start_command.rb +80 -62
- data/lib/phusion_passenger/standalone/status_command.rb +1 -0
- data/lib/phusion_passenger/standalone/stop_command.rb +1 -0
- data/man/passenger-config.1 +1 -1
- data/man/passenger-memory-stats.8 +1 -1
- data/man/passenger-status.8 +1 -1
- data/npm-shrinkwrap.json +229 -0
- data/package.json +28 -0
- data/resources/templates/standalone/config.erb +2 -0
- data/rpm/Vagrantfile +0 -3
- data/test/config.json.vagrant +30 -0
- data/test/cxx/HttpHeaderBuffererTest.cpp +64 -10
- data/test/cxx/RequestHandlerTest.cpp +35 -13
- data/test/integration_tests/apache2_tests.rb +1 -0
- data/test/stub/node/app.js +26 -18
- metadata +28 -13
- metadata.gz.asc +7 -7
- data/doc/Architectural overview.idmap.txt +0 -36
- data/doc/Architectural overview.txt +0 -410
- data/doc/images/smart.png +0 -0
- data/ext/common/ApplicationPool2/README.md +0 -56
- data/man/passenger-stress-test.1 +0 -43
- data/node_lib/phusion_passenger/httplib_emulation.js +0 -215
- data/node_lib/phusion_passenger/request_handler.js +0 -73
- data/node_lib/phusion_passenger/session_protocol_parser.js +0 -113
- data/test/node/httplib_emulation_spec.js +0 -623
@@ -190,7 +190,7 @@ If you installed Nginx through <<install_on_debian_ubuntu,the Debian or Ubuntu p
|
|
190
190
|
|
191
191
|
Otherwise, environment variables are best set through the script which starts Nginx. For example, if you installed Nginx from source and you used
|
192
192
|
ifdef::apache[]
|
193
|
-
the Nginx init script described in the link:
|
193
|
+
the Nginx init script described in the link:Users%20guide%20Nginx.html[Phusion Passenger Users Guide, Nginx version],
|
194
194
|
endif::apache[]
|
195
195
|
ifdef::nginx[]
|
196
196
|
<<nginx_init_script,the Nginx init script described earlier in this manual>>,
|
@@ -511,8 +511,14 @@ Extra environment variables: `PASSENGER_APP_ROOT`.
|
|
511
511
|
|
512
512
|
[[flying_passenger]]
|
513
513
|
=== Flying Passenger
|
514
|
+
ifdef::apache[]
|
515
|
+
:version: 4.0.45
|
516
|
+
include::enterprise_only.txt[]
|
517
|
+
endif::apache[]
|
518
|
+
ifdef::nginx[]
|
514
519
|
:version: 4.0.6
|
515
520
|
include::enterprise_only.txt[]
|
521
|
+
endif::nginx[]
|
516
522
|
|
517
523
|
Flying Passenger allows one to decouple Phusion Passenger's life time from the web server's life time, so that the web server can be independently restarted from Phusion Passenger, and from any of the application processes served by Phusion Passenger.
|
518
524
|
|
@@ -526,7 +532,14 @@ This problem is solved by 'Flying Passenger', which is an advanced mode of opera
|
|
526
532
|
|
527
533
|
==== Requirements
|
528
534
|
|
529
|
-
|
535
|
+
Before you can use the Flying Passenger feature, you must have Phusion Passenger for
|
536
|
+
ifdef::apache[]
|
537
|
+
Apache
|
538
|
+
endif::apache[]
|
539
|
+
ifdef::nginx[]
|
540
|
+
Nginx
|
541
|
+
endif::nginx[]
|
542
|
+
properly installed.
|
530
543
|
|
531
544
|
==== Basic usage
|
532
545
|
|
@@ -542,7 +555,16 @@ I, [2013-06-14T09:10:13.129017 #77179] INFO -- : PassengerWatchdog initialized
|
|
542
555
|
I, [2013-06-14T09:10:13.129127 #77179] INFO -- : Flying Passenger up and listening on /var/run/flying-passenger.sock!
|
543
556
|
-------------------
|
544
557
|
|
545
|
-
Now configure
|
558
|
+
Now configure the web server to make use of the Flying Passenger daemon,
|
559
|
+
ifdef::apache[]
|
560
|
+
by setting the `PassengerFlyWith` option to the socket filename:
|
561
|
+
|
562
|
+
-------------------
|
563
|
+
PassengerFlyWith /var/run/flying-passenger.sock
|
564
|
+
-------------------
|
565
|
+
endif::apache[]
|
566
|
+
ifdef::nginx[]
|
567
|
+
by setting the `passenger_fly_with` option to the socket filename:
|
546
568
|
|
547
569
|
-------------------
|
548
570
|
http {
|
@@ -551,15 +573,36 @@ http {
|
|
551
573
|
...
|
552
574
|
}
|
553
575
|
-------------------
|
576
|
+
endif::nginx[]
|
554
577
|
|
555
|
-
After (re)starting
|
578
|
+
After (re)starting
|
579
|
+
ifdef::apache[]
|
580
|
+
Apache, Apache + Flying Passenger is fully operational:
|
581
|
+
|
582
|
+
-------------------
|
583
|
+
$ sudo service apache2 restart
|
584
|
+
-------------------
|
585
|
+
endif::apache[]
|
586
|
+
ifdef::nginx[]
|
587
|
+
Nginx, Nginx + Flying Passenger is fully operational:
|
556
588
|
|
557
589
|
-------------------
|
558
590
|
$ sudo /path-to/nginx
|
559
591
|
-------------------
|
592
|
+
endif::nginx[]
|
593
|
+
Flying Passenger is fully operational:
|
560
594
|
|
561
595
|
You can test it by adding a virtual host for a web app:
|
562
596
|
|
597
|
+
ifdef::apache[]
|
598
|
+
-------------------
|
599
|
+
<VirtualHost *:80>
|
600
|
+
ServerName www.foo.local
|
601
|
+
DocumentRoot /webapps/foo/public
|
602
|
+
</VirtualHost>
|
603
|
+
-------------------
|
604
|
+
endif::apache[]
|
605
|
+
ifdef::nginx[]
|
563
606
|
-------------------
|
564
607
|
http {
|
565
608
|
...
|
@@ -572,6 +615,7 @@ http {
|
|
572
615
|
}
|
573
616
|
}
|
574
617
|
-------------------
|
618
|
+
endif::nginx[]
|
575
619
|
|
576
620
|
Verify that it works by making an HTTP request to it:
|
577
621
|
|
@@ -598,13 +642,21 @@ Requests in top-level queue : 0
|
|
598
642
|
CPU: 1% Memory : 8M Last used: 2s ago
|
599
643
|
---------------------------------
|
600
644
|
|
601
|
-
As you can see, the PID of the application process is **77283**. Now let's see what happens if we restart
|
645
|
+
As you can see, the PID of the application process is **77283**. Now let's see what happens if we restart the web server:
|
602
646
|
|
647
|
+
ifdef::apache[]
|
648
|
+
------------------------
|
649
|
+
$ sudo service apache2 restart
|
650
|
+
$ sudo passenger-status
|
651
|
+
------------------------
|
652
|
+
endif::apache[]
|
653
|
+
ifdef::nginx[]
|
603
654
|
------------------------
|
604
655
|
$ sudo /path-to/nginx -s stop
|
605
656
|
$ sudo /path-to/nginx
|
606
657
|
$ sudo passenger-status
|
607
658
|
------------------------
|
659
|
+
endif::nginx[]
|
608
660
|
|
609
661
|
The application process should remain there, unchanged:
|
610
662
|
|
@@ -628,9 +680,23 @@ Requests in top-level queue : 0
|
|
628
680
|
[[configuring_flying_passenger]]
|
629
681
|
==== Configuring Flying Passenger
|
630
682
|
|
631
|
-
Flying Passenger gets *some* configuration from the web server, but not all. In particular, most web server directives that are only valid in the
|
683
|
+
Flying Passenger gets *some* configuration from the web server, but not all. In particular, most web server directives that are only valid in the
|
684
|
+
ifdef::apache[]
|
685
|
+
global context, e.g. <<PassengerLogLevel,PassengerLogLevel>>,
|
686
|
+
endif::apache[]
|
687
|
+
ifdef::nginx[]
|
688
|
+
`http` context, e.g. <<PassengerLogLevel,passenger_log_level>>,
|
689
|
+
endif::nginx[]
|
690
|
+
have no effect when using Flying Passenger. Instead, you are supposed to pass these configuration directives through command line options to the Flying Passenger daemon. Configuration directives that have no effect on Flying Passenger are documented as such. You can assume that configuration directives that are not documented as such, work fine on Flying Passenger.
|
632
691
|
|
633
|
-
For example, to achieve the same effect as setting
|
692
|
+
For example, to achieve the same effect as setting
|
693
|
+
ifdef::apache[]
|
694
|
+
`PassengerLogLevel`
|
695
|
+
endif::apache[]
|
696
|
+
ifdef::nginx[]
|
697
|
+
`passenger_log_level`
|
698
|
+
endif::nginx[]
|
699
|
+
to 2, run the Flying Passenger daemon as follows:
|
634
700
|
|
635
701
|
----------------------------------
|
636
702
|
$ sudo flying-passenger --socket-file=/var/run/flying-passenger.sock --log-level=2
|
@@ -681,8 +747,23 @@ Using Flying Passenger in combination with MRI Ruby 1.8 or with JRuby requires s
|
|
681
747
|
|
682
748
|
It is however possible to use Flying Passenger with MRI Ruby 1.8 and JRuby. You can't run the Flying Passenger daemon in MRI 1.8 or JRuby, but you can still run the web applications - hosted under Flying Passenger - in MRI 1.8 or JRuby.
|
683
749
|
|
684
|
-
First, edit your
|
750
|
+
First, edit your web server configuration file and specify a Ruby interpreter for your web applications. For example:
|
751
|
+
|
752
|
+
ifdef::apache[]
|
753
|
+
--------------------
|
754
|
+
# Connect to the Flying Passenger daemon on the following socket
|
755
|
+
PassengerFlyWith /var/run/flying-passenger.sock
|
756
|
+
...
|
685
757
|
|
758
|
+
<VirtualHost *:80>
|
759
|
+
ServerName www.foo.com
|
760
|
+
DocumentRoot /webapps/foo/public
|
761
|
+
# Use JRuby for this web application
|
762
|
+
PassengerRuby /opt/jruby/bin/jruby
|
763
|
+
</VirtualHost>
|
764
|
+
--------------------
|
765
|
+
endif::apache[]
|
766
|
+
ifdef::nginx[]
|
686
767
|
--------------------
|
687
768
|
# Connect to the Flying Passenger daemon on the following socket
|
688
769
|
passenger_fly_with /var/run/flying-passenger.sock;
|
@@ -697,6 +778,7 @@ server {
|
|
697
778
|
passenger_ruby /opt/jruby/bin/jruby;
|
698
779
|
}
|
699
780
|
--------------------
|
781
|
+
endif::nginx[]
|
700
782
|
|
701
783
|
Then you need to install a Ruby 1.9-compatible Ruby interpeter with POSIX spawn support, alongside JRuby/MRI 1.8. Ruby interpreters which can be used for running the Flying Passenger daemon include:
|
702
784
|
|
@@ -732,10 +814,36 @@ The Flying Passenger daemon will now be run on Ruby 1.9, while the web applicati
|
|
732
814
|
|
733
815
|
Beware of the following caveats and limitations when using Flying Passenger:
|
734
816
|
|
817
|
+
ifdef::apache[]
|
818
|
+
- The Phusion Passenger module that is loaded into Apache, **must** be of the same version as the Flying Passenger daemon. Failing to meet this requirement may result in cryptic errors, or may result in certain features not working, until you've fixed the situation. When upgrading Phusion Passenger, you must restart both Apache and the Flying Passenger daemon.
|
819
|
+
- The <<PassengerRoot,PassengerRoot>> directive has no effect. When using Flying Passenger, you are not supposed to set `PassengerRoot`.
|
820
|
+
endif::apache[]
|
821
|
+
ifdef::nginx[]
|
735
822
|
- The Nginx executable **must** be compiled with the same version of Phusion Passenger as the Flying Passenger daemon. Failing to meet this requirement may result in cryptic errors, or may result in certain features not working, until you've fixed the situation. When upgrading Phusion Passenger, you must restart both Nginx and the Flying Passenger daemon.
|
736
823
|
- The <<PassengerRoot,passenger_root>> directive has no effect. When using Flying Passenger, you are not supposed to set `passenger_root`.
|
824
|
+
endif::nginx[]
|
737
825
|
- The Flying Passenger daemon is written in Ruby. It requires a Ruby interpreter with proper `Process#spawn` support. At the time of writing, all Ruby interpreters in existance satisfy this requirement, except for MRI Ruby 1.8 and JRuby. See <<using_flying_passenger_with_mri_18_or_jruby,Using Flying Passenger with MRI 1.8 or JRuby>> for more information.
|
738
|
-
- When you add a new application to the web server configuration, Flying Passenger will automatically pick up the application's settings and spawn this new application upon the first request to it. However it is not capable of automatically starting the new app before a request has been sent to it (i.e.
|
739
|
-
|
826
|
+
- When you add a new application to the web server configuration, Flying Passenger will automatically pick up the application's settings and spawn this new application upon the first request to it. However it is not capable of automatically starting the new app before a request has been sent to it (i.e.
|
827
|
+
ifdef::apache[]
|
828
|
+
<<PassengerPreStart,PassengerPreStart>>-like
|
829
|
+
endif::apache[]
|
830
|
+
ifdef::nginx[]
|
831
|
+
<<PassengerPreStart,passenger_pre_start>>-like
|
832
|
+
endif::nginx[]
|
833
|
+
behavior is not available in this case). As a workaround, you can send an HTTP request to your application after starting the daemon, which forces it to spawn application processes.
|
834
|
+
- When you remove an application from the web server configuration, Flying Passenger will not detect the removal and will not shut down the associated application processes. Killing the application processes will also not help, because Flying Passenger will restart them per the (now-removed, but still in the Flying Passenger daemon's memory)
|
835
|
+
ifdef::apache[]
|
836
|
+
<<PassengerMinInstances,PassengerMinInstances>>
|
837
|
+
endif::apache[]
|
838
|
+
ifdef::nginx[]
|
839
|
+
<<PassengerMinInstances,passenger_min_instances>>
|
840
|
+
endif::nginx[]
|
841
|
+
settings. At the moment, there are two ways to get rid of those processes:
|
842
|
+
+
|
843
|
+
ifdef::apache[]
|
844
|
+
* Before removing the application from the web server configuration, explicitly set its `PassengerMinInstances` to 0. Next, send a request to it, which will cause the Flying Passenger daemon to take over the new `PassengerMinInstances 0` option. You can then proceed with removing the application from the web server configuration, and restarting the web server. Finally, kill the PIDs associated to those application processes and remove the application configuration.
|
845
|
+
endif::apache[]
|
846
|
+
ifdef::nginx[]
|
740
847
|
* Before removing the application from the web server configuration, explicitly set its `passenger_min_instances` to 0. Next, send a request to it, which will cause the Flying Passenger daemon to take over the new `passenger_min_instances 0` option. You can then proceed with removing the application from the web server configuration, and restarting the web server. Finally, kill the PIDs associated to those application processes and remove the application configuration.
|
848
|
+
endif::nginx[]
|
741
849
|
* Restart the Flying Passenger daemon.
|
@@ -194,11 +194,13 @@ struct DirConfig {
|
|
194
194
|
}
|
195
195
|
}
|
196
196
|
|
197
|
-
string getUploadBufferDir(const ServerInstanceDir::
|
197
|
+
string getUploadBufferDir(const ServerInstanceDir::Generation *generation) const {
|
198
198
|
if (uploadBufferDir != NULL) {
|
199
199
|
return uploadBufferDir;
|
200
|
-
} else {
|
200
|
+
} else if (generation != NULL) {
|
201
201
|
return generation->getPath() + "/buffered_uploads";
|
202
|
+
} else {
|
203
|
+
return getSystemTempDir();
|
202
204
|
}
|
203
205
|
}
|
204
206
|
|
@@ -179,3 +179,17 @@
|
|
179
179
|
OR_ALL,
|
180
180
|
"Force specific startup file."),
|
181
181
|
|
182
|
+
|
183
|
+
AP_INIT_FLAG("PassengerStickySessions",
|
184
|
+
(FlagFunc) cmd_passenger_sticky_sessions,
|
185
|
+
NULL,
|
186
|
+
OR_ALL,
|
187
|
+
"Whether to enable sticky sessions."),
|
188
|
+
|
189
|
+
|
190
|
+
AP_INIT_FLAG("PassengerStickySessionsCookieName",
|
191
|
+
(FlagFunc) cmd_passenger_sticky_sessions_cookie_name,
|
192
|
+
NULL,
|
193
|
+
OR_ALL,
|
194
|
+
"The cookie name to use for sticky sessions."),
|
195
|
+
|
@@ -48,6 +48,10 @@
|
|
48
48
|
Threeway highPerformance;
|
49
49
|
/** Whether to load environment variables from the shell before running the application. */
|
50
50
|
Threeway loadShellEnvvars;
|
51
|
+
/** Whether to enable sticky sessions. */
|
52
|
+
Threeway stickySessions;
|
53
|
+
/** The cookie name to use for sticky sessions. */
|
54
|
+
Threeway stickySessionsCookieName;
|
51
55
|
/** The maximum number of simultaneously alive application instances a single application may occupy. */
|
52
56
|
int maxInstancesPerApp;
|
53
57
|
/** The maximum number of queued requests. */
|
@@ -317,4 +317,26 @@
|
|
317
317
|
return NULL;
|
318
318
|
}
|
319
319
|
|
320
|
+
|
321
|
+
static const char *
|
322
|
+
cmd_passenger_sticky_sessions(cmd_parms *cmd, void *pcfg, const char *arg) {
|
323
|
+
DirConfig *config = (DirConfig *) pcfg;
|
324
|
+
config->stickySessions =
|
325
|
+
arg ?
|
326
|
+
DirConfig::ENABLED :
|
327
|
+
DirConfig::DISABLED;
|
328
|
+
return NULL;
|
329
|
+
}
|
330
|
+
|
331
|
+
|
332
|
+
static const char *
|
333
|
+
cmd_passenger_sticky_sessions_cookie_name(cmd_parms *cmd, void *pcfg, const char *arg) {
|
334
|
+
DirConfig *config = (DirConfig *) pcfg;
|
335
|
+
config->stickySessionsCookieName =
|
336
|
+
arg ?
|
337
|
+
DirConfig::ENABLED :
|
338
|
+
DirConfig::DISABLED;
|
339
|
+
return NULL;
|
340
|
+
}
|
341
|
+
|
320
342
|
|
data/ext/apache2/Hooks.cpp
CHANGED
@@ -239,6 +239,14 @@ private:
|
|
239
239
|
}
|
240
240
|
}
|
241
241
|
|
242
|
+
StaticString getRequestSocketFilename() const {
|
243
|
+
return agentsStarter.getRequestSocketFilename();
|
244
|
+
}
|
245
|
+
|
246
|
+
StaticString getRequestSocketPassword() const {
|
247
|
+
return agentsStarter.getRequestSocketPassword();
|
248
|
+
}
|
249
|
+
|
242
250
|
/**
|
243
251
|
* Connect to the helper agent. If it looks like the helper agent crashed,
|
244
252
|
* wait and retry for a short period of time until the helper agent has been
|
@@ -249,8 +257,8 @@ private:
|
|
249
257
|
FileDescriptor conn;
|
250
258
|
|
251
259
|
try {
|
252
|
-
conn = connectToUnixServer(
|
253
|
-
writeExact(conn,
|
260
|
+
conn = connectToUnixServer(getRequestSocketFilename());
|
261
|
+
writeExact(conn, getRequestSocketPassword());
|
254
262
|
} catch (const SystemException &e) {
|
255
263
|
if (e.code() == EPIPE || e.code() == ECONNREFUSED || e.code() == ENOENT) {
|
256
264
|
UPDATE_TRACE_POINT();
|
@@ -264,8 +272,8 @@ private:
|
|
264
272
|
time_t deadline = time(NULL) + 5;
|
265
273
|
while (!connected && time(NULL) < deadline) {
|
266
274
|
try {
|
267
|
-
conn = connectToUnixServer(
|
268
|
-
writeExact(conn,
|
275
|
+
conn = connectToUnixServer(getRequestSocketFilename());
|
276
|
+
writeExact(conn, getRequestSocketPassword());
|
269
277
|
connected = true;
|
270
278
|
} catch (const SystemException &e) {
|
271
279
|
if (e.code() == EPIPE || e.code() == ECONNREFUSED || e.code() == ENOENT) {
|
@@ -282,7 +290,7 @@ private:
|
|
282
290
|
if (!connected) {
|
283
291
|
UPDATE_TRACE_POINT();
|
284
292
|
throw IOException("Cannot connect to the helper agent at " +
|
285
|
-
|
293
|
+
getRequestSocketFilename());
|
286
294
|
}
|
287
295
|
} else {
|
288
296
|
throw;
|
@@ -477,8 +485,8 @@ private:
|
|
477
485
|
}
|
478
486
|
|
479
487
|
/**
|
480
|
-
* Most of the high-level logic for forwarding a request to
|
481
|
-
* is contained in this method.
|
488
|
+
* Most of the high-level logic for forwarding a request to the
|
489
|
+
* HelperAgent is contained in this method.
|
482
490
|
*/
|
483
491
|
int handleRequest(request_rec *r) {
|
484
492
|
/********** Step 1: preparation work **********/
|
@@ -510,6 +518,12 @@ private:
|
|
510
518
|
// mod_rewrite is at work.
|
511
519
|
return DECLINED;
|
512
520
|
}
|
521
|
+
|
522
|
+
/* mod_mime might have set the httpd/unix-directory Content-Type
|
523
|
+
* if it detects that the current URL maps to a directory. We do
|
524
|
+
* not want to preserve that Content-Type.
|
525
|
+
*/
|
526
|
+
ap_set_content_type(r, NULL);
|
513
527
|
|
514
528
|
TRACE_POINT();
|
515
529
|
DirConfig *config = note->config;
|
@@ -634,8 +648,8 @@ private:
|
|
634
648
|
}
|
635
649
|
|
636
650
|
|
637
|
-
/********** Step 4: forwarding the response from the
|
638
|
-
|
651
|
+
/********** Step 4: forwarding the response from the HelperAgent
|
652
|
+
back to the HTTP client **********/
|
639
653
|
|
640
654
|
UPDATE_TRACE_POINT();
|
641
655
|
apr_bucket_brigade *bb;
|
@@ -1001,8 +1015,7 @@ private:
|
|
1001
1015
|
string message("An error occured while "
|
1002
1016
|
"buffering HTTP upload data to "
|
1003
1017
|
"a temporary file in ");
|
1004
|
-
|
1005
|
-
message.append(config->getUploadBufferDir(generation));
|
1018
|
+
message.append(getUploadBufferDir(config));
|
1006
1019
|
|
1007
1020
|
switch (code) {
|
1008
1021
|
case ENOSPC:
|
@@ -1159,6 +1172,11 @@ private:
|
|
1159
1172
|
apr_brigade_destroy(bb);
|
1160
1173
|
return bufsiz;
|
1161
1174
|
}
|
1175
|
+
|
1176
|
+
string getUploadBufferDir(DirConfig *config) {
|
1177
|
+
ServerInstanceDir::GenerationPtr generation = agentsStarter.getGeneration();
|
1178
|
+
return config->getUploadBufferDir(generation.get());
|
1179
|
+
}
|
1162
1180
|
|
1163
1181
|
/**
|
1164
1182
|
* Receive the HTTP upload data and buffer it into a BufferedUpload temp file.
|
@@ -1173,9 +1191,7 @@ private:
|
|
1173
1191
|
DirConfig *config = getDirConfig(r);
|
1174
1192
|
boost::shared_ptr<BufferedUpload> tempFile;
|
1175
1193
|
try {
|
1176
|
-
|
1177
|
-
string uploadBufferDir = config->getUploadBufferDir(generation);
|
1178
|
-
tempFile.reset(new BufferedUpload(uploadBufferDir));
|
1194
|
+
tempFile.reset(new BufferedUpload(getUploadBufferDir(config)));
|
1179
1195
|
} catch (const SystemException &e) {
|
1180
1196
|
throwUploadBufferingException(r, e.code());
|
1181
1197
|
}
|
@@ -165,3 +165,17 @@
|
|
165
165
|
add->startupFile;
|
166
166
|
|
167
167
|
|
168
|
+
|
169
|
+
config->stickySessions =
|
170
|
+
(add->stickySessions == DirConfig::UNSET) ?
|
171
|
+
base->stickySessions :
|
172
|
+
add->stickySessions;
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
config->stickySessionsCookieName =
|
177
|
+
(add->stickySessionsCookieName == DirConfig::UNSET) ?
|
178
|
+
base->stickySessionsCookieName :
|
179
|
+
add->stickySessionsCookieName;
|
180
|
+
|
181
|
+
|
data/ext/apache2/SetHeaders.cpp
CHANGED
@@ -91,3 +91,11 @@
|
|
91
91
|
addHeader(output, "PASSENGER_STARTUP_FILE", config->startupFile);
|
92
92
|
|
93
93
|
|
94
|
+
|
95
|
+
addHeader(r, output, "PASSENGER_STICKY_SESSIONS", config->stickySessions);
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
addHeader(r, output, "PASSENGER_STICKY_SESSIONS_COOKIE_NAME", config->stickySessionsCookieName);
|
100
|
+
|
101
|
+
|