@@ -45,8 +45,8 @@ struct file_cache {
4545
4646bool add (std::stringconst & path) {
4747 boost::upgrade_lock<boost::shared_mutex>lock (cache_mutex);
48- if (regions.find (doc_root_ + path) != regions.end ())return true ;
4948 std::string real_filename = doc_root_+path;
49+ if (regions.find (real_filename) != regions.end ())return true ;
5050int fd =open (real_filename.c_str (), O_RDONLY|O_NOATIME|O_NONBLOCK);
5151if (fd == -1 )return false ;
5252 std::size_t size =lseek (fd,0 , SEEK_END);
@@ -91,8 +91,8 @@ struct connection_handler : boost::enable_shared_from_this<connection_handler> {
9191 : file_cache_(cache) {}
9292
9393void operator ()(std::stringconst & path, server::connection_ptr connection,bool serve_body) {
94- bool ok =false ;
95- if (!file_cache_. has (path) ) ok = file_cache_.add (path);
94+ bool ok =file_cache_. has (path) ;
95+ if (!ok ) ok = file_cache_.add (path);
9696if (ok) {
9797send_headers (file_cache_.meta (path), connection);
9898if (serve_body)send_file (file_cache_.get (path),0 , connection);