Changeset 1005

Show
Ignore:
Timestamp:
02/22/2006 12:50:56 PM (2 years ago)
Author:
jan
Message:

handle 'foo.php... == foo.php' case on windows/dos

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/lighttpd-merge-1.4.x/src/response.c

    r951 r1005  
    321321                buffer_copy_string_buffer(con->physical.rel_path, con->uri.path); 
    322322                 
     323                /* strip dots from the end and spaces 
     324                 * 
     325                 * windows/dos handle those filenames as the same file 
     326                 * 
     327                 * foo == foo. == foo..... == "foo...   " == "foo..  ./" 
     328                 * 
     329                 * This will affect in some cases PATHINFO 
     330                 * 
     331                 * */ 
     332                if (con->physical.rel_path->used > 1) { 
     333                        buffer *b = con->physical.rel_path; 
     334                        size_t i; 
     335 
     336                        if (b->used > 2 && 
     337                            b->ptr[b->used-2] == '/' && 
     338                            (b->ptr[b->used-3] == ' ' || 
     339                             b->ptr[b->used-3] == '.')) { 
     340                                b->ptr[b->used--] = '\0'; 
     341                        } 
     342 
     343                        for (i = b->used - 2; b->used > 1; i--) { 
     344                                if (b->ptr[i] == ' ' || 
     345                                    b->ptr[i] == '.') { 
     346                                        b->ptr[b->used--] = '\0'; 
     347                                } else { 
     348                                        break; 
     349                                } 
     350                        } 
     351                } 
     352 
    323353                if (con->conf.log_request_handling) { 
    324354                        log_error_write(srv, __FILE__, __LINE__,  "s",  "-- before doc_root");