Overview
Comment: | Added support for serving out a /index.html if / is requested. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
cb54ba2b24cb88b9c10b9befe040f16b |
User & Date: | rkeene on 2014-02-08 05:27:02 |
Other Links: | manifest | tags |
Context
2014-02-08
| ||
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 | |
03:55 | Added README check-in: ab9592633a user: rkeene tags: trunk | |
Changes
Modified filed.c from [5e70bdaf5f] to [a1c7c3882e].
︙ | ︙ | |||
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 | return(FILED_DEFAULT_TYPE); } /* Open a file and return file information */ static struct filed_fileinfo *filed_open_file(const char *path, struct filed_fileinfo *buffer) { struct filed_fileinfo *cache; unsigned int cache_idx; off_t len; int fd; cache_idx = filed_hash((const unsigned char *) path, filed_fileinfo_fdcache_size); cache = &filed_fileinfo_fdcache[cache_idx]; filed_log_msg_debug("Locking mutex for idx: %lu", (unsigned long) cache_idx); 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); | > > > > > > > | | 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | return(FILED_DEFAULT_TYPE); } /* Open a file and return file information */ static struct filed_fileinfo *filed_open_file(const char *path, struct filed_fileinfo *buffer) { struct filed_fileinfo *cache; const char *open_path; unsigned int cache_idx; off_t len; int fd; cache_idx = filed_hash((const unsigned char *) path, filed_fileinfo_fdcache_size); cache = &filed_fileinfo_fdcache[cache_idx]; filed_log_msg_debug("Locking mutex for idx: %lu", (unsigned long) cache_idx); 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); if (fd < 0) { pthread_mutex_unlock(&cache->mutex); return(NULL); } free(cache->path); |
︙ | ︙ | |||
555 556 557 558 559 560 561 | fd = fd; } /* Return an error page */ static void filed_error_page(FILE *fp, const char *date_current, int error_number) { char *error_string = "<html><head><title>ERROR</title></head><body>Unable to process request</body></html>"; | | | 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 | fd = fd; } /* Return an error page */ static void filed_error_page(FILE *fp, const char *date_current, int error_number) { char *error_string = "<html><head><title>ERROR</title></head><body>Unable to process request</body></html>"; fprintf(fp, "HTTP/1.1 %i Not OK\r\nDate: %s\r\nServer: filed\r\nLast-Modified: %s\r\nContent-Length: %llu\r\nContent-Type: %s\r\nConnection: close\r\n\r\n%s", error_number, date_current, date_current, (unsigned long long) strlen(error_string), "text/html", error_string ); |
︙ | ︙ |