Diff

Differences From Artifact [79c614eba1]:

To Artifact [02ed31827c]:


   559    559   		(unsigned long long) random()
   560    560   	);
   561    561   }
   562    562   
   563    563   /* Open a file and return file information */
   564    564   static struct filed_fileinfo *filed_open_file(const char *path, struct filed_fileinfo *buffer) {
   565    565   	struct filed_fileinfo *cache;
   566         -	const char *open_path;
   567    566   	unsigned int cache_idx;
   568    567   	off_t len;
   569    568   	int fd;
   570    569   
   571    570   	cache_idx = filed_hash((const unsigned char *) path, filed_fileinfo_fdcache_size);
   572    571   
   573    572   	cache = &filed_fileinfo_fdcache[cache_idx];
................................................................................
   577    576   	pthread_mutex_lock(&cache->mutex);
   578    577   
   579    578   	filed_log_msg_debug("Completed locking mutex for idx: %lu", (unsigned long) cache_idx);
   580    579   
   581    580   	if (strcmp(path, cache->path) != 0) {
   582    581   		filed_log_msg_debug("Cache miss for idx: %lu: OLD \"%s\", NEW \"%s\"", (unsigned long) cache_idx, cache->path, path);
   583    582   
   584         -		/* For requests for the root directory, serve out index.html */
   585         -		if (path[0] == '\0' || (path[0] == '/' && path[1] == '\0')) {
   586         -			open_path = "/index.html";
   587         -		} else {
   588         -			open_path = path;
   589         -		}
   590         -
   591         -		fd = open(open_path, O_RDONLY | O_LARGEFILE);
          583  +		fd = open(path, O_RDONLY | O_LARGEFILE);
   592    584   		if (fd < 0) {
   593    585   			pthread_mutex_unlock(&cache->mutex);
   594    586   
   595    587   			return(NULL);
   596    588   		}
   597    589   
   598    590   		if (cache->fd >= 0) {
................................................................................
   601    593   
   602    594   		len = lseek(fd, 0, SEEK_END);
   603    595   		lseek(fd, 0, SEEK_SET);
   604    596   
   605    597   		cache->fd = fd;
   606    598   		cache->len = len;
   607    599   		strcpy(cache->path, path);
   608         -		cache->type = filed_determine_mimetype(open_path);
          600  +		cache->type = filed_determine_mimetype(path);
   609    601   		filed_generate_etag(cache->etag, sizeof(cache->etag));
   610    602   
   611    603   		/* XXX:TODO: Determine */
   612    604   		cache->lastmod = filed_format_time(cache->lastmod_b, sizeof(cache->lastmod_b), time(NULL) - 30);
   613    605   	} else {
   614    606   		filed_log_msg_debug("Cache hit for idx: %lu: PATH \"%s\"", (unsigned long) cache_idx, path);
   615    607   	}