summaryrefslogtreecommitdiff
path: root/modules/database
diff options
context:
space:
mode:
authorChris Darroch <chrisd@apache.org>2006-12-02 06:25:07 +0000
committerChris Darroch <chrisd@apache.org>2006-12-02 06:25:07 +0000
commit29121126c57008e9b4955a4eb64ffe8eedce18da (patch)
tree27e9f7069ed53c87b612e9dd8eb8f081f1e3bbc7 /modules/database
parentc925d34bd352a0a74ea9075592a06b3a8563056d (diff)
downloadhttpd-29121126c57008e9b4955a4eb64ffe8eedce18da.tar.gz
Stash DBD connections in request_config of initial request
only, or else sub-requests and internal redirections may cause entire DBD pool to be stashed in a single HTTP request. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@481509 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/database')
-rw-r--r--modules/database/mod_dbd.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/modules/database/mod_dbd.c b/modules/database/mod_dbd.c
index 624869c2b7..9356ce775d 100644
--- a/modules/database/mod_dbd.c
+++ b/modules/database/mod_dbd.c
@@ -524,7 +524,18 @@ static apr_status_t dbd_release(void *REQ)
DBD_DECLARE_NONSTD(ap_dbd_t *) ap_dbd_acquire(request_rec *r)
{
svr_cfg *svr;
- dbd_pool_rec *req = ap_get_module_config(r->request_config, &dbd_module);
+ dbd_pool_rec *req;
+
+ while (!ap_is_initial_req(r)) {
+ if (r->prev) {
+ r = r->prev;
+ }
+ else if (r->main) {
+ r = r->main;
+ }
+ }
+
+ req = ap_get_module_config(r->request_config, &dbd_module);
if (!req) {
req = apr_palloc(r->pool, sizeof(dbd_pool_rec));
req->conn = ap_dbd_open(r->pool, r->server);
@@ -571,7 +582,18 @@ DBD_DECLARE_NONSTD(ap_dbd_t *) ap_dbd_cacquire(conn_rec *c)
DBD_DECLARE_NONSTD(ap_dbd_t *) ap_dbd_acquire(request_rec *r)
{
svr_cfg *svr;
- ap_dbd_t *ret = ap_get_module_config(r->request_config, &dbd_module);
+ ap_dbd_t *ret;
+
+ while (!ap_is_initial_req(r)) {
+ if (r->prev) {
+ r = r->prev;
+ }
+ else if (r->main) {
+ r = r->main;
+ }
+ }
+
+ ret = ap_get_module_config(r->request_config, &dbd_module);
if (!ret) {
svr = ap_get_module_config(r->server->module_config, &dbd_module);
ret = ap_dbd_open(r->pool, r->server);