diff options
author | yuliyang <yuliyang@cmss.chinamobile.com> | 2019-10-08 07:30:08 +0200 |
---|---|---|
committer | yuliyang <yuliyang@cmss.chinamobile.com> | 2019-10-08 09:32:37 +0200 |
commit | 1039ed8f5173cac1e1d476e5b26911dccba0a203 (patch) | |
tree | 8a112d32c8b9830b95bdb9497767d954241eb54e /src/rgw/rgw_rest.cc | |
parent | Merge PR #30593 into master (diff) | |
download | ceph-1039ed8f5173cac1e1d476e5b26911dccba0a203.tar.xz ceph-1039ed8f5173cac1e1d476e5b26911dccba0a203.zip |
rgw: fix SignatureDoesNotMatch when use ipv6 address in s3 client
fix: https://tracker.ceph.com/issues/42218
Signed-off-by: yuliyang <yuliyang@cmss.chinamobile.com>
Diffstat (limited to 'src/rgw/rgw_rest.cc')
-rw-r--r-- | src/rgw/rgw_rest.cc | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/rgw/rgw_rest.cc b/src/rgw/rgw_rest.cc index a8fe2de62c8..1378dfc43b5 100644 --- a/src/rgw/rgw_rest.cc +++ b/src/rgw/rgw_rest.cc @@ -2032,9 +2032,17 @@ int RGWREST::preprocess(struct req_state *s, rgw::io::BasicClient* cio) bool s3website_enabled = api_priority_s3website >= 0; if (info.host.size()) { - ssize_t pos = info.host.find(':'); - if (pos >= 0) { - info.host = info.host.substr(0, pos); + ssize_t pos; + if (info.host.find('[') == 0) { + pos = info.host.find(']'); + if (pos >=1) { + info.host = info.host.substr(1, pos-1); + } + } else { + pos = info.host.find(':'); + if (pos >= 0) { + info.host = info.host.substr(0, pos); + } } ldout(s->cct, 10) << "host=" << info.host << dendl; string domain; |