Do not return lowercased header, but the original one.

This commit is contained in:
tastytea 2019-10-07 23:06:15 +02:00
parent d37e720a11
commit 57238020a3
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 6 additions and 3 deletions

View File

@ -347,7 +347,6 @@ return_call API::http::request_common(const http_method &meth,
}
}
// FIXME: get_headers() doesn't work anymore.
void API::http::get_headers(string &headers) const
{
headers = _headers;

View File

@ -269,11 +269,15 @@ return_call API::register_app2(const string &client_id,
const string API::get_header(std::string header) const
{
string headers;
string headers_lower;
_http.get_headers(headers);
std::transform(headers.begin(), headers.end(), headers.begin(), ::tolower);
headers_lower.resize(headers.size());
std::transform(headers.begin(), headers.end(),
headers_lower.begin(), ::tolower);
std::transform(header.begin(), header.end(), header.begin(), ::tolower);
size_t startpos = headers.find(header + ':');
size_t startpos = headers_lower.find(header + ':');
if (startpos != std::string::npos)
{
startpos = headers.find(':', startpos) + 2;