passenger 2.2.1 → 2.2.2
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.
- data/Rakefile +66 -79
- data/bin/passenger-install-nginx-module +1 -1
- data/bin/passenger-memory-stats +1 -1
- data/bin/passenger-spawn-server +8 -2
- data/doc/Users guide Apache.html +33 -49
- data/doc/Users guide Apache.txt +28 -27
- data/doc/Users guide Nginx.html +9 -19
- data/doc/Users guide Nginx.txt +8 -20
- data/doc/cxxapi/Bucket_8h-source.html +1 -1
- data/doc/cxxapi/Configuration_8h-source.html +297 -300
- data/doc/cxxapi/DirectoryMapper_8h-source.html +1 -1
- data/doc/cxxapi/Hooks_8h-source.html +1 -1
- data/doc/cxxapi/annotated.html +1 -1
- data/doc/cxxapi/classHooks-members.html +1 -1
- data/doc/cxxapi/classHooks.html +1 -1
- data/doc/cxxapi/classPassenger_1_1DirectoryMapper-members.html +1 -1
- data/doc/cxxapi/classPassenger_1_1DirectoryMapper.html +1 -1
- data/doc/cxxapi/classes.html +1 -1
- data/doc/cxxapi/definitions_8h-source.html +1 -1
- data/doc/cxxapi/files.html +1 -1
- data/doc/cxxapi/functions.html +1 -1
- data/doc/cxxapi/functions_func.html +1 -1
- data/doc/cxxapi/graph_legend.html +1 -1
- data/doc/cxxapi/group__Configuration.html +1 -23
- data/doc/cxxapi/group__Core.html +1 -1
- data/doc/cxxapi/group__Hooks.html +1 -1
- data/doc/cxxapi/group__Support.html +1 -1
- data/doc/cxxapi/main.html +1 -1
- data/doc/cxxapi/modules.html +1 -1
- data/doc/users_guide_snippets/rackup_specifications.txt +4 -2
- data/ext/apache2/Configuration.h +0 -3
- data/ext/apache2/Hooks.cpp +5 -3
- data/ext/common/ApplicationPoolServer.h +1 -0
- data/ext/common/ApplicationPoolServerExecutable.cpp +5 -2
- data/ext/common/SpawnManager.h +1 -0
- data/ext/common/Utils.cpp +22 -23
- data/ext/common/Utils.h +32 -21
- data/ext/common/Version.h +31 -0
- data/ext/nginx/ContentHandler.c +61 -8
- data/ext/nginx/HelperServer.cpp +3 -0
- data/ext/nginx/HttpStatusExtractor.h +185 -0
- data/ext/nginx/StaticContentHandler.c +18 -3
- data/ext/nginx/config +2 -1
- data/ext/nginx/ngx_http_passenger_module.c +21 -15
- data/ext/oxt/backtrace.cpp +4 -2
- data/ext/oxt/spin_lock.hpp +3 -3
- data/lib/phusion_passenger/abstract_request_handler.rb +5 -3
- data/lib/phusion_passenger/admin_tools/control_process.rb +6 -1
- data/lib/phusion_passenger/constants.rb +2 -2
- data/lib/phusion_passenger/rack/application_spawner.rb +2 -1
- data/lib/phusion_passenger/rack/request_handler.rb +45 -35
- data/lib/phusion_passenger/templates/nginx/config_snippets.txt.erb +1 -1
- data/lib/phusion_passenger/utils.rb +13 -3
- data/misc/rake/cplusplus.rb +7 -0
- data/test/ApplicationPoolServer_ApplicationPoolTest.cpp +2 -0
- data/test/ApplicationPoolTest.cpp +39 -62
- data/test/CxxTestMain.cpp +6 -6
- data/test/HttpStatusExtractorTest.cpp +17 -0
- data/test/StandardApplicationPoolTest.cpp +2 -0
- data/test/UtilsTest.cpp +17 -28
- data/test/ruby/abstract_request_handler_spec.rb +3 -7
- data/test/ruby/utils_spec.rb +18 -13
- data/test/ruby/wsgi/application_spawner_spec.rb +5 -9
- data/test/stub/railsapp/app/controllers/{bar_controller_1.rb → bar_controller.rb} +0 -0
- data/test/stub/railsapp/app/controllers/bar_controller_1.txt +5 -0
- data/test/stub/railsapp/app/controllers/{bar_controller_2.rb → bar_controller_2.txt} +0 -0
- data/test/support/Support.h +20 -0
- data/test/support/config.rb +13 -0
- data/vendor/README +4 -3
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/COPYING +1 -1
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/KNOWN-ISSUES +0 -0
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/README +54 -7
- data/vendor/rack-1.0.0-git/Rakefile +164 -0
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack.rb +7 -3
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/adapter/camping.rb +0 -0
- data/vendor/rack-1.0.0-git/lib/rack/auth/abstract/handler.rb +37 -0
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/auth/abstract/request.rb +0 -0
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/auth/basic.rb +0 -0
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/auth/digest/md5.rb +1 -1
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/auth/digest/nonce.rb +0 -0
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/auth/digest/params.rb +0 -0
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/auth/digest/request.rb +2 -2
- data/vendor/rack-1.0.0-git/lib/rack/auth/openid.rb +480 -0
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/builder.rb +1 -5
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/cascade.rb +0 -0
- data/vendor/rack-1.0.0-git/lib/rack/chunked.rb +49 -0
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/commonlogger.rb +0 -0
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/conditionalget.rb +4 -0
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/content_length.rb +7 -3
- data/vendor/rack-1.0.0-git/lib/rack/content_type.rb +23 -0
- data/vendor/rack-1.0.0-git/lib/rack/deflater.rb +96 -0
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/directory.rb +5 -2
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/file.rb +4 -1
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/handler.rb +22 -1
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/handler/cgi.rb +7 -3
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/handler/evented_mongrel.rb +0 -0
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/handler/fastcgi.rb +26 -24
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/handler/lsws.rb +7 -4
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/handler/mongrel.rb +5 -3
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/handler/scgi.rb +5 -3
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/handler/swiftiplied_mongrel.rb +0 -0
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/handler/thin.rb +3 -0
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/handler/webrick.rb +11 -5
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/head.rb +0 -0
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/lint.rb +138 -66
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/lobster.rb +0 -0
- data/vendor/rack-1.0.0-git/lib/rack/lock.rb +16 -0
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/methodoverride.rb +0 -0
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/mime.rb +4 -4
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/mock.rb +42 -5
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/recursive.rb +0 -0
- data/vendor/rack-1.0.0-git/lib/rack/reloader.rb +106 -0
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/request.rb +46 -10
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/response.rb +15 -3
- data/vendor/rack-1.0.0-git/lib/rack/rewindable_input.rb +98 -0
- data/vendor/rack-1.0.0-git/lib/rack/session/abstract/id.rb +142 -0
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/session/cookie.rb +2 -0
- data/vendor/rack-1.0.0-git/lib/rack/session/memcache.rb +109 -0
- data/vendor/rack-1.0.0-git/lib/rack/session/pool.rb +100 -0
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/showexceptions.rb +2 -1
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/showstatus.rb +1 -1
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/static.rb +0 -0
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/urlmap.rb +12 -5
- data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/utils.rb +212 -65
- metadata +71 -170
- data/doc/rdoc/classes/ConditionVariable.html +0 -194
- data/doc/rdoc/classes/Exception.html +0 -120
- data/doc/rdoc/classes/GC.html +0 -113
- data/doc/rdoc/classes/IO.html +0 -169
- data/doc/rdoc/classes/PhusionPassenger.html +0 -238
- data/doc/rdoc/classes/PhusionPassenger/AbstractInstaller.html +0 -153
- data/doc/rdoc/classes/PhusionPassenger/AbstractRequestHandler.html +0 -506
- data/doc/rdoc/classes/PhusionPassenger/AbstractServer.html +0 -692
- data/doc/rdoc/classes/PhusionPassenger/AbstractServer/ServerAlreadyStarted.html +0 -97
- data/doc/rdoc/classes/PhusionPassenger/AbstractServer/ServerError.html +0 -96
- data/doc/rdoc/classes/PhusionPassenger/AbstractServer/ServerNotStarted.html +0 -97
- data/doc/rdoc/classes/PhusionPassenger/AbstractServer/UnknownMessage.html +0 -96
- data/doc/rdoc/classes/PhusionPassenger/AbstractServerCollection.html +0 -598
- data/doc/rdoc/classes/PhusionPassenger/AdminTools.html +0 -140
- data/doc/rdoc/classes/PhusionPassenger/AdminTools/ControlProcess.html +0 -264
- data/doc/rdoc/classes/PhusionPassenger/AdminTools/ControlProcess/Instance.html +0 -138
- data/doc/rdoc/classes/PhusionPassenger/AppInitError.html +0 -154
- data/doc/rdoc/classes/PhusionPassenger/Application.html +0 -283
- data/doc/rdoc/classes/PhusionPassenger/ConsoleTextTemplate.html +0 -172
- data/doc/rdoc/classes/PhusionPassenger/FrameworkInitError.html +0 -145
- data/doc/rdoc/classes/PhusionPassenger/HTMLTemplate.html +0 -175
- data/doc/rdoc/classes/PhusionPassenger/InitializationError.html +0 -141
- data/doc/rdoc/classes/PhusionPassenger/InvalidPath.html +0 -92
- data/doc/rdoc/classes/PhusionPassenger/MessageChannel.html +0 -489
- data/doc/rdoc/classes/PhusionPassenger/NativeSupport.html +0 -350
- data/doc/rdoc/classes/PhusionPassenger/Rack.html +0 -91
- data/doc/rdoc/classes/PhusionPassenger/Rack/ApplicationSpawner.html +0 -185
- data/doc/rdoc/classes/PhusionPassenger/Rack/RequestHandler.html +0 -184
- data/doc/rdoc/classes/PhusionPassenger/Railz.html +0 -95
- data/doc/rdoc/classes/PhusionPassenger/Railz/ApplicationSpawner.html +0 -419
- data/doc/rdoc/classes/PhusionPassenger/Railz/ApplicationSpawner/Error.html +0 -98
- data/doc/rdoc/classes/PhusionPassenger/Railz/CGIFixed.html +0 -200
- data/doc/rdoc/classes/PhusionPassenger/Railz/FrameworkSpawner.html +0 -443
- data/doc/rdoc/classes/PhusionPassenger/Railz/FrameworkSpawner/Error.html +0 -98
- data/doc/rdoc/classes/PhusionPassenger/Railz/RequestHandler.html +0 -154
- data/doc/rdoc/classes/PhusionPassenger/SpawnManager.html +0 -402
- data/doc/rdoc/classes/PhusionPassenger/UnknownError.html +0 -125
- data/doc/rdoc/classes/PhusionPassenger/Utils.html +0 -694
- data/doc/rdoc/classes/PhusionPassenger/VersionNotFound.html +0 -140
- data/doc/rdoc/classes/PhusionPassenger/WSGI.html +0 -89
- data/doc/rdoc/classes/PhusionPassenger/WSGI/ApplicationSpawner.html +0 -188
- data/doc/rdoc/classes/PlatformInfo.html +0 -831
- data/doc/rdoc/classes/RakeExtensions.html +0 -197
- data/doc/rdoc/classes/Signal.html +0 -134
- data/doc/rdoc/created.rid +0 -1
- data/doc/rdoc/files/DEVELOPERS_TXT.html +0 -240
- data/doc/rdoc/files/README.html +0 -157
- data/doc/rdoc/files/ext/phusion_passenger/native_support_c.html +0 -92
- data/doc/rdoc/files/lib/phusion_passenger/abstract_installer_rb.html +0 -129
- data/doc/rdoc/files/lib/phusion_passenger/abstract_request_handler_rb.html +0 -131
- data/doc/rdoc/files/lib/phusion_passenger/abstract_server_collection_rb.html +0 -126
- data/doc/rdoc/files/lib/phusion_passenger/abstract_server_rb.html +0 -130
- data/doc/rdoc/files/lib/phusion_passenger/admin_tools/control_process_rb.html +0 -129
- data/doc/rdoc/files/lib/phusion_passenger/admin_tools_rb.html +0 -122
- data/doc/rdoc/files/lib/phusion_passenger/application_rb.html +0 -127
- data/doc/rdoc/files/lib/phusion_passenger/console_text_template_rb.html +0 -126
- data/doc/rdoc/files/lib/phusion_passenger/constants_rb.html +0 -122
- data/doc/rdoc/files/lib/phusion_passenger/dependencies_rb.html +0 -134
- data/doc/rdoc/files/lib/phusion_passenger/events_rb.html +0 -122
- data/doc/rdoc/files/lib/phusion_passenger/exceptions_rb.html +0 -122
- data/doc/rdoc/files/lib/phusion_passenger/html_template_rb.html +0 -126
- data/doc/rdoc/files/lib/phusion_passenger/message_channel_rb.html +0 -122
- data/doc/rdoc/files/lib/phusion_passenger/packaging_rb.html +0 -122
- data/doc/rdoc/files/lib/phusion_passenger/platform_info_rb.html +0 -127
- data/doc/rdoc/files/lib/phusion_passenger/rack/application_spawner_rb.html +0 -133
- data/doc/rdoc/files/lib/phusion_passenger/rack/request_handler_rb.html +0 -126
- data/doc/rdoc/files/lib/phusion_passenger/railz/application_spawner_rb.html +0 -143
- data/doc/rdoc/files/lib/phusion_passenger/railz/cgi_fixed_rb.html +0 -126
- data/doc/rdoc/files/lib/phusion_passenger/railz/framework_spawner_rb.html +0 -145
- data/doc/rdoc/files/lib/phusion_passenger/railz/request_handler_rb.html +0 -127
- data/doc/rdoc/files/lib/phusion_passenger/simple_benchmarking_rb.html +0 -122
- data/doc/rdoc/files/lib/phusion_passenger/spawn_manager_rb.html +0 -161
- data/doc/rdoc/files/lib/phusion_passenger/utils_rb.html +0 -175
- data/doc/rdoc/files/lib/phusion_passenger/wsgi/application_spawner_rb.html +0 -129
- data/doc/rdoc/files/misc/rake/extensions_rb.html +0 -130
- data/doc/rdoc/fr_class_index.html +0 -90
- data/doc/rdoc/fr_file_index.html +0 -76
- data/doc/rdoc/fr_method_index.html +0 -195
- data/doc/rdoc/index.html +0 -26
- data/doc/rdoc/rdoc-style.css +0 -187
- data/vendor/rack-0.9.1/AUTHORS +0 -8
- data/vendor/rack-0.9.1/ChangeLog +0 -1423
- data/vendor/rack-0.9.1/Rakefile +0 -188
- data/vendor/rack-0.9.1/SPEC +0 -129
- data/vendor/rack-0.9.1/lib/rack/auth/abstract/handler.rb +0 -28
- data/vendor/rack-0.9.1/lib/rack/auth/openid.rb +0 -438
- data/vendor/rack-0.9.1/lib/rack/deflater.rb +0 -87
- data/vendor/rack-0.9.1/lib/rack/reloader.rb +0 -64
- data/vendor/rack-0.9.1/lib/rack/session/abstract/id.rb +0 -153
- data/vendor/rack-0.9.1/lib/rack/session/memcache.rb +0 -97
- data/vendor/rack-0.9.1/lib/rack/session/pool.rb +0 -73
@@ -0,0 +1,31 @@
|
|
1
|
+
/*
|
2
|
+
* Phusion Passenger - http://www.modrails.com/
|
3
|
+
* Copyright (c) 2009 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_VERSION_H_
|
26
|
+
#define _PASSENGER_VERSION_H_
|
27
|
+
|
28
|
+
/* Don't forget to update lib/phusion_passenger/constants.rb too. */
|
29
|
+
#define PASSENGER_VERSION "2.2.2"
|
30
|
+
|
31
|
+
#endif /* _PASSENGER_VERSION_H */
|
data/ext/nginx/ContentHandler.c
CHANGED
@@ -30,6 +30,7 @@
|
|
30
30
|
#include "ContentHandler.h"
|
31
31
|
#include "StaticContentHandler.h"
|
32
32
|
#include "Configuration.h"
|
33
|
+
#include "../common/Version.h"
|
33
34
|
|
34
35
|
|
35
36
|
#define NGX_HTTP_SCGI_PARSE_NO_HEADER 20
|
@@ -242,6 +243,9 @@ create_request(ngx_http_request_t *r)
|
|
242
243
|
passenger_main_conf_t *main_conf;
|
243
244
|
passenger_context_t *context;
|
244
245
|
ngx_http_script_len_code_pt lcode;
|
246
|
+
#if (NGX_HTTP_SSL)
|
247
|
+
ngx_http_ssl_srv_conf_t *ssl_conf;
|
248
|
+
#endif
|
245
249
|
|
246
250
|
slcf = ngx_http_get_module_loc_conf(r, ngx_http_passenger_module);
|
247
251
|
main_conf = &passenger_main_conf;
|
@@ -284,12 +288,14 @@ create_request(ngx_http_request_t *r)
|
|
284
288
|
/* +1 for trailing null */
|
285
289
|
len = sizeof("CONTENT_LENGTH") + ngx_strlen(buf) + 1;
|
286
290
|
|
287
|
-
/* DOCUMENT_ROOT,
|
291
|
+
/* DOCUMENT_ROOT, SCRIPT_NAME and base URI */
|
288
292
|
len += sizeof("DOCUMENT_ROOT") + context->public_dir.len + 1;
|
289
|
-
len += sizeof("PATH_INFO") + context->public_dir.len + 1;
|
290
293
|
if (context->base_uri.len > 0) {
|
294
|
+
len += sizeof("SCRIPT_NAME") + context->base_uri.len + 1;
|
291
295
|
len += sizeof("RAILS_RELATIVE_URL_ROOT") +
|
292
296
|
context->base_uri.len + 1;
|
297
|
+
} else {
|
298
|
+
len += sizeof("SCRIPT_NAME") + sizeof("");
|
293
299
|
}
|
294
300
|
|
295
301
|
/* Various other HTTP headers. */
|
@@ -298,6 +304,12 @@ create_request(ngx_http_request_t *r)
|
|
298
304
|
len += sizeof("CONTENT_TYPE") + r->headers_in.content_type->value.len + 1;
|
299
305
|
}
|
300
306
|
|
307
|
+
#if (NGX_HTTP_SSL)
|
308
|
+
ssl_conf = ngx_http_get_module_srv_conf(r, ngx_http_ssl_module);
|
309
|
+
if (ssl_conf->enable) {
|
310
|
+
len += sizeof("HTTPS") + sizeof("on");
|
311
|
+
}
|
312
|
+
#endif
|
301
313
|
|
302
314
|
/* Lengths of Passenger application pool options. */
|
303
315
|
if (slcf->use_global_queue) {
|
@@ -370,6 +382,33 @@ create_request(ngx_http_request_t *r)
|
|
370
382
|
}
|
371
383
|
}
|
372
384
|
|
385
|
+
/* Trailing dummy header.
|
386
|
+
*
|
387
|
+
* If the last header value is an empty string, then the buffer
|
388
|
+
* will end with "\0\0". For example, if 'SSL_CLIENT_CERT'
|
389
|
+
* is the last header and it has an empty value, then the SCGI header
|
390
|
+
* will end with:
|
391
|
+
*
|
392
|
+
* "SSL_CLIENT_CERT\0\0"
|
393
|
+
*
|
394
|
+
* The data in the buffer will be processed by the AbstractRequestHandler class,
|
395
|
+
* which is implemented in Ruby. But it uses Hash[*data.split("\0")] to
|
396
|
+
* unserialize the data. Unfortunately String#split will not transform
|
397
|
+
* the trailing "\0\0" into an empty string:
|
398
|
+
*
|
399
|
+
* "SSL_CLIENT_CERT\0\0".split("\0")
|
400
|
+
* # => desired result: ["SSL_CLIENT_CERT", ""]
|
401
|
+
* # => actual result: ["SSL_CLIENT_CERT"]
|
402
|
+
*
|
403
|
+
* When that happens, Hash[..] will raise an ArgumentError because
|
404
|
+
* data.split("\0") does not return an array with a length that is a
|
405
|
+
* multiple of 2.
|
406
|
+
*
|
407
|
+
* So here, we add a dummy header to prevent situations like that from
|
408
|
+
* happening.
|
409
|
+
*/
|
410
|
+
len += sizeof("_") + sizeof("_");
|
411
|
+
|
373
412
|
|
374
413
|
/**************************************************
|
375
414
|
* Build the request header data.
|
@@ -406,20 +445,23 @@ create_request(ngx_http_request_t *r)
|
|
406
445
|
b->last = ngx_snprintf(b->last, 10, "%ui", content_length);
|
407
446
|
*b->last++ = (u_char) 0;
|
408
447
|
|
409
|
-
/* Build DOCUMENT_ROOT and base URI. */
|
448
|
+
/* Build DOCUMENT_ROOT, SCRIPT_NAME and base URI. */
|
410
449
|
b->last = ngx_copy(b->last, "DOCUMENT_ROOT", sizeof("DOCUMENT_ROOT"));
|
411
450
|
b->last = ngx_copy(b->last, context->public_dir.data,
|
412
451
|
context->public_dir.len + 1);
|
413
452
|
|
414
|
-
b->last = ngx_copy(b->last, "PATH_INFO", sizeof("PATH_INFO"));
|
415
|
-
b->last = ngx_copy(b->last, context->public_dir.data,
|
416
|
-
context->public_dir.len + 1);
|
417
|
-
|
418
453
|
if (context->base_uri.len > 0) {
|
454
|
+
b->last = ngx_copy(b->last, "SCRIPT_NAME", sizeof("SCRIPT_NAME"));
|
455
|
+
b->last = ngx_copy(b->last, context->base_uri.data,
|
456
|
+
context->base_uri.len + 1);
|
457
|
+
|
419
458
|
b->last = ngx_copy(b->last, "RAILS_RELATIVE_URL_ROOT",
|
420
459
|
sizeof("RAILS_RELATIVE_URL_ROOT"));
|
421
460
|
b->last = ngx_copy(b->last, context->base_uri.data,
|
422
461
|
context->base_uri.len + 1);
|
462
|
+
} else {
|
463
|
+
b->last = ngx_copy(b->last, "SCRIPT_NAME", sizeof("SCRIPT_NAME"));
|
464
|
+
b->last = ngx_copy(b->last, "", sizeof(""));
|
423
465
|
}
|
424
466
|
|
425
467
|
/* Various other HTTP headers. */
|
@@ -430,6 +472,14 @@ create_request(ngx_http_request_t *r)
|
|
430
472
|
r->headers_in.content_type->value.len + 1);
|
431
473
|
}
|
432
474
|
|
475
|
+
#if (NGX_HTTP_SSL)
|
476
|
+
ssl_conf = ngx_http_get_module_srv_conf(r, ngx_http_ssl_module);
|
477
|
+
if (ssl_conf->enable) {
|
478
|
+
b->last = ngx_copy(b->last, "HTTPS", sizeof("HTTPS"));
|
479
|
+
b->last = ngx_copy(b->last, "on", sizeof("on"));
|
480
|
+
}
|
481
|
+
#endif
|
482
|
+
|
433
483
|
|
434
484
|
/* Build Passenger application pool option headers. */
|
435
485
|
b->last = ngx_copy(b->last, "PASSENGER_USE_GLOBAL_QUEUE",
|
@@ -534,6 +584,9 @@ create_request(ngx_http_request_t *r)
|
|
534
584
|
*b->last++ = (u_char) 0;
|
535
585
|
}
|
536
586
|
}
|
587
|
+
|
588
|
+
/* Trailing dummy header. See earlier comment for explanation. */
|
589
|
+
b->last = ngx_copy(b->last, "_\0_", sizeof("_\0_"));
|
537
590
|
|
538
591
|
|
539
592
|
*b->last++ = (u_char) ',';
|
@@ -956,7 +1009,7 @@ process_header(ngx_http_request_t *r)
|
|
956
1009
|
|
957
1010
|
h->key.len = sizeof("Server") - 1;
|
958
1011
|
h->key.data = (u_char *) "Server";
|
959
|
-
h->value.data = (u_char *) (NGINX_VER " + Phusion Passenger (mod_rails/mod_rack)");
|
1012
|
+
h->value.data = (u_char *) (NGINX_VER " + Phusion Passenger " PASSENGER_VERSION " (mod_rails/mod_rack)");
|
960
1013
|
h->value.len = ngx_strlen(h->value.data);
|
961
1014
|
h->lowcase_key = (u_char *) "server";
|
962
1015
|
}
|
data/ext/nginx/HelperServer.cpp
CHANGED
@@ -830,10 +830,13 @@ main(int argc, char *argv[]) {
|
|
830
830
|
string defaultUser = argv[10];
|
831
831
|
uid_t workerUid = (uid_t) atoll(argv[11]);
|
832
832
|
gid_t workerGid = (gid_t) atoll(argv[12]);
|
833
|
+
string passengerTempDir = argv[13];
|
833
834
|
|
834
835
|
setLogLevel(logLevel);
|
835
836
|
P_DEBUG("Passenger helper server started on PID " << getpid());
|
836
837
|
|
838
|
+
setPassengerTempDir(passengerTempDir);
|
839
|
+
|
837
840
|
password = receivePassword(adminPipe);
|
838
841
|
P_TRACE(2, "Password received.");
|
839
842
|
|
@@ -24,6 +24,8 @@
|
|
24
24
|
*/
|
25
25
|
|
26
26
|
#include <string>
|
27
|
+
#include <cstdio>
|
28
|
+
#include <cstdlib>
|
27
29
|
|
28
30
|
namespace Passenger {
|
29
31
|
|
@@ -46,6 +48,10 @@ using namespace std;
|
|
46
48
|
* - Call getBuffer() to retrieve all fed data so far. This data can be sent to
|
47
49
|
* the HTTP client.
|
48
50
|
*
|
51
|
+
* This class will also ensure that the status line contains a status text, e.g.
|
52
|
+
* if the HTTP data's status value is only "200" then "OK" will be automatically
|
53
|
+
* appended.
|
54
|
+
*
|
49
55
|
* @note
|
50
56
|
* When the API documentation for this class refers to "\r\n", we actually
|
51
57
|
* mean "\x0D\x0A" (the HTTP line termination string). "\r\n" is only written
|
@@ -82,6 +88,7 @@ private:
|
|
82
88
|
if (start_pos != string::npos) {
|
83
89
|
// Status line has been found. Extract it.
|
84
90
|
statusLine = buffer.substr(start_pos, newline_pos - start_pos);
|
91
|
+
addStatusTextIfNecessary();
|
85
92
|
return true;
|
86
93
|
} else {
|
87
94
|
// Status line is not found. Do not change default
|
@@ -90,6 +97,184 @@ private:
|
|
90
97
|
}
|
91
98
|
}
|
92
99
|
|
100
|
+
void addStatusTextIfNecessary() {
|
101
|
+
if (statusLine.find(' ') == string::npos) {
|
102
|
+
// The status line doesn't contain a status text, so add it.
|
103
|
+
int statusCode = atoi(statusLine.c_str());
|
104
|
+
switch (statusCode) {
|
105
|
+
case 100:
|
106
|
+
statusLine = "100 Continue\x0D\x0A";
|
107
|
+
break;
|
108
|
+
case 101:
|
109
|
+
statusLine = "101 Switching Protocols\x0D\x0A";
|
110
|
+
break;
|
111
|
+
case 102:
|
112
|
+
statusLine = "102 Processing\x0D\x0A";
|
113
|
+
break;
|
114
|
+
case 200:
|
115
|
+
statusLine = "200 OK\x0D\x0A";
|
116
|
+
break;
|
117
|
+
case 201:
|
118
|
+
statusLine = "201 Created\x0D\x0A";
|
119
|
+
break;
|
120
|
+
case 202:
|
121
|
+
statusLine = "202 Accepted\x0D\x0A";
|
122
|
+
break;
|
123
|
+
case 203:
|
124
|
+
statusLine = "203 Non-Authoritative Information\x0D\x0A";
|
125
|
+
break;
|
126
|
+
case 204:
|
127
|
+
statusLine = "204 No Content\x0D\x0A";
|
128
|
+
break;
|
129
|
+
case 205:
|
130
|
+
statusLine = "205 Reset Content\x0D\x0A";
|
131
|
+
break;
|
132
|
+
case 206:
|
133
|
+
statusLine = "206 Partial Content\x0D\x0A";
|
134
|
+
break;
|
135
|
+
case 207:
|
136
|
+
statusLine = "207 Multi-Status\x0D\x0A";
|
137
|
+
break;
|
138
|
+
case 300:
|
139
|
+
statusLine = "300 Multiple Choices\x0D\x0A";
|
140
|
+
break;
|
141
|
+
case 301:
|
142
|
+
statusLine = "301 Moved Permanently\x0D\x0A";
|
143
|
+
break;
|
144
|
+
case 302:
|
145
|
+
statusLine = "302 Found\x0D\x0A";
|
146
|
+
break;
|
147
|
+
case 303:
|
148
|
+
statusLine = "303 See Other\x0D\x0A";
|
149
|
+
break;
|
150
|
+
case 304:
|
151
|
+
statusLine = "304 Not Modified\x0D\x0A";
|
152
|
+
break;
|
153
|
+
case 305:
|
154
|
+
statusLine = "305 Use Proxy\x0D\x0A";
|
155
|
+
break;
|
156
|
+
case 306:
|
157
|
+
statusLine = "306 Switch Proxy\x0D\x0A";
|
158
|
+
break;
|
159
|
+
case 307:
|
160
|
+
statusLine = "307 Temporary Redirect\x0D\x0A";
|
161
|
+
break;
|
162
|
+
case 400:
|
163
|
+
statusLine = "400 Bad Request\x0D\x0A";
|
164
|
+
break;
|
165
|
+
case 401:
|
166
|
+
statusLine = "401 Unauthorized\x0D\x0A";
|
167
|
+
break;
|
168
|
+
case 402:
|
169
|
+
statusLine = "402 Payment Required\x0D\x0A";
|
170
|
+
break;
|
171
|
+
case 403:
|
172
|
+
statusLine = "403 Forbidden\x0D\x0A";
|
173
|
+
break;
|
174
|
+
case 404:
|
175
|
+
statusLine = "404 Not Found\x0D\x0A";
|
176
|
+
break;
|
177
|
+
case 405:
|
178
|
+
statusLine = "405 Method Not Allowed\x0D\x0A";
|
179
|
+
break;
|
180
|
+
case 406:
|
181
|
+
statusLine = "406 Not Acceptable\x0D\x0A";
|
182
|
+
break;
|
183
|
+
case 407:
|
184
|
+
statusLine = "407 Proxy Authentication Required\x0D\x0A";
|
185
|
+
break;
|
186
|
+
case 408:
|
187
|
+
statusLine = "408 Request Timeout\x0D\x0A";
|
188
|
+
break;
|
189
|
+
case 409:
|
190
|
+
statusLine = "409 Conflict\x0D\x0A";
|
191
|
+
break;
|
192
|
+
case 410:
|
193
|
+
statusLine = "410 Gone\x0D\x0A";
|
194
|
+
break;
|
195
|
+
case 411:
|
196
|
+
statusLine = "411 Length Required\x0D\x0A";
|
197
|
+
break;
|
198
|
+
case 412:
|
199
|
+
statusLine = "412 Precondition Failed\x0D\x0A";
|
200
|
+
break;
|
201
|
+
case 413:
|
202
|
+
statusLine = "413 Request Entity Too Large\x0D\x0A";
|
203
|
+
break;
|
204
|
+
case 414:
|
205
|
+
statusLine = "414 Request-URI Too Long\x0D\x0A";
|
206
|
+
break;
|
207
|
+
case 415:
|
208
|
+
statusLine = "415 Unsupported Media Type\x0D\x0A";
|
209
|
+
break;
|
210
|
+
case 416:
|
211
|
+
statusLine = "416 Requested Range Not Satisfiable\x0D\x0A";
|
212
|
+
break;
|
213
|
+
case 417:
|
214
|
+
statusLine = "417 Expectation Failed\x0D\x0A";
|
215
|
+
break;
|
216
|
+
case 418:
|
217
|
+
statusLine = "418 Not A Funny April Fools Joke\x0D\x0A";
|
218
|
+
break;
|
219
|
+
case 422:
|
220
|
+
statusLine = "422 Unprocessable Entity\x0D\x0A";
|
221
|
+
break;
|
222
|
+
case 423:
|
223
|
+
statusLine = "423 Locked\x0D\x0A";
|
224
|
+
break;
|
225
|
+
case 424:
|
226
|
+
statusLine = "424 Unordered Collection\x0D\x0A";
|
227
|
+
break;
|
228
|
+
case 426:
|
229
|
+
statusLine = "426 Upgrade Required\x0D\x0A";
|
230
|
+
break;
|
231
|
+
case 449:
|
232
|
+
statusLine = "449 Retry With\x0D\x0A";
|
233
|
+
break;
|
234
|
+
case 450:
|
235
|
+
statusLine = "450 Blocked\x0D\x0A";
|
236
|
+
break;
|
237
|
+
case 500:
|
238
|
+
statusLine = "500 Internal Server Error\x0D\x0A";
|
239
|
+
break;
|
240
|
+
case 501:
|
241
|
+
statusLine = "501 Not Implemented\x0D\x0A";
|
242
|
+
break;
|
243
|
+
case 502:
|
244
|
+
statusLine = "502 Bad Gateway\x0D\x0A";
|
245
|
+
break;
|
246
|
+
case 503:
|
247
|
+
statusLine = "503 Service Unavailable\x0D\x0A";
|
248
|
+
break;
|
249
|
+
case 504:
|
250
|
+
statusLine = "504 Gateway Timeout\x0D\x0A";
|
251
|
+
break;
|
252
|
+
case 505:
|
253
|
+
statusLine = "505 HTTP Version Not Supported\x0D\x0A";
|
254
|
+
break;
|
255
|
+
case 506:
|
256
|
+
statusLine = "506 Variant Also Negotiates\x0D\x0A";
|
257
|
+
break;
|
258
|
+
case 507:
|
259
|
+
statusLine = "507 Insufficient Storage\x0D\x0A";
|
260
|
+
break;
|
261
|
+
case 509:
|
262
|
+
statusLine = "509 Bandwidth Limit Exceeded\x0D\x0A";
|
263
|
+
break;
|
264
|
+
case 510:
|
265
|
+
statusLine = "510 Not Extended\x0D\x0A";
|
266
|
+
break;
|
267
|
+
default:
|
268
|
+
char temp[32];
|
269
|
+
snprintf(temp, sizeof(temp),
|
270
|
+
"%d Unknown Status Code\x0D\x0A",
|
271
|
+
statusCode);
|
272
|
+
temp[sizeof(temp) - 1] = '\0';
|
273
|
+
statusLine = temp;
|
274
|
+
}
|
275
|
+
}
|
276
|
+
}
|
277
|
+
|
93
278
|
public:
|
94
279
|
HttpStatusExtractor() {
|
95
280
|
searchStart = 0;
|
@@ -47,7 +47,6 @@ passenger_static_content_handler(ngx_http_request_t *r, ngx_str_t *filename)
|
|
47
47
|
return NGX_DECLINED;
|
48
48
|
}
|
49
49
|
|
50
|
-
/* TODO: Win32 */
|
51
50
|
if (r->zero_in_uri) {
|
52
51
|
return NGX_DECLINED;
|
53
52
|
}
|
@@ -59,7 +58,12 @@ passenger_static_content_handler(ngx_http_request_t *r, ngx_str_t *filename)
|
|
59
58
|
|
60
59
|
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
|
61
60
|
|
62
|
-
|
61
|
+
#if NGX_VERSION_NUM < 7000
|
62
|
+
of.test_dir = 0;
|
63
|
+
#else
|
64
|
+
ngx_memzero(&of, sizeof(ngx_open_file_info_t));
|
65
|
+
of.directio = clcf->directio;
|
66
|
+
#endif
|
63
67
|
of.valid = clcf->open_file_cache_valid;
|
64
68
|
of.min_uses = clcf->open_file_cache_min_uses;
|
65
69
|
of.errors = clcf->open_file_cache_errors;
|
@@ -102,6 +106,10 @@ passenger_static_content_handler(ngx_http_request_t *r, ngx_str_t *filename)
|
|
102
106
|
return rc;
|
103
107
|
}
|
104
108
|
|
109
|
+
#if NGX_VERSION_NUM >= 7000
|
110
|
+
r->root_tested = !r->error_page;
|
111
|
+
#endif
|
112
|
+
|
105
113
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, 0, "http static fd: %d", of.fd);
|
106
114
|
|
107
115
|
if (of.is_dir) {
|
@@ -123,7 +131,11 @@ passenger_static_content_handler(ngx_http_request_t *r, ngx_str_t *filename)
|
|
123
131
|
len += r->args.len + 1;
|
124
132
|
}
|
125
133
|
|
126
|
-
|
134
|
+
#if NGX_VERSION_NUM < 7000
|
135
|
+
location = ngx_palloc(r->pool, len);
|
136
|
+
#else
|
137
|
+
location = ngx_pnalloc(r->pool, len);
|
138
|
+
#endif
|
127
139
|
if (location == NULL) {
|
128
140
|
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
129
141
|
}
|
@@ -214,6 +226,9 @@ passenger_static_content_handler(ngx_http_request_t *r, ngx_str_t *filename)
|
|
214
226
|
b->file->fd = of.fd;
|
215
227
|
b->file->name = *filename;
|
216
228
|
b->file->log = log;
|
229
|
+
#if NGX_VERSION_NUM >= 7000
|
230
|
+
b->file->directio = of.is_directio;
|
231
|
+
#endif
|
217
232
|
|
218
233
|
out.buf = b;
|
219
234
|
out.next = NULL;
|