Open zhoumhh opened 5 years ago
void BaseResp::ParseFromHeaders(const std::map<std::string, std::string>& headers)
In this function, parameter headers is a map, keys in it maybe full lowercase in some environment, such as:
headers
headers = { { "content-length": "5" }, { "content-type": "text/plain" } }
But variables (kReqHeader*) is defined by initial capitalization in "cos_params.h", such as:
const std::string kReqHeaderContentLen = "Content-Length"; const std::string kReqHeaderContentType = "Content-Type";
This function couldn't parse header correctly when response header is full lowercase!
The code added will find the value in map by lowercase key again.
void BaseResp::ParseFromHeaders(const std::map<std::string, std::string>& headers)
In this function, parameter
headers
is a map, keys in it maybe full lowercase in some environment, such as:But variables (kReqHeader*) is defined by initial capitalization in "cos_params.h", such as:
This function couldn't parse header correctly when response header is full lowercase!
The code added will find the value in map by lowercase key again.