Changeset 1605

Show
Ignore:
Timestamp:
02/04/2007 11:22:46 PM (1 year ago)
Author:
jan
Message:

report an error if the rewrite leads to a rel-URI without a leading
slash.

* mongrel just disconnects
* squid sends a 400

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/mod_rewrite.c

    r1526 r1605  
    256256 
    257257                if (hctx->loops++ > 100) { 
    258                         log_error_write(srv, __FILE__, __LINE__,  "s", 
    259                                         "ENDLESS LOOP IN rewrite-rule DETECTED ... aborting request, perhaps you want to use url.rewrite-once instead of url.rewrite-repeat"); 
    260  
    261                         return HANDLER_ERROR; 
     258                        ERROR("ENDLESS LOOP IN rewrite-rule DETECTED ... aborting request after %d loops at %s", hctx->loops, BUF_STR(con->request.uri)); 
     259 
     260                        con->http_status = 500; 
     261 
     262                        return HANDLER_FINISHED; 
    262263                } 
    263264 
     
    279280                if (p->conf.once->ptr[i] == '1') 
    280281                        hctx->state = REWRITE_STATE_FINISHED; 
     282 
     283                /* looks like we finished the rewrite  
     284                 * 
     285                 * start the uri-splitting again 
     286                 * */ 
     287 
     288                if (con->request.uri->used == 0 || 
     289                    con->request.uri->ptr[0] != '/') { 
     290                        con->http_status = 500; 
     291 
     292                        ERROR("url.rewrite contains a regex for '%s' which leads to a URI without a leading slash: %s",  
     293                                        BUF_STR(p->match_buf), BUF_STR(con->request.uri)); 
     294 
     295                        return HANDLER_FINISHED; 
     296                } 
    281297 
    282298                return HANDLER_COMEBACK;