Lines 385-394
Link Here
|
385 |
static const char *lockname; |
385 |
static const char *lockname; |
386 |
static apr_global_mutex_t *rewrite_mapr_lock_acquire = NULL; |
386 |
static apr_global_mutex_t *rewrite_mapr_lock_acquire = NULL; |
387 |
|
387 |
|
388 |
#ifndef REWRITELOG_DISABLED |
|
|
389 |
static apr_global_mutex_t *rewrite_log_lock = NULL; |
390 |
#endif |
391 |
|
392 |
/* Optional functions imported from mod_ssl when loaded: */ |
388 |
/* Optional functions imported from mod_ssl when loaded: */ |
393 |
static APR_OPTIONAL_FN_TYPE(ssl_var_lookup) *rewrite_ssl_lookup = NULL; |
389 |
static APR_OPTIONAL_FN_TYPE(ssl_var_lookup) *rewrite_ssl_lookup = NULL; |
394 |
static APR_OPTIONAL_FN_TYPE(ssl_is_https) *rewrite_is_https = NULL; |
390 |
static APR_OPTIONAL_FN_TYPE(ssl_is_https) *rewrite_is_https = NULL; |
Lines 489-495
Link Here
|
489 |
const char *rhost, *rname; |
485 |
const char *rhost, *rname; |
490 |
apr_size_t nbytes; |
486 |
apr_size_t nbytes; |
491 |
int redir; |
487 |
int redir; |
492 |
apr_status_t rv; |
|
|
493 |
request_rec *req; |
488 |
request_rec *req; |
494 |
va_list ap; |
489 |
va_list ap; |
495 |
|
490 |
|
Lines 535-557
Link Here
|
535 |
if (!conf->rewritelogfp || level > conf->rewriteloglevel) |
530 |
if (!conf->rewritelogfp || level > conf->rewriteloglevel) |
536 |
return; |
531 |
return; |
537 |
|
532 |
|
538 |
rv = apr_global_mutex_lock(rewrite_log_lock); |
|
|
539 |
if (rv != APR_SUCCESS) { |
540 |
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, |
541 |
"apr_global_mutex_lock(rewrite_log_lock) failed"); |
542 |
/* XXX: Maybe this should be fatal? */ |
543 |
} |
544 |
|
545 |
nbytes = strlen(logline); |
533 |
nbytes = strlen(logline); |
546 |
apr_file_write(conf->rewritelogfp, logline, &nbytes); |
534 |
apr_file_write(conf->rewritelogfp, logline, &nbytes); |
547 |
|
535 |
|
548 |
rv = apr_global_mutex_unlock(rewrite_log_lock); |
|
|
549 |
if (rv != APR_SUCCESS) { |
550 |
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, |
551 |
"apr_global_mutex_unlock(rewrite_log_lock) failed"); |
552 |
/* XXX: Maybe this should be fatal? */ |
553 |
} |
554 |
|
555 |
return; |
536 |
return; |
556 |
} |
537 |
} |
557 |
#endif /* !REWRITELOG_DISABLED */ |
538 |
#endif /* !REWRITELOG_DISABLED */ |
Lines 4326-4351
Link Here
|
4326 |
/* check if proxy module is available */ |
4307 |
/* check if proxy module is available */ |
4327 |
proxy_available = (ap_find_linked_module("mod_proxy.c") != NULL); |
4308 |
proxy_available = (ap_find_linked_module("mod_proxy.c") != NULL); |
4328 |
|
4309 |
|
4329 |
#ifndef REWRITELOG_DISABLED |
|
|
4330 |
/* create the rewriting lockfiles in the parent */ |
4331 |
if ((rv = apr_global_mutex_create(&rewrite_log_lock, NULL, |
4332 |
APR_LOCK_DEFAULT, p)) != APR_SUCCESS) { |
4333 |
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s, |
4334 |
"mod_rewrite: could not create rewrite_log_lock"); |
4335 |
return HTTP_INTERNAL_SERVER_ERROR; |
4336 |
} |
4337 |
|
4338 |
#ifdef AP_NEED_SET_MUTEX_PERMS |
4339 |
rv = ap_unixd_set_global_mutex_perms(rewrite_log_lock); |
4340 |
if (rv != APR_SUCCESS) { |
4341 |
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s, |
4342 |
"mod_rewrite: Could not set permissions on " |
4343 |
"rewrite_log_lock; check User and Group directives"); |
4344 |
return HTTP_INTERNAL_SERVER_ERROR; |
4345 |
} |
4346 |
#endif /* perms */ |
4347 |
#endif /* rewritelog */ |
4348 |
|
4349 |
rv = rewritelock_create(s, p); |
4310 |
rv = rewritelock_create(s, p); |
4350 |
if (rv != APR_SUCCESS) { |
4311 |
if (rv != APR_SUCCESS) { |
4351 |
return HTTP_INTERNAL_SERVER_ERROR; |
4312 |
return HTTP_INTERNAL_SERVER_ERROR; |
Lines 4392-4405
Link Here
|
4392 |
} |
4353 |
} |
4393 |
} |
4354 |
} |
4394 |
|
4355 |
|
4395 |
#ifndef REWRITELOG_DISABLED |
|
|
4396 |
rv = apr_global_mutex_child_init(&rewrite_log_lock, NULL, p); |
4397 |
if (rv != APR_SUCCESS) { |
4398 |
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s, |
4399 |
"mod_rewrite: could not init rewrite log lock in child"); |
4400 |
} |
4401 |
#endif |
4402 |
|
4403 |
/* create the lookup cache */ |
4356 |
/* create the lookup cache */ |
4404 |
if (!init_cache(p)) { |
4357 |
if (!init_cache(p)) { |
4405 |
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s, |
4358 |
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s, |