You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ch...@apache.org on 2010/01/29 01:16:07 UTC
svn commit: r904317 - in /httpd/mod_fcgid/trunk: CHANGES-FCGID
modules/fcgid/fcgid_bridge.c modules/fcgid/fcgid_bridge.h
modules/fcgid/mod_fcgid.c
Author: chrisd
Date: Fri Jan 29 00:16:07 2010
New Revision: 904317
URL: http://svn.apache.org/viewvc?rev=904317&view=rev
Log:
In FCGI_AUTHORIZER role, avoid spawning a new process for every
different HTTP request. This incorrect behaviour occurred because
the inode, deviceid, etc. used to look up existing processes were
always extracted from r->finfo. In the FCGI_AUTHORIZER role, this is
just whatever resource is being protected (e.g., an image file);
instead we want to use the inode, deviceid, etc. for the configured program.
Modified:
httpd/mod_fcgid/trunk/CHANGES-FCGID
httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c
httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.h
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=904317&r1=904316&r2=904317&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/CHANGES-FCGID [utf8] (original)
+++ httpd/mod_fcgid/trunk/CHANGES-FCGID [utf8] Fri Jan 29 00:16:07 2010
@@ -1,7 +1,8 @@
-*- coding: utf-8 -*-
Changes with mod_fcgid 2.3.6
-
+ *) In FCGI_AUTHORIZER role, avoid spawning a new process for every
+ different HTTP request. [Chris Darroch]
Changes with mod_fcgid 2.3.5
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=904317&r1=904316&r2=904317&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c Fri Jan 29 00:16:07 2010
@@ -283,12 +283,16 @@
static int
handle_request(request_rec * r, int role, const char *argv0,
+ fcgid_auth_conf * auth_conf,
fcgid_wrapper_conf * wrapper_conf,
apr_bucket_brigade * output_brigade)
{
apr_pool_t *request_pool = r->main ? r->main->pool : r->pool;
fcgid_command fcgi_request;
fcgid_bucket_ctx *bucket_ctx;
+ apr_ino_t inode;
+ apr_dev_t deviceid;
+ apr_size_t shareid;
int i, j, cond_status;
apr_status_t rv;
apr_bucket_brigade *brigade_stdout;
@@ -301,17 +305,22 @@
apr_pool_cleanup_register(request_pool, bucket_ctx,
bucket_ctx_cleanup, apr_pool_cleanup_null);
+ if (role == FCGI_AUTHORIZER) {
+ argv0 = auth_conf->path;
+ inode = wrapper_conf ? wrapper_conf->inode : auth_conf->inode;
+ deviceid = wrapper_conf ? wrapper_conf->deviceid : auth_conf->deviceid;
+ shareid = wrapper_conf ? wrapper_conf->share_group_id
+ : auth_conf->share_group_id;
+ } else {
+ inode = wrapper_conf ? wrapper_conf->inode : r->finfo.inode;
+ deviceid = wrapper_conf ? wrapper_conf->deviceid : r->finfo.device;
+ shareid = wrapper_conf ? wrapper_conf->share_group_id : 0;
+ }
+
/* Try to get a connected ipc handle */
for (i = 0; i < FCGID_REQUEST_COUNT; i++) {
/* Apply a free process slot, send a spawn request if I can't get one */
for (j = 0; j < FCGID_APPLY_TRY_COUNT; j++) {
- apr_ino_t inode =
- wrapper_conf ? wrapper_conf->inode : r->finfo.inode;
- apr_dev_t deviceid =
- wrapper_conf ? wrapper_conf->deviceid : r->finfo.device;
- apr_size_t shareid =
- wrapper_conf ? wrapper_conf->share_group_id : 0;
-
/* Init spawn request */
procmgr_init_spawn_cmd(&fcgi_request, r, argv0, deviceid,
inode, shareid);
@@ -617,6 +626,7 @@
}
int bridge_request(request_rec * r, int role, const char *argv0,
+ fcgid_auth_conf * auth_conf,
fcgid_wrapper_conf * wrapper_conf)
{
apr_pool_t *request_pool = r->main ? r->main->pool : r->pool;
@@ -652,5 +662,6 @@
APR_BRIGADE_INSERT_TAIL(output_brigade, bucket_eos);
/* Bridge the request */
- return handle_request(r, role, argv0, wrapper_conf, output_brigade);
+ return handle_request(r, role, argv0, auth_conf, wrapper_conf,
+ output_brigade);
}
Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.h
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.h?rev=904317&r1=904316&r2=904317&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.h (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.h Fri Jan 29 00:16:07 2010
@@ -25,6 +25,7 @@
apr_status_t bucket_ctx_cleanup(void *thectx);
int bridge_request(request_rec * r, int role, const char *argv0,
+ fcgid_auth_conf * auth_conf,
fcgid_wrapper_conf * wrapper_conf);
#endif
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=904317&r1=904316&r2=904317&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/mod_fcgid.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/mod_fcgid.c Fri Jan 29 00:16:07 2010
@@ -232,7 +232,7 @@
r->connection);
http_retcode =
- bridge_request(r, FCGI_RESPONDER, command, wrapper_conf);
+ bridge_request(r, FCGI_RESPONDER, command, NULL, wrapper_conf);
return (http_retcode == HTTP_OK ? OK : http_retcode);
}
@@ -477,7 +477,7 @@
/* Handle the request */
res =
- bridge_request(r, FCGI_AUTHORIZER, authenticator_info->path,
+ bridge_request(r, FCGI_AUTHORIZER, NULL, authenticator_info,
wrapper_conf);
/* Restore r->subprocess_env */
@@ -566,7 +566,7 @@
/* Handle the request */
res =
- bridge_request(r, FCGI_AUTHORIZER, authorizer_info->path,
+ bridge_request(r, FCGI_AUTHORIZER, NULL, authorizer_info,
wrapper_conf);
/* Restore r->subprocess_env */
@@ -656,7 +656,7 @@
/* Handle the request */
res =
- bridge_request(r, FCGI_AUTHORIZER, access_info->path,
+ bridge_request(r, FCGI_AUTHORIZER, NULL, access_info,
wrapper_conf);
/* Restore r->subprocess_env */