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