File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
libs/network/example/http Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -45,8 +45,8 @@ struct file_cache {
4545
4646 bool add (std::string const & 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 ;
5050 int fd = open (real_filename.c_str (), O_RDONLY|O_NOATIME|O_NONBLOCK);
5151 if (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
9393 void operator ()(std::string const & 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);
9696 if (ok) {
9797 send_headers (file_cache_.meta (path), connection);
9898 if (serve_body) send_file (file_cache_.get (path), 0 , connection);
You can’t perform that action at this time.
0 commit comments