Changeset 69 in Main for trunk/Server/http.c
- Timestamp:
- Sep 19, 2024, 4:44:13 PM (2 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Server/http.c
r64 r69 298 298 free(req->path); 299 299 req->path = result; 300 301 int incr = 0; 302 char* p = malloc(1); 303 p[0] = 0; 304 int j; 305 for(j = 0;; j++) { 306 if(req->path[j] == '/' || req->path[j] == 0) { 307 char oldc = req->path[j]; 308 cbuf[0] = oldc; 309 req->path[j] = 0; 310 311 char* pth = req->path + incr; 312 313 if(strcmp(pth, "..") == 0) { 314 int k; 315 if(p[strlen(p) - 1] == '/') p[strlen(p) - 1] = 0; 316 for(k = strlen(p) - 1; k >= 0; k--) { 317 if(p[k] == '/') { 318 p[k + 1] = 0; 319 break; 320 } 321 } 322 if(strlen(p) == 0) { 323 free(p); 324 p = cm_strdup("/"); 325 } 326 } else if(strcmp(pth, ".") == 0) { 327 } else if(oldc != '\\') { 328 char* tmp = p; 329 p = cm_strcat3(tmp, pth, cbuf); 330 free(tmp); 331 } 332 333 incr = j + 1; 334 if(oldc == 0) break; 335 } 336 } 337 free(req->path); 338 req->path = p; 300 339 return 0; 301 340 }
Note:
See TracChangeset
for help on using the changeset viewer.