Look up header values directly (#2592)

stat_cache_entry::meta uses a case-insensitive comparator so there is
no need to loop over each entry to compare each key with lowercase.
This commit is contained in:
Andrew Gaul 2024-11-05 07:16:19 +09:00 committed by GitHub
parent 7a989a58a0
commit d9ccdc4fce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -223,14 +223,11 @@ bool StatCache::GetStat(const std::string& key, struct stat* pst, headers_t* met
std::string stretag; std::string stretag;
if(petag){ if(petag){
// find & check ETag // find & check ETag
for(auto hiter = ent->meta.cbegin(); hiter != ent->meta.cend(); ++hiter){ auto hiter = ent->meta.find("etag");
std::string tag = lower(hiter->first); if(hiter != ent->meta.end()){
if(tag == "etag"){ stretag = hiter->second;
stretag = hiter->second; if('\0' != petag[0] && petag != stretag){
if('\0' != petag[0] && petag != stretag){ is_delete_cache = true;
is_delete_cache = true;
}
break;
} }
} }
} }