comparison src/http/ngx_http_request.c @ 4472:c95b828912a3

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; } 2. Post action pointing to nonexistent named location: location / { post_action @nonexistent; } 3. 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; }
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 13 Feb 2012 15:35:48 +0000
parents b19a651471d9
children b00098cbc44d
comparison
equal deleted inserted replaced
4471:b19a651471d9 4472:c95b828912a3
2926 2926
2927 if (clcf->post_action.data == NULL) { 2927 if (clcf->post_action.data == NULL) {
2928 return NGX_DECLINED; 2928 return NGX_DECLINED;
2929 } 2929 }
2930 2930
2931 if (r->post_action && r->uri_changes == 0) {
2932 return NGX_DECLINED;
2933 }
2934
2931 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 2935 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
2932 "post action: \"%V\"", &clcf->post_action); 2936 "post action: \"%V\"", &clcf->post_action);
2933 2937
2934 r->main->count--; 2938 r->main->count--;
2935 2939