Skip to content
Browse files

Add some comments and refactor some code.

  • Loading branch information...
1 parent caaca91 commit 796d094a4d96e918eaf4d899a3cc4065024f7c20 @FooBarWidget FooBarWidget committed Aug 24, 2009
Showing with 20 additions and 4 deletions.
  1. +8 −0 ext/apache2/Configuration.h
  2. +12 −4 ext/apache2/Hooks.cpp
View
8 ext/apache2/Configuration.h
@@ -337,6 +337,14 @@
*/
const char *tempDir;
+ const char *getRuby() const {
+ if (ruby != NULL) {
+ return ruby;
+ } else {
+ return "ruby";
+ }
+ }
+
const char *getDefaultUser() const {
if (defaultUser != NULL) {
return defaultUser;
View
16 ext/apache2/Hooks.cpp
@@ -68,7 +68,16 @@ using namespace Passenger;
extern "C" module AP_MODULE_DECLARE_DATA passenger_module;
-#define DEFAULT_RUBY_COMMAND "ruby"
+/*
+ * This is the main source file which interfaces directly with Apache by
+ * installing hooks. The code here can look a bit convoluted, but it'll make
+ * more sense if you read:
+ * http://httpd.apache.org/docs/2.2/developer/request.html
+ *
+ * Scroll all the way down to passenger_register_hooks to get an idea of
+ * what we're hooking into and what we do in those hooks.
+ */
+
/**
* If the HTTP client sends POST data larger than this value (in bytes),
@@ -1141,7 +1150,7 @@ class Hooks {
P_DEBUG("Initializing Phusion Passenger...");
ap_add_version_component(pconf, "Phusion_Passenger/" PASSENGER_VERSION);
- const char *ruby, *user;
+ const char *user;
string applicationPoolServerExe, spawnServer;
/*
@@ -1156,7 +1165,6 @@ class Hooks {
config->getDefaultUser(), unixd_config.user_id,
unixd_config.group_id);
- ruby = (config->ruby != NULL) ? config->ruby : DEFAULT_RUBY_COMMAND;
if (config->userSwitching) {
user = "";
} else {
@@ -1190,7 +1198,7 @@ class Hooks {
applicationPoolServer = ptr(
new ApplicationPoolServer(
applicationPoolServerExe, spawnServer, "",
- ruby, user)
+ config->getRuby(), user)
);
ApplicationPoolPtr pool(applicationPoolServer->connect());

0 comments on commit 796d094

Please sign in to comment.
Something went wrong with that request. Please try again.