Merge pull request #38737 from IlsooByun/objmeta-key-underscore

rgw: keep underscore in metatdata key

Reviewed-by: Matt Benjamin <mbenjamin@redhat.com>
This commit is contained in:
J. Eric Ivancich 2021-04-07 12:31:37 -04:00 committed by GitHub
commit 116ef52566
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View File

@ -54,6 +54,8 @@ int ClientIO::init_env(CephContext *cct)
for (auto src = name.begin(); src != name.end(); ++src, ++dest) {
if (*src == '-') {
*dest = '_';
} else if (*src == '_') {
*dest = '-';
} else {
*dest = std::toupper(*src);
}

View File

@ -635,7 +635,7 @@ get_v4_canonical_headers(const req_info& info,
std::transform(std::begin(token), std::end(token),
std::back_inserter(token_env), [](const int c) {
return c == '-' ? '_' : std::toupper(c);
return c == '-' ? '_' : c == '_' ? '-' : std::toupper(c);
});
if (token_env == "HTTP_CONTENT_LENGTH") {

View File

@ -410,10 +410,12 @@ void req_info::init_meta_info(const DoutPrefixProvider *dpp, bool *found_bad_met
snprintf(name_low, meta_prefixes[0].len - 5 + name_len + 1, "%s%s", meta_prefixes[0].str + 5 /* skip HTTP_ */, name); // normalize meta prefix
int j;
for (j = 0; name_low[j]; j++) {
if (name_low[j] != '_')
name_low[j] = tolower(name_low[j]);
else
if (name_low[j] == '_')
name_low[j] = '-';
else if (name_low[j] == '-')
name_low[j] = '_';
else
name_low[j] = tolower(name_low[j]);
}
name_low[j] = 0;