mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-11-14 16:34:09 +00:00
Merge pull request #488 from ggtakec/master
Fixed searching Content-Length without case sensitive - #480
This commit is contained in:
commit
15b797f3ee
@ -60,18 +60,29 @@ string get_realpath(const char *path) {
|
|||||||
return realpath;
|
return realpath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline headers_t::const_iterator find_strcase_header(headers_t& meta, const char* pbase)
|
||||||
|
{
|
||||||
|
for(headers_t::const_iterator iter = meta.begin(); pbase && iter != meta.end(); ++iter){
|
||||||
|
if(0 == strcasecmp(iter->first.c_str(), pbase)){
|
||||||
|
return iter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return meta.end();
|
||||||
|
}
|
||||||
|
|
||||||
inline headers_t::const_iterator find_content_type(headers_t& meta)
|
inline headers_t::const_iterator find_content_type(headers_t& meta)
|
||||||
{
|
{
|
||||||
headers_t::const_iterator iter;
|
return find_strcase_header(meta, "Content-Type");
|
||||||
|
}
|
||||||
|
|
||||||
if(meta.end() == (iter = meta.find("Content-Type"))){
|
inline headers_t::const_iterator find_content_length(headers_t& meta)
|
||||||
if(meta.end() == (iter = meta.find("Content-type"))){
|
{
|
||||||
if(meta.end() == (iter = meta.find("content-type"))){
|
return find_strcase_header(meta, "Content-Length");
|
||||||
iter = meta.find("content-Type");
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
inline headers_t::const_iterator find_last_modified(headers_t& meta)
|
||||||
return iter;
|
{
|
||||||
|
return find_strcase_header(meta, "Last-Modified");
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
@ -717,8 +728,8 @@ off_t get_size(const char *s)
|
|||||||
|
|
||||||
off_t get_size(headers_t& meta)
|
off_t get_size(headers_t& meta)
|
||||||
{
|
{
|
||||||
headers_t::const_iterator iter;
|
headers_t::const_iterator iter = find_content_length(meta);
|
||||||
if(meta.end() == (iter = meta.find("Content-Length"))){
|
if(meta.end() == iter){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return get_size((*iter).second.c_str());
|
return get_size((*iter).second.c_str());
|
||||||
@ -847,8 +858,8 @@ time_t get_lastmodified(const char* s)
|
|||||||
|
|
||||||
time_t get_lastmodified(headers_t& meta)
|
time_t get_lastmodified(headers_t& meta)
|
||||||
{
|
{
|
||||||
headers_t::const_iterator iter;
|
headers_t::const_iterator iter = find_last_modified(meta);
|
||||||
if(meta.end() == (iter = meta.find("Last-Modified"))){
|
if(meta.end() == iter){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return get_lastmodified((*iter).second.c_str());
|
return get_lastmodified((*iter).second.c_str());
|
||||||
|
Loading…
Reference in New Issue
Block a user