You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2010/04/29 22:07:30 UTC
svn commit: r939472 - in /httpd/mod_fcgid/trunk: ./ modules/fcgid/
Author: trawick
Date: Thu Apr 29 20:07:29 2010
New Revision: 939472
URL: http://svn.apache.org/viewvc?rev=939472&view=rev
Log:
Fix the search for processes with the proper vhost config when
ServerName isn't set in every vhost or a module updates
r->server->server_hostname dynamically (e.g., mod_vhost_cdb).
In r753578, the check for vhost was added to searches for available
processes so that only processes with the same configuration would
be found.
(In what seems like a separate issue, it was also added to the
search for the count of matching processes (spawn control).)
The check was implemented by saving r->server->server_hostname
and comparing that value. This fails in the following cases:
a) ServerName hasn't been configured in each vhost
b) some module updates r->server->server_hostname dynamically
(mod_vhost_cdb is one such module)
Change the implementation to just use the server_rec. This should
be sufficient for distinguishing potentially different vhost
configs, and it provides addressibility to server->server_hostname
for logging as well.
Modified:
httpd/mod_fcgid/trunk/CHANGES-FCGID
httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c
httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm.h
httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_main.c
httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_unix.c
httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_win.c
httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proctbl.h
httpd/mod_fcgid/trunk/modules/fcgid/fcgid_spawn_ctl.c
httpd/mod_fcgid/trunk/modules/fcgid/mod_fcgid.c
Modified: httpd/mod_fcgid/trunk/CHANGES-FCGID
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/CHANGES-FCGID?rev=939472&r1=939471&r2=939472&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/CHANGES-FCGID [utf8] (original)
+++ httpd/mod_fcgid/trunk/CHANGES-FCGID [utf8] Thu Apr 29 20:07:29 2010
@@ -1,6 +1,11 @@
-*- coding: utf-8 -*-
Changes with mod_fcgid 2.3.6
+ *) Fix the search for processes with the proper vhost config when
+ ServerName isn't set in every vhost or a module updates
+ r->server->server_hostname dynamically (e.g., mod_vhost_cdb).
+ [Jeff Trawick]
+
*) FcgidPassHeader now maps header names to environment variable names
in the usual manner: The header name is converted to upper case and
is prefixed with HTTP_. An additional environment variable is
Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c?rev=939472&r1=939471&r2=939472&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c Thu Apr 29 20:07:29 2010
@@ -45,7 +45,7 @@ static fcgid_procnode *apply_free_procno
uid_t uid = command->uid;
gid_t gid = command->gid;
const char *cmdline = command->cmdline;
- const char *virtualhost = command->virtualhost;
+ const server_rec *server = command->server;
proc_table = proctable_get_table_array();
previous_node = proctable_get_idle_list();
@@ -59,7 +59,7 @@ static fcgid_procnode *apply_free_procno
if (current_node->inode == inode
&& current_node->deviceid == deviceid
&& !strcmp(current_node->cmdline, cmdline)
- && current_node->virtualhost == virtualhost
+ && current_node->server == server
&& current_node->uid == uid && current_node->gid == gid) {
/* Unlink from idle list */
previous_node->next_index = current_node->next_index;
@@ -139,7 +139,7 @@ static int count_busy_processes(request_
if (current_node->inode == command->inode
&& current_node->deviceid == command->deviceid
&& !strcmp(current_node->cmdline, command->cmdline)
- && current_node->virtualhost == command->virtualhost
+ && current_node->server == command->server
&& current_node->uid == command->uid
&& current_node->gid == command->gid) {
result++;
Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm.h
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm.h?rev=939472&r1=939471&r2=939472&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm.h (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm.h Thu Apr 29 20:07:29 2010
@@ -25,7 +25,7 @@ typedef struct {
char cmdline[FCGID_CMDLINE_MAX];
apr_ino_t inode;
dev_t deviceid;
- const char *virtualhost; /* Virtualhost granularity */
+ const server_rec *server; /* Virtualhost granularity */
uid_t uid; /* For suEXEC */
gid_t gid; /* For suEXEC */
int userdir; /* For suEXEC */
Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_main.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_main.c?rev=939472&r1=939471&r2=939472&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_main.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_main.c Thu Apr 29 20:07:29 2010
@@ -506,7 +506,7 @@ fastcgi_spawn(fcgid_command * command, s
AP_DEBUG_ASSERT(sizeof procnode->cmdline > strlen(command->cmdline));
apr_cpystrn(procnode->cmdline, command->cmdline, sizeof procnode->cmdline);
- procnode->virtualhost = command->virtualhost;
+ procnode->server = command->server;
procnode->uid = command->uid;
procnode->gid = command->gid;
procnode->start_time = procnode->last_active_time = apr_time_now();
@@ -566,7 +566,9 @@ fastcgi_spawn(fcgid_command * command, s
procnode, proctable_array);
ap_log_error(APLOG_MARK, APLOG_INFO, 0, main_server,
"mod_fcgid: server %s:%s(%" APR_PID_T_FMT ") started",
- command->virtualhost, command->cgipath,
+ command->server->server_hostname ?
+ command->server->server_hostname : "(unknown)",
+ command->cgipath,
procnode->proc_id.pid);
register_spawn(main_server, procnode);
}
Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_unix.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_unix.c?rev=939472&r1=939471&r2=939472&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_unix.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_unix.c Thu Apr 29 20:07:29 2010
@@ -443,7 +443,7 @@ void procmgr_init_spawn_cmd(fcgid_comman
command->deviceid = cmd_conf->deviceid;
command->inode = cmd_conf->inode;
- command->virtualhost = r->server->server_hostname;
+ command->server = r->server;
get_cmd_options(r, command->cgipath, &command->cmdopts, &command->cmdenv);
}
Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_win.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_win.c?rev=939472&r1=939471&r2=939472&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_win.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_win.c Thu Apr 29 20:07:29 2010
@@ -141,7 +141,7 @@ void procmgr_init_spawn_cmd(fcgid_comman
command->uid = (uid_t) - 1;
command->gid = (gid_t) - 1;
command->userdir = 0;
- command->virtualhost = r->server->server_hostname;
+ command->server = r->server;
get_cmd_options(r, command->cgipath, &command->cmdopts, &command->cmdenv);
}
Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proctbl.h
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proctbl.h?rev=939472&r1=939471&r2=939472&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proctbl.h (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proctbl.h Thu Apr 29 20:07:29 2010
@@ -49,7 +49,7 @@ typedef struct {
char cmdline[FCGID_CMDLINE_MAX]; /* entire command line */
gid_t gid; /* for suEXEC */
uid_t uid; /* for suEXEC */
- const char *virtualhost; /* the virtualhost this process belongs to */
+ const server_rec *server; /* the virtualhost this process belongs to */
apr_time_t start_time; /* the time of this process create */
apr_time_t last_active_time; /* the time this process last active */
int requests_handled; /* number of requests process has handled */
Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_spawn_ctl.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_spawn_ctl.c?rev=939472&r1=939471&r2=939472&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_spawn_ctl.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_spawn_ctl.c Thu Apr 29 20:07:29 2010
@@ -29,7 +29,7 @@ struct fcgid_stat_node {
uid_t uid;
gid_t gid;
const char *cmdline;
- const char *virtualhost;
+ const server_rec *server;
int score;
int process_counter;
int max_class_process_count;
@@ -60,7 +60,7 @@ register_life_death(server_rec * main_se
if (current_node->inode == procnode->inode
&& current_node->deviceid == procnode->deviceid
&& !strcmp(current_node->cmdline, procnode->cmdline)
- && current_node->virtualhost == procnode->virtualhost
+ && current_node->server == procnode->server
&& current_node->uid == procnode->uid
&& current_node->gid == procnode->gid)
break;
@@ -96,7 +96,7 @@ register_life_death(server_rec * main_se
current_node->deviceid = procnode->deviceid;
current_node->inode = procnode->inode;
current_node->cmdline = apr_pstrdup(g_stat_pool, procnode->cmdline);
- current_node->virtualhost = procnode->virtualhost;
+ current_node->server = procnode->server;
current_node->uid = procnode->uid;
current_node->gid = procnode->gid;
current_node->last_stat_time = apr_time_now();
@@ -165,7 +165,7 @@ int is_spawn_allowed(server_rec * main_s
if (current_node->inode == command->inode
&& current_node->deviceid == command->deviceid
&& !strcmp(current_node->cmdline, command->cmdline)
- && current_node->virtualhost == command->virtualhost
+ && current_node->server == command->server
&& current_node->uid == command->uid
&& current_node->gid == command->gid)
break;
@@ -229,7 +229,7 @@ int is_kill_allowed(server_rec * main_se
if (current_node->inode == procnode->inode
&& current_node->deviceid == procnode->deviceid
&& !strcmp(current_node->cmdline, procnode->cmdline)
- && current_node->virtualhost == procnode->virtualhost
+ && current_node->server == procnode->server
&& current_node->uid == procnode->uid
&& current_node->gid == procnode->gid)
break;
Modified: httpd/mod_fcgid/trunk/modules/fcgid/mod_fcgid.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/mod_fcgid.c?rev=939472&r1=939471&r2=939472&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/mod_fcgid.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/mod_fcgid.c Thu Apr 29 20:07:29 2010
@@ -298,8 +298,8 @@ static int fcgidsort(fcgid_procnode **e1
cmp = strcmp((*e1)->cmdline, (*e2)->cmdline);
if (cmp != 0)
return cmp;
- if ((*e1)->virtualhost != (*e2)->virtualhost)
- return (*e1)->virtualhost > (*e2)->virtualhost ? 1 : -1;
+ if ((*e1)->server != (*e2)->server)
+ return (*e1)->server > (*e2)->server ? 1 : -1;
if ((*e1)->diewhy != (*e2)->diewhy)
return (*e1)->diewhy > (*e2)->diewhy ? 1 : -1;
if ((*e1)->node_type != (*e2)->node_type)
@@ -346,7 +346,7 @@ static int fcgid_status_hook(request_rec
uid_t last_uid = 0;
const char *last_cmdline = "";
apr_time_t now;
- const char *last_virtualhost = NULL;
+ const server_rec *last_virtualhost = NULL;
const char *basename, *tmpbasename;
fcgid_procnode *proc_table = proctable_get_table_array();
fcgid_procnode *error_list_header = proctable_get_error_list();
@@ -419,7 +419,7 @@ static int fcgid_status_hook(request_rec
if (current_node->inode != last_inode || current_node->deviceid != last_deviceid
|| current_node->gid != last_gid || current_node->uid != last_uid
|| strcmp(current_node->cmdline, last_cmdline)
- || current_node->virtualhost != last_virtualhost) {
+ || current_node->server != last_virtualhost) {
if (index != 0)
ap_rputs("</table>\n\n", r);
@@ -446,7 +446,7 @@ static int fcgid_status_hook(request_rec
last_gid = current_node->gid;
last_uid = current_node->uid;
last_cmdline = current_node->cmdline;
- last_virtualhost = current_node->virtualhost;
+ last_virtualhost = current_node->server;
}
ap_rprintf(r, "<tr><td>%" APR_PID_T_FMT "</td><td>%" APR_TIME_T_FMT "</td><td>%" APR_TIME_T_FMT "</td><td>%d</td><td>%s</td></tr>",