389
390
391
392
393
394
395
396
397
398
399
400
401
402
|
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
|
+
|
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);
|
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
|
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
|
-
+
|
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);
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);
}
|