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
data/test/CxxTestMain.cpp
CHANGED
@@ -88,19 +88,19 @@ parseOptions(int argc, char *argv[]) {
|
|
88
88
|
* Creates a Phusion Passenger temp dir at the beginning, and deletes it
|
89
89
|
* at program exit.
|
90
90
|
*/
|
91
|
-
struct
|
92
|
-
|
91
|
+
struct TempDirSetup {
|
92
|
+
TempDirSetup() {
|
93
93
|
char command[1024];
|
94
94
|
|
95
|
-
Passenger::createPassengerTempDir(
|
96
|
-
|
95
|
+
Passenger::createPassengerTempDir("", geteuid() == 0,
|
96
|
+
"nobody", geteuid(), getgid());
|
97
97
|
|
98
98
|
snprintf(command, sizeof(command), "chmod -R u=rwx,g=rwx,o=rwx \"%s\"",
|
99
99
|
Passenger::getPassengerTempDir().c_str());
|
100
100
|
system(command);
|
101
101
|
}
|
102
102
|
|
103
|
-
~
|
103
|
+
~TempDirSetup() {
|
104
104
|
Passenger::removeDirTree(Passenger::getPassengerTempDir());
|
105
105
|
}
|
106
106
|
};
|
@@ -117,7 +117,7 @@ main(int argc, char *argv[]) {
|
|
117
117
|
allGroups = tut::runner.get().list_groups();
|
118
118
|
parseOptions(argc, argv);
|
119
119
|
|
120
|
-
|
120
|
+
TempDirSetup ts;
|
121
121
|
|
122
122
|
try {
|
123
123
|
bool all_ok = true;
|
@@ -178,4 +178,21 @@ namespace tut {
|
|
178
178
|
ensure_equals(ex.getStatusLine(), "202 Blabla\r\n");
|
179
179
|
ensure_equals(ex.getBuffer(), string(data) + data2);
|
180
180
|
}
|
181
|
+
|
182
|
+
TEST_METHOD(11) {
|
183
|
+
// If the status in the HTTP data doesn't contain a status text,
|
184
|
+
// then the status text is added.
|
185
|
+
const char data[] = "Status: 200\r\n\r\n";
|
186
|
+
ensure(ex.feed(data, sizeof(data) - 1));
|
187
|
+
ensure_equals(ex.getStatusLine(), "200 OK\r\n");
|
188
|
+
}
|
189
|
+
|
190
|
+
TEST_METHOD(12) {
|
191
|
+
// If the status in the HTTP data doesn't contain a status text,
|
192
|
+
// and the status code is not recognized, then the status text
|
193
|
+
// "Unknown Status Code" is added.
|
194
|
+
const char data[] = "Status: 999\r\n\r\n";
|
195
|
+
ensure(ex.feed(data, sizeof(data) - 1));
|
196
|
+
ensure_equals(ex.getStatusLine(), "999 Unknown Status Code\r\n");
|
197
|
+
}
|
181
198
|
}
|
data/test/UtilsTest.cpp
CHANGED
@@ -17,28 +17,19 @@ namespace tut {
|
|
17
17
|
struct UtilsTest {
|
18
18
|
vector<string> output;
|
19
19
|
string oldPath;
|
20
|
-
|
20
|
+
string oldPassengerTempDir;
|
21
21
|
|
22
22
|
UtilsTest() {
|
23
23
|
oldPath = getenv("PATH");
|
24
|
-
|
25
|
-
|
26
|
-
oldInstanceTempDir = strdup(oldInstanceTempDir);
|
27
|
-
}
|
28
|
-
|
24
|
+
oldPassengerTempDir = getPassengerTempDir();
|
25
|
+
setPassengerTempDir("");
|
29
26
|
unsetenv("TMPDIR");
|
30
|
-
unsetenv("PASSENGER_INSTANCE_TEMP_DIR");
|
31
27
|
}
|
32
28
|
|
33
29
|
~UtilsTest() {
|
34
30
|
setenv("PATH", oldPath.c_str(), 1);
|
35
31
|
unsetenv("TMPDIR");
|
36
|
-
|
37
|
-
unsetenv("PASSENGER_INSTANCE_TEMP_DIR");
|
38
|
-
} else {
|
39
|
-
setenv("PASSENGER_INSTANCE_TEMP_DIR", oldInstanceTempDir, 1);
|
40
|
-
free(oldInstanceTempDir);
|
41
|
-
}
|
32
|
+
setPassengerTempDir(oldPassengerTempDir);
|
42
33
|
}
|
43
34
|
};
|
44
35
|
|
@@ -168,31 +159,29 @@ namespace tut {
|
|
168
159
|
}
|
169
160
|
|
170
161
|
TEST_METHOD(16) {
|
171
|
-
// It
|
172
|
-
|
162
|
+
// It returns the cached value if it's not the empty string.
|
163
|
+
setPassengerTempDir("/foo");
|
164
|
+
ensure_equals(getPassengerTempDir(), "/foo");
|
165
|
+
|
166
|
+
setPassengerTempDir("/bar");
|
167
|
+
ensure_equals(getPassengerTempDir(), "/bar");
|
173
168
|
|
169
|
+
char dir[128];
|
174
170
|
snprintf(dir, sizeof(dir), "/tmp/passenger.%lu", (unsigned long) getpid());
|
175
|
-
|
176
|
-
ensure_equals(
|
171
|
+
setPassengerTempDir("");
|
172
|
+
ensure_equals(getPassengerTempDir(), dir);
|
177
173
|
}
|
178
174
|
|
179
175
|
TEST_METHOD(17) {
|
180
|
-
// It
|
181
|
-
// variable if it's not NULL and not an empty string.
|
182
|
-
setenv("PASSENGER_INSTANCE_TEMP_DIR", "/foo", 1);
|
183
|
-
ensure_equals(getPassengerTempDir(), "/foo");
|
184
|
-
}
|
185
|
-
|
186
|
-
TEST_METHOD(18) {
|
187
|
-
// It does not use query the PASSENGER_INSTANCE_TEMP_DIR environment variable if bypassCache is true.
|
176
|
+
// It does not use query the cached value if bypassCache is true.
|
188
177
|
char dir[128];
|
189
178
|
|
190
|
-
|
179
|
+
setPassengerTempDir("/foo");
|
191
180
|
snprintf(dir, sizeof(dir), "/tmp/passenger.%lu", (unsigned long) getpid());
|
192
181
|
ensure_equals(getPassengerTempDir(true), dir);
|
193
182
|
}
|
194
183
|
|
195
|
-
TEST_METHOD(
|
184
|
+
TEST_METHOD(18) {
|
196
185
|
// It uses the systemTempDir argument if it's not the empty string.
|
197
186
|
char dir[128];
|
198
187
|
|
@@ -205,7 +194,7 @@ namespace tut {
|
|
205
194
|
|
206
195
|
struct TemporarilySetInstanceTempDir {
|
207
196
|
TemporarilySetInstanceTempDir() {
|
208
|
-
|
197
|
+
setPassengerTempDir("utils_test.tmp");
|
209
198
|
mkdir("utils_test.tmp", S_IRWXU);
|
210
199
|
mkdir(BufferedUpload::getDir().c_str(), S_IRWXU);
|
211
200
|
}
|
@@ -8,8 +8,8 @@ include PhusionPassenger
|
|
8
8
|
|
9
9
|
describe AbstractRequestHandler do
|
10
10
|
before :each do
|
11
|
-
@
|
12
|
-
|
11
|
+
@old_passenger_tmpdir = Utils.passenger_tmpdir
|
12
|
+
Utils.passenger_tmpdir = "abstract_request_handler_spec.tmp"
|
13
13
|
@owner_pipe = IO.pipe
|
14
14
|
@request_handler = AbstractRequestHandler.new(@owner_pipe[1])
|
15
15
|
def @request_handler.process_request(*args)
|
@@ -20,11 +20,7 @@ describe AbstractRequestHandler do
|
|
20
20
|
after :each do
|
21
21
|
@request_handler.cleanup
|
22
22
|
@owner_pipe[0].close rescue nil
|
23
|
-
|
24
|
-
ENV['PASSENGER_INSTANCE_TEMP_DIR'] = @old_instance_temp_dir
|
25
|
-
else
|
26
|
-
ENV.delete('PASSENGER_INSTANCE_TEMP_DIR')
|
27
|
-
end
|
23
|
+
Utils.passenger_tmpdir = @old_passenger_tmpdir
|
28
24
|
FileUtils.rm_rf("abstract_request_handler_spec.tmp")
|
29
25
|
end
|
30
26
|
|
data/test/ruby/utils_spec.rb
CHANGED
@@ -11,57 +11,62 @@ describe Utils do
|
|
11
11
|
|
12
12
|
specify "#close_all_io_objects_for_fds closes all IO objects that are associated with the given file descriptors" do
|
13
13
|
filename = "#{Dir.tmpdir}/passenger_test.#{Process.pid}.txt"
|
14
|
+
puts "#{$$}: 1"
|
14
15
|
begin
|
15
16
|
pid = fork do
|
16
17
|
begin
|
18
|
+
puts "#{$$}: 2"
|
17
19
|
a, b = IO.pipe
|
20
|
+
puts "#{$$}: 3"
|
18
21
|
close_all_io_objects_for_fds([0, 1, 2])
|
22
|
+
puts "#{$$}: 4"
|
19
23
|
File.open(filename, "w") do |f|
|
20
24
|
f.write("#{a.closed?}, #{b.closed?}")
|
21
25
|
end
|
26
|
+
puts "#{$$}: 5"
|
22
27
|
rescue Exception => e
|
23
28
|
print_exception("utils_spec", e)
|
24
29
|
ensure
|
30
|
+
puts "#{$$}: 6"
|
25
31
|
exit!
|
26
32
|
end
|
27
33
|
end
|
34
|
+
puts "#{$$}: 6"
|
28
35
|
Process.waitpid(pid) rescue nil
|
36
|
+
puts "#{$$}: 7"
|
29
37
|
File.read(filename).should == "true, true"
|
30
38
|
ensure
|
39
|
+
puts "#{$$}: 8"
|
31
40
|
File.unlink(filename) rescue nil
|
32
41
|
end
|
33
42
|
end
|
34
43
|
|
35
44
|
describe "#passenger_tmpdir" do
|
36
45
|
before :each do
|
37
|
-
@
|
38
|
-
|
46
|
+
@old_passenger_tmpdir = Utils.passenger_tmpdir
|
47
|
+
Utils.passenger_tmpdir = nil
|
39
48
|
end
|
40
49
|
|
41
50
|
after :each do
|
42
|
-
|
43
|
-
ENV['PASSENGER_INSTANCE_TEMP_DIR'] = @old_instance_temp_dir
|
44
|
-
else
|
45
|
-
ENV.delete('PASSENGER_INSTANCE_TEMP_DIR')
|
46
|
-
end
|
51
|
+
Utils.passenger_tmpdir = @old_passenger_tmpdir
|
47
52
|
end
|
48
53
|
|
49
|
-
it "returns a directory under Dir.tmpdir if
|
54
|
+
it "returns a directory under Dir.tmpdir if Utils.passenger_tmpdir is nil" do
|
50
55
|
File.dirname(passenger_tmpdir(false)).should == Dir.tmpdir
|
51
56
|
end
|
52
57
|
|
53
|
-
it "returns a directory under Dir.tmpdir if
|
54
|
-
|
58
|
+
it "returns a directory under Dir.tmpdir if Utils.passenger_tmpdir is an empty string" do
|
59
|
+
Utils.passenger_tmpdir = ''
|
55
60
|
File.dirname(passenger_tmpdir(false)).should == Dir.tmpdir
|
56
61
|
end
|
57
62
|
|
58
|
-
it "returns
|
59
|
-
|
63
|
+
it "returns Utils.passenger_tmpdir if it's set" do
|
64
|
+
Utils.passenger_tmpdir = '/foo'
|
60
65
|
passenger_tmpdir(false).should == '/foo'
|
61
66
|
end
|
62
67
|
|
63
68
|
it "creates the directory if it doesn't exist, if the 'create' argument is true" do
|
64
|
-
|
69
|
+
Utils.passenger_tmpdir = 'utils_spec.tmp'
|
65
70
|
passenger_tmpdir
|
66
71
|
begin
|
67
72
|
File.directory?('utils_spec.tmp').should be_true
|
@@ -10,21 +10,17 @@ describe PhusionPassenger::WSGI::ApplicationSpawner do
|
|
10
10
|
include PhusionPassenger::Utils
|
11
11
|
|
12
12
|
before :each do
|
13
|
-
@
|
14
|
-
|
13
|
+
@old_passenger_tmpdir = Utils.passenger_tmpdir
|
14
|
+
Utils.passenger_tmpdir = "#{Dir.tmpdir}/wsgi_test.tmp"
|
15
15
|
@stub = setup_stub('wsgi')
|
16
16
|
File.unlink("#{@stub.app_root}/passenger_wsgi.pyc") rescue nil
|
17
17
|
end
|
18
18
|
|
19
19
|
after :each do
|
20
20
|
@stub.destroy
|
21
|
-
FileUtils.chmod_R(0700,
|
22
|
-
FileUtils.rm_rf(
|
23
|
-
|
24
|
-
ENV['PASSENGER_INSTANCE_TEMP_DIR'] = @old_instance_temp_dir
|
25
|
-
else
|
26
|
-
ENV.delete('PASSENGER_INSTANCE_TEMP_DIR')
|
27
|
-
end
|
21
|
+
FileUtils.chmod_R(0700, Utils.passenger_tmpdir)
|
22
|
+
FileUtils.rm_rf(Utils.passenger_tmpdir)
|
23
|
+
Utils.passenger_tmpdir = @old_passenger_tmpdir
|
28
24
|
end
|
29
25
|
|
30
26
|
it "can spawn our stub application" do
|
File without changes
|
File without changes
|
data/test/support/Support.h
CHANGED
@@ -13,6 +13,10 @@ namespace Test {
|
|
13
13
|
|
14
14
|
using namespace std;
|
15
15
|
|
16
|
+
/**
|
17
|
+
* Class which creates a temporary directory of the given name, and deletes
|
18
|
+
* it upon destruction.
|
19
|
+
*/
|
16
20
|
class TempDir {
|
17
21
|
private:
|
18
22
|
string name;
|
@@ -35,6 +39,22 @@ public:
|
|
35
39
|
}
|
36
40
|
};
|
37
41
|
|
42
|
+
/**
|
43
|
+
* Class which deletes the given file upon destruction.
|
44
|
+
*/
|
45
|
+
class DeleteFileEventually {
|
46
|
+
private:
|
47
|
+
string filename;
|
48
|
+
public:
|
49
|
+
DeleteFileEventually(const string &filename) {
|
50
|
+
this->filename = filename;
|
51
|
+
}
|
52
|
+
|
53
|
+
DeleteFileEventually() {
|
54
|
+
unlink(filename.c_str());
|
55
|
+
}
|
56
|
+
};
|
57
|
+
|
38
58
|
} // namespace Test
|
39
59
|
|
40
60
|
#endif /* _TEST_SUPPORT_H_ */
|
data/test/support/config.rb
CHANGED
@@ -11,3 +11,16 @@ rescue Errno::ENOENT
|
|
11
11
|
"test/config.yml, and edit it."
|
12
12
|
exit 1
|
13
13
|
end
|
14
|
+
|
15
|
+
require 'fileutils'
|
16
|
+
require 'phusion_passenger/utils'
|
17
|
+
|
18
|
+
# Calculate location of the temp dir and cache it.
|
19
|
+
PhusionPassenger::Utils.passenger_tmpdir
|
20
|
+
|
21
|
+
Spec::Runner.configure do |config|
|
22
|
+
config.append_after do
|
23
|
+
FileUtils.chmod_R(0777, PhusionPassenger::Utils.passenger_tmpdir);
|
24
|
+
FileUtils.rm_rf(PhusionPassenger::Utils.passenger_tmpdir)
|
25
|
+
end
|
26
|
+
end
|
data/vendor/README
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
You might be wondering why the Rack library is vendored, and why we don't
|
2
2
|
just depend on the Rack gem. The reason for this is because there are broken
|
3
3
|
applications out there that have a hard dependency on rack == 0.4.0 (the
|
4
|
-
latest version of Rack is 0.
|
4
|
+
latest version of Rack is 1.0.0 at the time of writing). If Passenger
|
5
5
|
depends on the Rack gem, then the application will crash with a gem version
|
6
6
|
conflict error upon executing 'gem "rack", "=0.4.0"'.
|
7
7
|
|
8
8
|
To fix this conflict, we vendor Rack. When we load our vendored Rack library,
|
9
9
|
it won't be registered as a gem, so no RubyGems version conflict exception
|
10
|
-
will be raised.
|
10
|
+
will be raised. This vendored version is commit 884770528a3, slightly older
|
11
|
+
than the 1.0.0 release.
|
11
12
|
|
12
|
-
Rack is backwards-compatible so there shouldn't be any problems.
|
13
|
+
Rack is mostly backwards-compatible so there shouldn't be any problems.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2007 Christian Neukirchen <purl.org/net/chneukirchen>
|
1
|
+
Copyright (c) 2007, 2008, 2009 Christian Neukirchen <purl.org/net/chneukirchen>
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
of this software and associated documentation files (the "Software"), to
|
File without changes
|
@@ -9,6 +9,24 @@ middleware) into a single method call.
|
|
9
9
|
The exact details of this are described in the Rack specification,
|
10
10
|
which all Rack applications should conform to.
|
11
11
|
|
12
|
+
== Specification changes in this release
|
13
|
+
|
14
|
+
With Rack 1.0, the Rack specification (found in SPEC) changed in the
|
15
|
+
following backward-incompatible ways. This was done to properly
|
16
|
+
support Ruby 1.9 and to deprecate some problematic techniques:
|
17
|
+
|
18
|
+
* Rack::VERSION has been pushed to [1,0].
|
19
|
+
* Header values must be Strings now, split on "\n".
|
20
|
+
* rack.input must be rewindable and support reading into a buffer,
|
21
|
+
wrap with Rack::RewindableInput if it isn't.
|
22
|
+
* Content-Length can be missing, in this case chunked transfer
|
23
|
+
encoding is used.
|
24
|
+
* Bodies can now additionally respond to #to_path with a filename to
|
25
|
+
be served.
|
26
|
+
* String bodies are deprecated and will not work with Ruby 1.9, use an
|
27
|
+
Array with a single String instead.
|
28
|
+
* rack.session is now specified.
|
29
|
+
|
12
30
|
== Supported web servers
|
13
31
|
|
14
32
|
The included *handlers* connect all kinds of web servers to Rack:
|
@@ -25,7 +43,8 @@ The included *handlers* connect all kinds of web servers to Rack:
|
|
25
43
|
These web servers include Rack handlers in their distributions:
|
26
44
|
* Ebb
|
27
45
|
* Fuzed
|
28
|
-
* Phusion Passenger (which is mod_rack for Apache)
|
46
|
+
* Phusion Passenger (which is mod_rack for Apache and for nginx)
|
47
|
+
* Unicorn
|
29
48
|
|
30
49
|
Any valid Rack app will run the same on all these handlers, without
|
31
50
|
changing anything.
|
@@ -36,6 +55,7 @@ The included *adapters* connect Rack with existing Ruby web frameworks:
|
|
36
55
|
* Camping
|
37
56
|
|
38
57
|
These frameworks include Rack adapters in their distributions:
|
58
|
+
* Camping
|
39
59
|
* Coset
|
40
60
|
* Halcyon
|
41
61
|
* Mack
|
@@ -44,13 +64,15 @@ These frameworks include Rack adapters in their distributions:
|
|
44
64
|
* Racktools::SimpleApplication
|
45
65
|
* Ramaze
|
46
66
|
* Ruby on Rails
|
67
|
+
* Rum
|
47
68
|
* Sinatra
|
48
69
|
* Sin
|
49
70
|
* Vintage
|
50
71
|
* Waves
|
72
|
+
* Wee
|
51
73
|
|
52
74
|
Current links to these projects can be found at
|
53
|
-
http://ramaze.net
|
75
|
+
http://wiki.ramaze.net/Home#other-frameworks
|
54
76
|
|
55
77
|
== Available middleware
|
56
78
|
|
@@ -140,10 +162,11 @@ installation and test-spec.
|
|
140
162
|
To run the test suite completely, you need:
|
141
163
|
|
142
164
|
* camping
|
143
|
-
* mongrel
|
144
165
|
* fcgi
|
145
|
-
* ruby-openid
|
146
166
|
* memcache-client
|
167
|
+
* mongrel
|
168
|
+
* ruby-openid
|
169
|
+
* thin
|
147
170
|
|
148
171
|
The full set of tests test FCGI access with lighttpd (on port
|
149
172
|
9203) so you will need lighttpd installed as well as the FCGI
|
@@ -227,6 +250,28 @@ run on port 11211) and memcache-client installed.
|
|
227
250
|
* January 9th, 2009: Sixth public release 0.9.1.
|
228
251
|
* Fix directory traversal exploits in Rack::File and Rack::Directory.
|
229
252
|
|
253
|
+
* April 25th, 2009: Seventh public release 1.0.0.
|
254
|
+
* SPEC change: Rack::VERSION has been pushed to [1,0].
|
255
|
+
* SPEC change: header values must be Strings now, split on "\n".
|
256
|
+
* SPEC change: Content-Length can be missing, in this case chunked transfer
|
257
|
+
encoding is used.
|
258
|
+
* SPEC change: rack.input must be rewindable and support reading into
|
259
|
+
a buffer, wrap with Rack::RewindableInput if it isn't.
|
260
|
+
* SPEC change: rack.session is now specified.
|
261
|
+
* SPEC change: Bodies can now additionally respond to #to_path with
|
262
|
+
a filename to be served.
|
263
|
+
* NOTE: String bodies break in 1.9, use an Array consisting of a
|
264
|
+
single String instead.
|
265
|
+
* New middleware Rack::Lock.
|
266
|
+
* New middleware Rack::ContentType.
|
267
|
+
* Rack::Reloader has been rewritten.
|
268
|
+
* Major update to Rack::Auth::OpenID.
|
269
|
+
* Support for nested parameter parsing in Rack::Response.
|
270
|
+
* Support for redirects in Rack::Response.
|
271
|
+
* HttpOnly cookie support in Rack::Response.
|
272
|
+
* The Rakefile has been rewritten.
|
273
|
+
* Many bugfixes and small improvements.
|
274
|
+
|
230
275
|
== Contact
|
231
276
|
|
232
277
|
Please mail bugs, suggestions and patches to
|
@@ -237,7 +282,7 @@ Mailing list archives are available at
|
|
237
282
|
|
238
283
|
There is a bug tracker at <http://rack.lighthouseapp.com/>.
|
239
284
|
|
240
|
-
Git repository (
|
285
|
+
Git repository (send Git patches to the mailing list):
|
241
286
|
* http://github.com/rack/rack
|
242
287
|
* http://git.vuxu.org/cgi-bin/gitweb.cgi?p=rack.git
|
243
288
|
|
@@ -262,8 +307,10 @@ would like to thank:
|
|
262
307
|
* Luc Heinrich for the Cookie sessions, the static file handler and bugfixes.
|
263
308
|
* Armin Ronacher, for the logo and racktools.
|
264
309
|
* Aredridel, Ben Alpert, Dan Kubb, Daniel Roethlisberger, Matt Todd,
|
265
|
-
Tom Robinson,
|
266
|
-
improvements.
|
310
|
+
Tom Robinson, Phil Hagelberg, and S. Brent Faulkner for bug fixing
|
311
|
+
and other improvements.
|
312
|
+
* Brian Candler, for Rack::ContentType.
|
313
|
+
* Graham Batty, for improved handler loading.
|
267
314
|
* Stephen Bannasch, for bug reports and documentation.
|
268
315
|
* Gary Wright, for proposing a better Rack::Response interface.
|
269
316
|
* Jonathan Buch, for improvements regarding Rack::Response.
|