map<string, string> canonical_hdrs_map;
istringstream sh(s->aws4_auth->signedheaders);
string token;
- string port = s->info.env->get("SERVER_PORT");
+ string port = s->info.env->get("SERVER_PORT", "");
+ string secure_port = s->info.env->get("SERVER_PORT_SECURE", "");
while (getline(sh, token, ';')) {
string token_env = "HTTP_" + token;
}
}
string token_value = string(t);
- if (using_qs && (token == "host"))
- token_value = token_value + ":" + port;
+ if (using_qs && (token == "host")) {
+ if (!port.empty() && port != "80") {
+ token_value = token_value + ":" + port;
+ } else if (!secure_port.empty() && secure_port != "443") {
+ token_value = token_value + ":" + secure_port;
+ }
+ }
canonical_hdrs_map[token] = rgw_trim_whitespace(token_value);
}