Changeset 8310b2 for server/src/http/modules/ngx_http_index_module.c
- Timestamp:
- 02/03/09 19:45:01 (3 years ago)
- 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)
- File:
-
- 1 edited
-
server/src/http/modules/ngx_http_index_module.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
server/src/http/modules/ngx_http_index_module.c
rb82943 r8310b2 97 97 { 98 98 u_char *p, *name; 99 size_t len, nlen, root, allocated;99 size_t len, root, reserve, allocated; 100 100 ngx_int_t rc; 101 101 ngx_str_t path, uri; … … 129 129 dir_tested = 0; 130 130 name = NULL; 131 /* suppress MSVC warning */ 131 132 path.data = NULL; 132 133 … … 140 141 } 141 142 142 len= ilcf->max_index_len;143 nlen = index[i].name.len;143 reserve = ilcf->max_index_len; 144 len = index[i].name.len; 144 145 145 146 } else { … … 150 151 e.flushed = 1; 151 152 152 /* 1 byte for terminating '\0' */ 153 153 /* 1 is for terminating '\0' as in static names */ 154 154 len = 1; 155 155 … … 159 159 } 160 160 161 nlen = len;162 163 161 /* 16 bytes are preallocation */ 164 162 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); 171 169 if (name == NULL) { 172 170 return NGX_ERROR; 173 171 } 174 172 175 allocated = path. len;173 allocated = path.data + path.len - name; 176 174 } 177 175 … … 194 192 195 193 if (*name == '/') { 196 uri.len = nlen - 1;194 uri.len = len - 1; 197 195 uri.data = name; 198 196 return ngx_http_internal_redirect(r, &uri, &r->args); … … 249 247 } 250 248 251 uri.len = r->uri.len + nlen - 1;249 uri.len = r->uri.len + len - 1; 252 250 253 251 if (!clcf->alias) { … … 261 259 262 260 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); 264 262 } 265 263 … … 492 490 } 493 491 494 /* include the terminating '\0' to the length to use ngx_ copy() */492 /* include the terminating '\0' to the length to use ngx_memcpy() */ 495 493 index->name.len++; 496 494
Note: See TracChangeset
for help on using the changeset viewer.
