Merge pull request #359 from yurykats/issue358

Issue 358: Remove optional parameter from Content-Type header
This commit is contained in:
Takeshi Nakatani 2016-02-11 12:19:25 +09:00
commit b281328ff4

View File

@ -724,6 +724,11 @@ mode_t get_mode(headers_t& meta, const char* path, bool checkdir, bool forcedir)
}else{ }else{
if(meta.end() != (iter = meta.find("Content-Type"))){ if(meta.end() != (iter = meta.find("Content-Type"))){
string strConType = (*iter).second; string strConType = (*iter).second;
// Leave just the mime type, remove any optional parameters (eg charset)
string::size_type pos = strConType.find(";");
if(string::npos != pos){
strConType = strConType.substr(0, pos);
}
if(strConType == "application/x-directory"){ if(strConType == "application/x-directory"){
mode |= S_IFDIR; mode |= S_IFDIR;
}else if(path && 0 < strlen(path) && '/' == path[strlen(path) - 1]){ }else if(path && 0 < strlen(path) && '/' == path[strlen(path) - 1]){