Ignore:
Timestamp:
02/03/09 19:45:01 (3 years ago)
Author:
George Potapov <nephrite@…>
Branches:
master-v0.7, nginx-v0.7, nginx-v0.8, upstream_count_limit
Children:
e86d7f, f54237
Parents:
2ac4f5
git-author:
George Potapov <nephrite@…> (02/03/09 19:45:01)
git-committer:
George Potapov <nephrite@…> (02/03/09 19:45:01)
Message:

vendor drop nginx v0.7.33

File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/src/http/modules/ngx_http_index_module.c

    rb82943 r8310b2  
    9797{ 
    9898    u_char                       *p, *name; 
    99     size_t                        len, nlen, root, allocated; 
     99    size_t                        len, root, reserve, allocated; 
    100100    ngx_int_t                     rc; 
    101101    ngx_str_t                     path, uri; 
     
    129129    dir_tested = 0; 
    130130    name = NULL; 
     131    /* suppress MSVC warning */ 
    131132    path.data = NULL; 
    132133 
     
    140141            } 
    141142 
    142             len = ilcf->max_index_len; 
    143             nlen = index[i].name.len; 
     143            reserve = ilcf->max_index_len; 
     144            len = index[i].name.len; 
    144145 
    145146        } else { 
     
    150151            e.flushed = 1; 
    151152 
    152             /* 1 byte for terminating '\0' */ 
    153  
     153            /* 1 is for terminating '\0' as in static names */ 
    154154            len = 1; 
    155155 
     
    159159            } 
    160160 
    161             nlen = len; 
    162  
    163161            /* 16 bytes are preallocation */ 
    164162 
    165             len += 16; 
    166         } 
    167  
    168         if (len > (size_t) (path.data + allocated - name)) { 
    169  
    170             name = ngx_http_map_uri_to_path(r, &path, &root, len); 
     163            reserve = len + 16; 
     164        } 
     165 
     166        if (reserve > allocated) { 
     167 
     168            name = ngx_http_map_uri_to_path(r, &path, &root, reserve); 
    171169            if (name == NULL) { 
    172170                return NGX_ERROR; 
    173171            } 
    174172 
    175             allocated = path.len; 
     173            allocated = path.data + path.len - name; 
    176174        } 
    177175 
     
    194192 
    195193            if (*name == '/') { 
    196                 uri.len = nlen - 1; 
     194                uri.len = len - 1; 
    197195                uri.data = name; 
    198196                return ngx_http_internal_redirect(r, &uri, &r->args); 
     
    249247        } 
    250248 
    251         uri.len = r->uri.len + nlen - 1; 
     249        uri.len = r->uri.len + len - 1; 
    252250 
    253251        if (!clcf->alias) { 
     
    261259 
    262260            p = ngx_copy(uri.data, r->uri.data, r->uri.len); 
    263             ngx_memcpy(p, name, nlen - 1); 
     261            ngx_memcpy(p, name, len - 1); 
    264262        } 
    265263 
     
    492490            } 
    493491 
    494             /* include the terminating '\0' to the length to use ngx_copy() */ 
     492            /* include the terminating '\0' to the length to use ngx_memcpy() */ 
    495493            index->name.len++; 
    496494 
Note: See TracChangeset for help on using the changeset viewer.