File tree 1 file changed +3
-3
lines changed
libs/network/example/http
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -45,8 +45,8 @@ struct file_cache {
45
45
46
46
bool add (std::string const & path) {
47
47
boost::upgrade_lock<boost::shared_mutex> lock (cache_mutex);
48
- if (regions.find (doc_root_ + path) != regions.end ()) return true ;
49
48
std::string real_filename = doc_root_+path;
49
+ if (regions.find (real_filename) != regions.end ()) return true ;
50
50
int fd = open (real_filename.c_str (), O_RDONLY|O_NOATIME|O_NONBLOCK);
51
51
if (fd == -1 ) return false ;
52
52
std::size_t size = lseek (fd, 0 , SEEK_END);
@@ -91,8 +91,8 @@ struct connection_handler : boost::enable_shared_from_this<connection_handler> {
91
91
: file_cache_(cache) {}
92
92
93
93
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);
96
96
if (ok) {
97
97
send_headers (file_cache_.meta (path), connection);
98
98
if (serve_body) send_file (file_cache_.get (path), 0 , connection);
You can’t perform that action at this time.
0 commit comments