Changeset 64 in Main for trunk/Server
- Timestamp:
- Sep 19, 2024, 5:58:17 AM (2 months ago)
- Location:
- trunk/Server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Server/http.c
r46 r64 33 33 if(req->body != NULL) free(req->body); 34 34 if(req->version != NULL) free(req->version); 35 36 req->method = NULL; 37 req->path = NULL; 38 req->query = NULL; 39 req->headers = NULL; 40 req->body = NULL; 41 req->version = NULL; 35 42 } 36 43 … … 76 83 #endif 77 84 int len = tw_read(ssl, sock, buffer, 512); 78 if(len <= 0) break; 85 if(len <= 0){ 86 bad = true; 87 break; 88 } 79 89 int i; 80 90 for(i = 0; i < len; i++) { -
trunk/Server/server.c
r62 r64 429 429 int i; 430 430 time_t cmtime = 0; 431 for(i = 0; req.headers[i] != NULL; i += 2) { 432 if(cm_strcaseequ(req.headers[i], "Host")) { 433 free(vhost); 434 vhost = cm_strdup(req.headers[i + 1]); 435 } else if(cm_strcaseequ(req.headers[i], "If-Modified-Since")) { 436 struct tm tm; 437 strptime(req.headers[i + 1], "%a, %d %b %Y %H:%M:%S GMT", &tm); 431 if(req.headers != NULL){ 432 for(i = 0; req.headers[i] != NULL; i += 2) { 433 if(cm_strcaseequ(req.headers[i], "Host")) { 434 free(vhost); 435 vhost = cm_strdup(req.headers[i + 1]); 436 } else if(cm_strcaseequ(req.headers[i], "If-Modified-Since")) { 437 struct tm tm; 438 strptime(req.headers[i + 1], "%a, %d %b %Y %H:%M:%S GMT", &tm); 438 439 #ifdef __MINGW32__ 439 time_t t = 0; 440 struct tm* btm = localtime(&t); 441 cmtime = mktime(&tm); 442 cmtime -= (btm->tm_hour * 60 + btm->tm_min) * 60; 443 #else 444 cmtime = timegm(&tm); 445 #endif 440 time_t t = 0; 441 struct tm* btm = localtime(&t); 442 cmtime = mktime(&tm); 443 cmtime -= (btm->tm_hour * 60 + btm->tm_min) * 60; 444 #else 445 cmtime = timegm(&tm); 446 #endif 447 } 446 448 } 447 449 }
Note:
See TracChangeset
for help on using the changeset viewer.