Overview
Comment: | Updated to send correct mime type for served index.html page |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: | d78a7b98bf88f6293d0565f4e7b64a1d01f253bf |
User & Date: | rkeene on 2014-02-08 05:33:38 |
Other Links: | manifest | tags |
Context
2014-02-08
| ||
06:01 | Updated to become a daemon earlier so that opening "/dev/null" works check-in: 5d36185bbb user: rkeene tags: trunk | |
05:33 | Updated to send correct mime type for served index.html page check-in: d78a7b98bf user: rkeene tags: trunk | |
05:27 | Added support for serving out a /index.html if / is requested. check-in: cb54ba2b24 user: rkeene tags: trunk | |
Changes
Modified filed.c from [a1c7c3882e] to [521ac713bc].
389
390
391
392
393
394
395
396
397
398
399
400
401
402
...
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
|
pthread_mutex_lock(&cache->mutex);
filed_log_msg_debug("Completed locking mutex for idx: %lu", (unsigned long) cache_idx);
if (strcmp(path, cache->path) != 0) {
filed_log_msg_debug("Cache miss for idx: %lu: OLD \"%s\", NEW \"%s\"", (unsigned long) cache_idx, cache->path, path);
if (path[0] == '\0' || (path[0] == '/' && path[1] == '\0')) {
open_path = "/index.html";
} else {
open_path = path;
}
fd = open(open_path, O_RDONLY | O_LARGEFILE);
................................................................................
len = lseek(fd, 0, SEEK_END);
lseek(fd, 0, SEEK_SET);
cache->fd = fd;
cache->len = len;
cache->path = strdup(path);
cache->type = filed_determine_mimetype(path);
/* XXX:TODO: Determine */
cache->lastmod = filed_format_time(cache->lastmod_b, sizeof(cache->lastmod_b), time(NULL) - 30);
} else {
filed_log_msg_debug("Cache hit for idx: %lu: PATH \"%s\"", (unsigned long) cache_idx, path);
}
|
>
|
|
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
...
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
|
pthread_mutex_lock(&cache->mutex); filed_log_msg_debug("Completed locking mutex for idx: %lu", (unsigned long) cache_idx); if (strcmp(path, cache->path) != 0) { filed_log_msg_debug("Cache miss for idx: %lu: OLD \"%s\", NEW \"%s\"", (unsigned long) cache_idx, cache->path, path); /* For requests for the root directory, serve out index.html */ if (path[0] == '\0' || (path[0] == '/' && path[1] == '\0')) { open_path = "/index.html"; } else { open_path = path; } fd = open(open_path, O_RDONLY | O_LARGEFILE); ................................................................................ len = lseek(fd, 0, SEEK_END); lseek(fd, 0, SEEK_SET); cache->fd = fd; cache->len = len; cache->path = strdup(path); cache->type = filed_determine_mimetype(open_path); /* XXX:TODO: Determine */ cache->lastmod = filed_format_time(cache->lastmod_b, sizeof(cache->lastmod_b), time(NULL) - 30); } else { filed_log_msg_debug("Cache hit for idx: %lu: PATH \"%s\"", (unsigned long) cache_idx, path); } |