From: Ruifeng Yang <149233652@qq.com> Date: Sat, 1 Aug 2015 09:39:17 +0000 (+0800) Subject: rgw:the arguments 'domain' should not be assigned when return false X-Git-Tag: v0.94.4~22^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a13c7fd7c39e83072f2975477e1cdcfe079fb041;p=ceph.git rgw:the arguments 'domain' should not be assigned when return false Hostnames: [B.A] Inputs: [X.BB.A] Return: [false] Output: [B.A] it is wrong. Fixes: #12629 Signed-off-by: Ruifeng Yang <149233652@qq.com> (cherry picked from commit 9420d24c21b4e06d62f356637599c6ec8e7e3e4d) --- diff --git a/src/rgw/rgw_rest.cc b/src/rgw/rgw_rest.cc index d385d6233c7..00267b38e1c 100644 --- a/src/rgw/rgw_rest.cc +++ b/src/rgw/rgw_rest.cc @@ -230,8 +230,8 @@ static bool rgw_find_host_in_domains(const string& host, string *domain, string if (!str_ends_with(host, *iter, &pos)) continue; - *domain = host.substr(pos); if (pos == 0) { + *domain = host; subdomain->clear(); } else { if (host[pos - 1] != '.') {