Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug: not support lowercase keys in response header #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zhoumhh
Copy link

@zhoumhh zhoumhh commented Aug 2, 2019

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 = {
    { "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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant