Changeset 4511:83c26de984ef in nginx


Ignore:
Timestamp:
03/05/12 12:49:32 (8 years ago)
Author:
Maxim Dounin <mdounin@…>
Branch:
stable-1.0
Phase:
public
Convert:
svn:c3fe7df1-7212-e011-8a91-001109144009/branches/stable-1.0@4512
Message:

Merge of r4473:

Core: protection from cycles with named locations and post_action.

Now redirects to named locations are counted against normal uri changes
limit, and post_action respects this limit as well. As a result at least
the following (bad) configurations no longer trigger infinite cycles:

  1. Post action which recursively triggers post action:

location / {

post_action /index.html;

}

  1. Post action pointing to nonexistent named location:

location / {

post_action @nonexistent;

}

  1. Recursive error page for 500 (Internal Server Error) pointing to a nonexistent named location:

location / {

recursive_error_pages on;
error_page 500 @nonexistent;
return 500;

}

Location:
src/http
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/http/ngx_http_core_module.c

    r4450 r4511  
    25252525
    25262526    r->main->count++;
     2527    r->uri_changes--;
     2528
     2529    if (r->uri_changes == 0) {
     2530        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
     2531                      "rewrite or internal redirection cycle "
     2532                      "while redirect to named location \"%V\"", name);
     2533
     2534        ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
     2535        return NGX_DONE;
     2536    }
    25272537
    25282538    cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
  • src/http/ngx_http_request.c

    r4450 r4511  
    28992899    }
    29002900
     2901    if (r->post_action && r->uri_changes == 0) {
     2902        return NGX_DECLINED;
     2903    }
     2904
    29012905    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
    29022906                   "post action: \"%V\"", &clcf->post_action);
Note: See TracChangeset for help on using the changeset viewer.