mirror of
https://github.com/apache/httpd.git
synced 2025-08-07 04:02:58 +03:00
Prevent the server from crashing when entering infinite loops. The
new LimitInternalRecursion directive configures limits of subsequent internal redirects and nested subrequests, after which the request will be aborted. [William Rowe, Jeff Trawick, Andr� Malo] PR: 19753 (and probably others) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@99911 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -332,8 +332,14 @@ static apr_table_t *rename_original_env(apr_pool_t *p, apr_table_t *t)
|
||||
static request_rec *internal_internal_redirect(const char *new_uri,
|
||||
request_rec *r) {
|
||||
int access_status;
|
||||
request_rec *new = (request_rec *) apr_pcalloc(r->pool,
|
||||
sizeof(request_rec));
|
||||
request_rec *new;
|
||||
|
||||
if (ap_is_redirect_limit_exceeded(r)) {
|
||||
ap_die(HTTP_INTERNAL_SERVER_ERROR, r);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
new = (request_rec *) apr_pcalloc(r->pool, sizeof(request_rec));
|
||||
|
||||
new->connection = r->connection;
|
||||
new->server = r->server;
|
||||
@@ -499,7 +505,14 @@ AP_DECLARE(void) ap_internal_fast_redirect(request_rec *rr, request_rec *r)
|
||||
AP_DECLARE(void) ap_internal_redirect(const char *new_uri, request_rec *r)
|
||||
{
|
||||
request_rec *new = internal_internal_redirect(new_uri, r);
|
||||
int access_status = ap_process_request_internal(new);
|
||||
int access_status;
|
||||
|
||||
/* ap_die was already called, if an error occured */
|
||||
if (!new) {
|
||||
return;
|
||||
}
|
||||
|
||||
access_status = ap_process_request_internal(new);
|
||||
if (access_status == OK) {
|
||||
if ((access_status = ap_invoke_handler(new)) != 0) {
|
||||
ap_die(access_status, new);
|
||||
@@ -520,6 +533,12 @@ AP_DECLARE(void) ap_internal_redirect_handler(const char *new_uri, request_rec *
|
||||
{
|
||||
int access_status;
|
||||
request_rec *new = internal_internal_redirect(new_uri, r);
|
||||
|
||||
/* ap_die was already called, if an error occured */
|
||||
if (!new) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (r->handler)
|
||||
ap_set_content_type(new, r->content_type);
|
||||
access_status = ap_process_request_internal(new);
|
||||
|
Reference in New Issue
Block a user