Overview
Comment: | Updated to use off_t to represent disk sizes |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: | b040037186fe2caf82c6c924f0f77f4ebd95d2e7 |
User & Date: | rkeene on 2014-02-06 08:42:02 |
Other Links: | manifest | tags |
Context
2014-02-06
| ||
20:43 | Updated to support arguments, updated hashing algorithm, and minor cleanup check-in: 613c9bd346 user: rkeene tags: trunk | |
08:42 | Updated to use off_t to represent disk sizes check-in: b040037186 user: rkeene tags: trunk | |
08:26 | Added additional debugging regarding range computation check-in: c35e6a2d15 user: rkeene tags: trunk | |
Changes
Modified filed.c from [c73ad10afc] to [5f7a2da005].
31 31 }; 32 32 33 33 /* File information */ 34 34 struct filed_fileinfo { 35 35 pthread_mutex_t mutex; 36 36 char *path; 37 37 int fd; 38 - size_t len; 38 + off_t len; 39 39 char *lastmod; 40 40 char lastmod_b[64]; 41 41 char *type; 42 42 }; 43 43 44 44 /* Request variables */ 45 45 struct filed_http_request { ................................................................................ 51 51 /** HTTP Request information **/ 52 52 char *path; /*** Path being requested ***/ 53 53 54 54 struct { 55 55 struct { 56 56 int present; 57 57 off_t offset; /*** Range start ***/ 58 - ssize_t length; /*** Range length ***/ 58 + off_t length; /*** Range length ***/ 59 59 } range; 60 60 } headers; 61 61 }; 62 62 63 63 /* Global variables */ 64 64 /** Open File cache **/ 65 65 struct filed_fileinfo *filed_fileinfo_fdcache; ................................................................................ 264 264 } 265 265 266 266 /* Process an HTTP request and return the path requested */ 267 267 static struct filed_http_request *filed_get_http_request(FILE *fp, struct filed_http_request *buffer_st) { 268 268 char *method, *path; 269 269 char *buffer, *tmpbuffer, *workbuffer, *workbuffer_next; 270 270 size_t buffer_len, tmpbuffer_len; 271 - off_t range_start, range_end; 272 - ssize_t range_length; 271 + off_t range_start, range_end, range_length; 273 272 int range_request; 274 273 int i; 275 274 276 275 range_start = 0; 277 276 range_end = 0; 278 277 range_request = 0; 279 278 range_length = -1; ................................................................................ 430 429 fileinfo = filed_open_file(path, &request->fileinfo); 431 430 if (fileinfo == NULL) { 432 431 filed_error_page(fp, date_current, 404); 433 432 434 433 filed_log_msg("PROCESS_REPLY_COMPLETE FD=... ERROR=404"); 435 434 } else { 436 435 if (request->headers.range.offset != 0 || request->headers.range.length >= 0) { 437 - if ((size_t) request->headers.range.offset >= fileinfo->len) { 436 + if (request->headers.range.offset >= fileinfo->len) { 438 437 filed_log_msg("PROCESS_REPLY_COMPLETE FD=... ERROR=416"); 439 438 440 439 filed_error_page(fp, date_current, 416); 441 440 } else { 442 441 if (request->headers.range.length < 0) { 443 442 filed_log_msg_debug("Computing length to fit in bounds: fileinfo->len = %llu, request->headers.range.offset = %llu", 444 443 (unsigned long long) fileinfo->len, 445 444 (unsigned long long) request->headers.range.offset 446 445 ); 447 446 448 447 request->headers.range.length = fileinfo->len - request->headers.range.offset; 449 448 } 450 449 451 - filed_log_msg_debug("Partial request, starting at: %llu and running for %llu bytes", (unsigned long long) request->headers.range.offset, (unsigned long long) request->headers.range.length); 450 + filed_log_msg_debug("Partial request, starting at: %llu and running for %llu bytes", 451 + (unsigned long long) request->headers.range.offset, 452 + (unsigned long long) request->headers.range.length 453 + ); 452 454 453 455 http_code = 206; 454 456 } 455 457 } else { 456 458 if (request->headers.range.present) { 457 459 http_code = 206; 458 460 } else {