]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: Replace boost::string_ref/view with std::string_view
authorPrateek Sachan <psachan@cs.iitr.ac.in>
Sat, 23 May 2020 08:18:07 +0000 (13:48 +0530)
committerPrateek Sachan <psachan@cs.iitr.ac.in>
Thu, 18 Jun 2020 16:57:07 +0000 (22:27 +0530)
This commit replaces boost's string_ref and string_view cpp's in built std::string_view

Fixes: https://tracker.ceph.com/issues/39619
Signed-off-by: Prateek Sachan <psachan@cs.iitr.ac.in>
55 files changed:
src/common/escape.h
src/common/iso_8601.cc
src/common/iso_8601.h
src/common/sstring.hh
src/rgw/rgw_acl.h
src/rgw/rgw_acl_swift.cc
src/rgw/rgw_asio_client.cc
src/rgw/rgw_asio_client.h
src/rgw/rgw_auth_keystone.cc
src/rgw/rgw_auth_keystone.h
src/rgw/rgw_auth_s3.cc
src/rgw/rgw_auth_s3.h
src/rgw/rgw_b64.h
src/rgw/rgw_bucket.cc
src/rgw/rgw_civetweb.cc
src/rgw/rgw_civetweb.h
src/rgw/rgw_civetweb_frontend.cc
src/rgw/rgw_client_io.h
src/rgw/rgw_client_io_filters.h
src/rgw/rgw_common.cc
src/rgw/rgw_common.h
src/rgw/rgw_crypt.cc
src/rgw/rgw_crypt.h
src/rgw/rgw_crypt_sanitize.h
src/rgw/rgw_data_sync.cc
src/rgw/rgw_fcgi.cc
src/rgw/rgw_fcgi.h
src/rgw/rgw_file.h
src/rgw/rgw_http_client.cc
src/rgw/rgw_iam_policy.cc
src/rgw/rgw_iam_policy.h
src/rgw/rgw_json_enc.cc
src/rgw/rgw_keystone.h
src/rgw/rgw_kms.cc
src/rgw/rgw_kms.h
src/rgw/rgw_loadgen.cc
src/rgw/rgw_loadgen.h
src/rgw/rgw_op.cc
src/rgw/rgw_op.h
src/rgw/rgw_rest.cc
src/rgw/rgw_rest.h
src/rgw/rgw_rest_s3.cc
src/rgw/rgw_rest_s3.h
src/rgw/rgw_rest_sts.cc
src/rgw/rgw_rest_swift.cc
src/rgw/rgw_rest_swift.h
src/rgw/rgw_string.cc
src/rgw/rgw_string.h
src/rgw/rgw_swift_auth.cc
src/rgw/rgw_tar.h
src/rgw/rgw_trim_bilog.cc
src/rgw/rgw_trim_bilog.h
src/test/rgw/test_rgw_crypto.cc
src/test/rgw/test_rgw_kms.cc
src/test/rgw/test_rgw_string.cc

index 2d8770158acdb89ff34194d3d17d2b3af478c85e..d2151e8a7df561144d9b47e59c95059d67f13a42 100644 (file)
@@ -16,7 +16,7 @@
 #define CEPH_RGW_ESCAPE_H
 
 #include <ostream>
-#include <boost/utility/string_view.hpp>
+#include <string_view>
 
 /* Returns the length of a buffer that would be needed to escape 'buf'
  * as an XML attribute
@@ -50,13 +50,13 @@ void escape_json_attr(const char *buf, size_t src_len, char *out);
 //   std::cout << xml_stream_escaper(xml_input) << std::endl;
 
 struct xml_stream_escaper {
-  boost::string_view str;
+  std::string_view str;
   xml_stream_escaper(std::string_view str) : str(str.data(), str.size()) {}
 };
 std::ostream& operator<<(std::ostream& out, const xml_stream_escaper& e);
 
 struct json_stream_escaper {
-  boost::string_view str;
+  std::string_view str;
   json_stream_escaper(std::string_view str) : str(str.data(), str.size()) {}
 };
 std::ostream& operator<<(std::ostream& out, const json_stream_escaper& e);
index 29cfd4b4737f4d0b892837084f48e34f3a157697..101334d2ea526abf2e1803a93308492a61904699 100644 (file)
@@ -19,12 +19,12 @@ using std::uint16_t;
 
 using boost::none;
 using boost::optional;
-using boost::string_ref;
+using std::string_view;
 
 using ceph::real_clock;
 using ceph::real_time;
 
-using sriter = string_ref::const_iterator;
+using sriter = string_view::const_iterator;
 
 namespace {
 // This assumes a contiguous block of numbers in the correct order.
@@ -47,7 +47,7 @@ optional<real_time> calculate(const tm& t, uint32_t n = 0) {
 }
 }
 
-optional<real_time> from_iso_8601(const string_ref s,
+optional<real_time> from_iso_8601(const string_view s,
                                  const bool ws_terminates) noexcept {
   auto end = s.cend();
   auto read_digit = [end](sriter& c) mutable {
index 5aa63983386941b082f0806a0d2228c2ff5a5a26..40f6646b23374045f45d1bd470af0881342bb796 100644 (file)
@@ -4,8 +4,8 @@
 #ifndef CEPH_COMMON_ISO_8601_H
 #define CEPH_COMMON_ISO_8601_H
 
+#include <string_view>
 #include <boost/optional.hpp>
-#include <boost/utility/string_ref.hpp>
 
 #include "common/ceph_time.h"
 
@@ -30,7 +30,7 @@ namespace ceph {
 // If a date is invalid, boost::none is returned.
 
 boost::optional<ceph::real_time> from_iso_8601(
-  boost::string_ref s, const bool ws_terminates = true) noexcept;
+  std::string_view s, const bool ws_terminates = true) noexcept;
 
 enum class iso_8601_format {
   Y, YM, YMD, YMDh, YMDhm, YMDhms, YMDhmsn
index fe5409ecb009f793f55c8988eb1d848dbfda7cc4..b0fcd9b5c47d22bc1e5cd053fd0e9d7b14bdd220 100644 (file)
  */
 /*
  * C++2014 dependencies removed.  Uses of std::string_view adapted to
- * boost::string_ref.  Matt Benjamin <mbenjamin@redhat.com>
+ * std::string_view.  Matt Benjamin <mbenjamin@redhat.com>
  */
 
 #ifndef SSTRING_HH_
 #define SSTRING_HH_
 
+#include <string_view>
 #include <type_traits>
-#include <boost/utility/string_view.hpp>
 
 #include "include/buffer.h"
 #include "include/denc.h"
@@ -527,8 +527,8 @@ public:
     const char_type& operator[](size_type pos) const {
         return str()[pos];
     }
-    operator boost::basic_string_view<char_type, traits_type>() const {
-               return boost::basic_string_view<char_type, traits_type>(str(), size());
+    operator std::basic_string_view<char_type, traits_type>() const {
+               return std::basic_string_view<char_type, traits_type>(str(), size());
     }
     template <typename string_type, typename T>
     friend inline string_type to_sstring(T value);
@@ -611,7 +611,7 @@ template <typename char_type, typename size_type, size_type max_size>
 struct hash<basic_sstring<char_type, size_type, max_size>> {
     size_t operator()(const basic_sstring<char_type, size_type, max_size>& s) const {
                using traits_type = std::char_traits<char_type>;
-               return std::hash<boost::basic_string_view<char_type,traits_type>>()(s);
+               return std::hash<std::basic_string_view<char_type,traits_type>>()(s);
     }
 };
 
index aeb30e2f99c99deefe528abd1d72a1eb921f5c74..44a2c1aafcccb9a2e507ab90878ea1b4a50244c9 100644 (file)
@@ -6,10 +6,11 @@
 
 #include <map>
 #include <string>
+#include <string_view>
 #include <include/types.h>
 
 #include <boost/optional.hpp>
-#include <boost/utility/string_ref.hpp>
+#include <boost/algorithm/string/predicate.hpp>
 
 #include "common/debug.h"
 
@@ -186,7 +187,7 @@ public:
   static void generate_test_instances(list<ACLGrant*>& o);
 
   ACLGroupTypeEnum uri_to_group(string& uri);
-  
+
   void set_canon(const rgw_user& _id, const string& _name, const uint32_t perm) {
     type.set(ACL_TYPE_CANON_USER);
     id = _id;
@@ -217,7 +218,7 @@ struct ACLReferer {
       perm(perm) {
   }
 
-  bool is_match(boost::string_ref http_referer) const {
+  bool is_match(std::string_view http_referer) const {
     const auto http_host = get_http_host(http_referer);
     if (!http_host || http_host->length() < url_spec.length()) {
       return false;
@@ -234,7 +235,7 @@ struct ACLReferer {
     if ('.' == url_spec[0]) {
       /* Wildcard support: a referer matches the spec when its last char are
        * perfectly equal to spec. */
-      return http_host->ends_with(url_spec);
+      return boost::algorithm::ends_with(http_host.value(), url_spec);
     }
 
     return false;
@@ -255,19 +256,19 @@ struct ACLReferer {
   void dump(Formatter *f) const;
 
 private:
-  boost::optional<boost::string_ref> get_http_host(const boost::string_ref url) const {
+  boost::optional<std::string_view> get_http_host(const std::string_view url) const {
     size_t pos = url.find("://");
-    if (pos == boost::string_ref::npos || url.starts_with("://") ||
-        url.ends_with("://") || url.ends_with('@')) {
+    if (pos == std::string_view::npos || boost::algorithm::starts_with(url, "://") ||
+        boost::algorithm::ends_with(url, "://") || boost::algorithm::ends_with(url, "@")) {
       return boost::none;
     }
-    boost::string_ref url_sub = url.substr(pos + strlen("://"));  
+    std::string_view url_sub = url.substr(pos + strlen("://"));
     pos = url_sub.find('@');
-    if (pos != boost::string_ref::npos) {
+    if (pos != std::string_view::npos) {
       url_sub = url_sub.substr(pos + 1);
     }
     pos = url_sub.find_first_of("/:");
-    if (pos == boost::string_ref::npos) {
+    if (pos == std::string_view::npos) {
       /* no port or path exists */
       return url_sub;
     }
index a93ae2e4b461aafc38ac38798126dfd1993b19d9..36f00c9173eeab017eb4e20cfa9dc6e2e316113b 100644 (file)
@@ -75,7 +75,7 @@ static boost::optional<ACLGrant> referrer_to_grant(std::string url_spec,
 {
   /* This function takes url_spec as non-ref std::string because of the trim
    * operation that is essential to preserve compliance with Swift. It can't
-   * be easily accomplished with boost::string_ref. */
+   * be easily accomplished with std::string_view. */
   try {
     bool is_negative;
     ACLGrant grant;
index 58f79164f8d105e002e23d162133cf1ab872741a..ccafa3498b8effd7cd6431263dac89564d80418c 100644 (file)
@@ -47,7 +47,7 @@ int ClientIO::init_env(CephContext *cct)
       continue;
     }
 
-    static const boost::string_ref HTTP_{"HTTP_"};
+    static const std::string_view HTTP_{"HTTP_"};
 
     char buf[name.size() + HTTP_.size() + 1];
     auto dest = std::copy(std::begin(HTTP_), std::end(HTTP_), buf);
@@ -161,8 +161,8 @@ size_t ClientIO::complete_header()
   return sent;
 }
 
-size_t ClientIO::send_header(const boost::string_ref& name,
-                             const boost::string_ref& value)
+size_t ClientIO::send_header(const std::string_view& name,
+                             const std::string_view& value)
 {
   static constexpr char HEADER_SEP[] = ": ";
   static constexpr char HEADER_END[] = "\r\n";
index f47126d34341a267825e8bfce972d6e67dbe6b0f..a595b0351997ba452472c2bf7dd5f9ead1beebcf 100644 (file)
@@ -42,8 +42,8 @@ class ClientIO : public io::RestfulClient,
   void flush() override;
   size_t send_status(int status, const char *status_name) override;
   size_t send_100_continue() override;
-  size_t send_header(const boost::string_ref& name,
-                     const boost::string_ref& value) override;
+  size_t send_header(const std::string_view& name,
+                     const std::string_view& value) override;
   size_t send_content_length(uint64_t len) override;
   size_t complete_header() override;
 
index 9081cbb0de9f6b94e63433cb6ade4f5c74a4ebc4..c0eeb02fa57a949da7a3cc97d9df7ac16e5752e6 100644 (file)
@@ -266,9 +266,9 @@ TokenEngine::authenticate(const DoutPrefixProvider* dpp,
  * Try to validate S3 auth against keystone s3token interface
  */
 std::pair<boost::optional<rgw::keystone::TokenEnvelope>, int>
-EC2Engine::get_from_keystone(const DoutPrefixProvider* dpp, const boost::string_view& access_key_id,
+EC2Engine::get_from_keystone(const DoutPrefixProvider* dpp, const std::string_view& access_key_id,
                              const std::string& string_to_sign,
-                             const boost::string_view& signature) const
+                             const std::string_view& signature) const
 {
   /* prepare keystone url */
   std::string keystone_url = config.get_endpoint_url();
@@ -354,7 +354,7 @@ EC2Engine::get_from_keystone(const DoutPrefixProvider* dpp, const boost::string_
 
 std::pair<boost::optional<std::string>, int> EC2Engine::get_secret_from_keystone(const DoutPrefixProvider* dpp,
                                                                                  const std::string& user_id,
-                                                                                 const boost::string_view& access_key_id) const
+                                                                                 const std::string_view& access_key_id) const
 {
   /*  Fetch from /users/{USER_ID}/credentials/OS-EC2/{ACCESS_KEY_ID} */
   /* Should return json with response key "credential" which contains entry "secret"*/
@@ -374,7 +374,7 @@ std::pair<boost::optional<std::string>, int> EC2Engine::get_secret_from_keystone
   keystone_url.append("users/");
   keystone_url.append(user_id);
   keystone_url.append("/credentials/OS-EC2/");
-  keystone_url.append(access_key_id.to_string());
+  keystone_url.append(std::string(access_key_id));
 
   /* get authentication token for Keystone. */
   std::string admin_token;
@@ -444,9 +444,9 @@ std::pair<boost::optional<std::string>, int> EC2Engine::get_secret_from_keystone
  */
 std::pair<boost::optional<rgw::keystone::TokenEnvelope>, int>
 EC2Engine::get_access_token(const DoutPrefixProvider* dpp,
-                           const boost::string_view& access_key_id,
+                           const std::string_view& access_key_id,
                             const std::string& string_to_sign,
-                            const boost::string_view& signature,
+                            const std::string_view& signature,
                            const signature_factory_t& signature_factory) const
 {
   using server_signature_t = VersionAbstractor::server_signature_t;
@@ -455,7 +455,7 @@ EC2Engine::get_access_token(const DoutPrefixProvider* dpp,
 
   /* Get a token from the cache if one has already been stored */
   boost::optional<boost::tuple<rgw::keystone::TokenEnvelope, std::string>>
-    t = secret_cache.find(access_key_id.to_string());
+    t = secret_cache.find(std::string(access_key_id));
 
   /* Check that credentials can correctly be used to sign data */
   if (t) {
@@ -480,7 +480,7 @@ EC2Engine::get_access_token(const DoutPrefixProvider* dpp,
 
     if (secret) {
       /* Add token, secret pair to cache, and set timeout */
-      secret_cache.add(access_key_id.to_string(), *token, *secret);
+      secret_cache.add(std::string(access_key_id), *token, *secret);
     }
   }
 
@@ -527,9 +527,9 @@ EC2Engine::get_creds_info(const EC2Engine::token_envelope_t& token,
 
 rgw::auth::Engine::result_t EC2Engine::authenticate(
   const DoutPrefixProvider* dpp,
-  const boost::string_view& access_key_id,
-  const boost::string_view& signature,
-  const boost::string_view& session_token,
+  const std::string_view& access_key_id,
+  const std::string_view& signature,
+  const std::string_view& session_token,
   const string_to_sign_t& string_to_sign,
   const signature_factory_t& signature_factory,
   const completer_factory_t& completer_factory,
index 07f4ec3bade99e08fe0851ce919fb448eaead0f7..6c3e3b84c45406343d4c6b37571db5e0ad55cc9d 100644 (file)
@@ -5,9 +5,9 @@
 #ifndef CEPH_RGW_AUTH_KEYSTONE_H
 #define CEPH_RGW_AUTH_KEYSTONE_H
 
+#include <string_view>
 #include <utility>
 #include <boost/optional.hpp>
-#include <boost/utility/string_view.hpp>
 
 #include "rgw_auth.h"
 #include "rgw_rest_s3.h"
@@ -141,26 +141,26 @@ class EC2Engine : public rgw::auth::s3::AWSEngine {
                             ) const noexcept;
   std::pair<boost::optional<token_envelope_t>, int>
   get_from_keystone(const DoutPrefixProvider* dpp,
-                    const boost::string_view& access_key_id,
+                    const std::string_view& access_key_id,
                     const std::string& string_to_sign,
-                    const boost::string_view& signature) const;
+                    const std::string_view& signature) const;
   std::pair<boost::optional<token_envelope_t>, int>
   get_access_token(const DoutPrefixProvider* dpp,
-                   const boost::string_view& access_key_id,
+                   const std::string_view& access_key_id,
                    const std::string& string_to_sign,
-                   const boost::string_view& signature,
+                   const std::string_view& signature,
                   const signature_factory_t& signature_factory) const;
   result_t authenticate(const DoutPrefixProvider* dpp,
-                        const boost::string_view& access_key_id,
-                        const boost::string_view& signature,
-                        const boost::string_view& session_token,
+                        const std::string_view& access_key_id,
+                        const std::string_view& signature,
+                        const std::string_view& session_token,
                         const string_to_sign_t& string_to_sign,
                         const signature_factory_t& signature_factory,
                         const completer_factory_t& completer_factory,
                         const req_state* s) const override;
   std::pair<boost::optional<std::string>, int> get_secret_from_keystone(const DoutPrefixProvider* dpp,
                                                                         const std::string& user_id,
-                                                                        const boost::string_view& access_key_id) const;
+                                                                        const std::string_view& access_key_id) const;
 public:
   EC2Engine(CephContext* const cct,
             const rgw::auth::s3::AWSEngine::VersionAbstractor* const ver_abstractor,
index bdee372b10d0fb9726b98eb3a2df0a11488d5780..cd1239ce0aaa52a325cb1bd062468e20fbd86eb2 100644 (file)
@@ -5,6 +5,7 @@
 #include <map>
 #include <iterator>
 #include <string>
+#include <string_view>
 #include <vector>
 
 #include "common/armor.h"
@@ -17,7 +18,6 @@
 #include "rgw_crypt_sanitize.h"
 
 #include <boost/container/small_vector.hpp>
-#include <boost/utility/string_view.hpp>
 #include <boost/algorithm/string/trim_all.hpp>
 
 #define dout_context g_ceph_context
@@ -258,11 +258,11 @@ bool is_time_skew_ok(time_t t)
 }
 
 static inline int parse_v4_query_string(const req_info& info,              /* in */
-                                        boost::string_view& credential,    /* out */
-                                        boost::string_view& signedheaders, /* out */
-                                        boost::string_view& signature,     /* out */
-                                        boost::string_view& date,          /* out */
-                                        boost::string_view& sessiontoken)  /* out */
+                                        std::string_view& credential,    /* out */
+                                        std::string_view& signedheaders, /* out */
+                                        std::string_view& signature,     /* out */
+                                        std::string_view& date,          /* out */
+                                        std::string_view& sessiontoken)  /* out */
 {
   /* auth ships with req params ... */
 
@@ -278,7 +278,7 @@ static inline int parse_v4_query_string(const req_info& info,              /* in
     return -EPERM;
   }
 
-  boost::string_view expires = info.args.get("X-Amz-Expires");
+  std::string_view expires = info.args.get("X-Amz-Expires");
   if (expires.empty()) {
     return -EPERM;
   }
@@ -318,19 +318,19 @@ static inline int parse_v4_query_string(const req_info& info,              /* in
   return 0;
 }
 
-static bool get_next_token(const boost::string_view& s,
+static bool get_next_token(const std::string_view& s,
                            size_t& pos,
                            const char* const delims,
-                           boost::string_view& token)
+                           std::string_view& token)
 {
   const size_t start = s.find_first_not_of(delims, pos);
-  if (start == boost::string_view::npos) {
+  if (start == std::string_view::npos) {
     pos = s.size();
     return false;
   }
 
   size_t end = s.find_first_of(delims, start);
-  if (end != boost::string_view::npos)
+  if (end != std::string_view::npos)
     pos = end + 1;
   else {
     pos = end = s.size();
@@ -341,13 +341,13 @@ static bool get_next_token(const boost::string_view& s,
 }
 
 template<std::size_t ExpectedStrNum>
-boost::container::small_vector<boost::string_view, ExpectedStrNum>
-get_str_vec(const boost::string_view& str, const char* const delims)
+boost::container::small_vector<std::string_view, ExpectedStrNum>
+get_str_vec(const std::string_view& str, const char* const delims)
 {
-  boost::container::small_vector<boost::string_view, ExpectedStrNum> str_vec;
+  boost::container::small_vector<std::string_view, ExpectedStrNum> str_vec;
 
   size_t pos = 0;
-  boost::string_view token;
+  std::string_view token;
   while (pos < str.size()) {
     if (get_next_token(str, pos, delims, token)) {
       if (token.size() > 0) {
@@ -360,21 +360,21 @@ get_str_vec(const boost::string_view& str, const char* const delims)
 }
 
 template<std::size_t ExpectedStrNum>
-boost::container::small_vector<boost::string_view, ExpectedStrNum>
-get_str_vec(const boost::string_view& str)
+boost::container::small_vector<std::string_view, ExpectedStrNum>
+get_str_vec(const std::string_view& str)
 {
   const char delims[] = ";,= \t";
   return get_str_vec<ExpectedStrNum>(str, delims);
 }
 
 static inline int parse_v4_auth_header(const req_info& info,               /* in */
-                                       boost::string_view& credential,     /* out */
-                                       boost::string_view& signedheaders,  /* out */
-                                       boost::string_view& signature,      /* out */
-                                       boost::string_view& date,           /* out */
-                                       boost::string_view& sessiontoken)   /* out */
+                                       std::string_view& credential,     /* out */
+                                       std::string_view& signedheaders,  /* out */
+                                       std::string_view& signature,      /* out */
+                                       std::string_view& date,           /* out */
+                                       std::string_view& sessiontoken)   /* out */
 {
-  boost::string_view input(info.env->get("HTTP_AUTHORIZATION", ""));
+  std::string_view input(info.env->get("HTTP_AUTHORIZATION", ""));
   try {
     input = input.substr(::strlen(AWS4_HMAC_SHA256_STR) + 1);
   } catch (std::out_of_range&) {
@@ -384,7 +384,7 @@ static inline int parse_v4_auth_header(const req_info& info,               /* in
     return -EINVAL;
   }
 
-  std::map<boost::string_view, boost::string_view> kv;
+  std::map<std::string_view, std::string_view> kv;
   for (const auto& s : get_str_vec<4>(input, ",")) {
     const auto parsed_pair = parse_key_value(s);
     if (parsed_pair) {
@@ -396,7 +396,7 @@ static inline int parse_v4_auth_header(const req_info& info,               /* in
     }
   }
 
-  static const std::array<boost::string_view, 3> required_keys = {
+  static const std::array<std::string_view, 3> required_keys = {
     "Credential",
     "SignedHeaders",
     "Signature"
@@ -441,15 +441,15 @@ static inline int parse_v4_auth_header(const req_info& info,               /* in
 }
 
 int parse_v4_credentials(const req_info& info,                     /* in */
-                        boost::string_view& access_key_id,        /* out */
-                        boost::string_view& credential_scope,     /* out */
-                        boost::string_view& signedheaders,        /* out */
-                        boost::string_view& signature,            /* out */
-                        boost::string_view& date,                 /* out */
-                        boost::string_view& session_token,        /* out */
+                        std::string_view& access_key_id,        /* out */
+                        std::string_view& credential_scope,     /* out */
+                        std::string_view& signedheaders,        /* out */
+                        std::string_view& signature,            /* out */
+                        std::string_view& date,                 /* out */
+                        std::string_view& session_token,        /* out */
                         const bool using_qs)                      /* in */
 {
-  boost::string_view credential;
+  std::string_view credential;
   int ret;
   if (using_qs) {
     ret = parse_v4_query_string(info, credential, signedheaders,
@@ -505,7 +505,7 @@ std::string get_v4_canonical_qs(const req_info& info, const bool using_qs)
    * aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html */
   std::map<std::string, std::string> canonical_qs_map;
   for (const auto& s : get_str_vec<5>(*params, "&")) {
-    boost::string_view key, val;
+    std::string_view key, val;
     const auto parsed_pair = parse_key_value(s);
     if (parsed_pair) {
       std::tie(key, val) = *parsed_pair;
@@ -547,11 +547,11 @@ std::string get_v4_canonical_qs(const req_info& info, const bool using_qs)
 
 boost::optional<std::string>
 get_v4_canonical_headers(const req_info& info,
-                         const boost::string_view& signedheaders,
+                         const std::string_view& signedheaders,
                          const bool using_qs,
                          const bool force_boto2_compat)
 {
-  std::map<boost::string_view, std::string> canonical_hdrs_map;
+  std::map<std::string_view, std::string> canonical_hdrs_map;
   for (const auto& token : get_str_vec<5>(signedheaders, ";")) {
     /* TODO(rzarzynski): we'd like to switch to sstring here but it should
      * get push_back() and reserve() first. */
@@ -584,8 +584,8 @@ get_v4_canonical_headers(const req_info& info,
     }
 
     if (force_boto2_compat && using_qs && token == "host") {
-      boost::string_view port = info.env->get("SERVER_PORT", "");
-      boost::string_view secure_port = info.env->get("SERVER_PORT_SECURE", "");
+      std::string_view port = info.env->get("SERVER_PORT", "");
+      std::string_view secure_port = info.env->get("SERVER_PORT_SECURE", "");
 
       if (!secure_port.empty()) {
        if (secure_port != "443")
@@ -603,7 +603,7 @@ get_v4_canonical_headers(const req_info& info,
 
   std::string canonical_hdrs;
   for (const auto& header : canonical_hdrs_map) {
-    const boost::string_view& name = header.first;
+    const std::string_view& name = header.first;
     std::string value = header.second;
     boost::trim_all<std::string>(value);
 
@@ -623,12 +623,12 @@ get_v4_canonical_headers(const req_info& info,
  */
 sha256_digest_t
 get_v4_canon_req_hash(CephContext* cct,
-                      const boost::string_view& http_verb,
+                      const std::string_view& http_verb,
                       const std::string& canonical_uri,
                       const std::string& canonical_qs,
                       const std::string& canonical_hdrs,
-                      const boost::string_view& signed_hdrs,
-                      const boost::string_view& request_payload_hash)
+                      const std::string_view& signed_hdrs,
+                      const std::string_view& request_payload_hash)
 {
   ldout(cct, 10) << "payload request hash = " << request_payload_hash << dendl;
 
@@ -657,13 +657,13 @@ get_v4_canon_req_hash(CephContext* cct,
  */
 AWSEngine::VersionAbstractor::string_to_sign_t
 get_v4_string_to_sign(CephContext* const cct,
-                      const boost::string_view& algorithm,
-                      const boost::string_view& request_date,
-                      const boost::string_view& credential_scope,
+                      const std::string_view& algorithm,
+                      const std::string_view& request_date,
+                      const std::string_view& credential_scope,
                       const sha256_digest_t& canonreq_hash)
 {
   const auto hexed_cr_hash = canonreq_hash.to_str();
-  const boost::string_view hexed_cr_hash_str(hexed_cr_hash);
+  const std::string_view hexed_cr_hash_str(hexed_cr_hash);
 
   const auto string_to_sign = string_join_reserve("\n",
     algorithm,
@@ -679,10 +679,10 @@ get_v4_string_to_sign(CephContext* const cct,
 }
 
 
-static inline std::tuple<boost::string_view,            /* date */
-                         boost::string_view,            /* region */
-                         boost::string_view>            /* service */
-parse_cred_scope(boost::string_view credential_scope)
+static inline std::tuple<std::string_view,            /* date */
+                         std::string_view,            /* region */
+                         std::string_view>            /* service */
+parse_cred_scope(std::string_view credential_scope)
 {
   /* date cred */
   size_t pos = credential_scope.find("/");
@@ -702,7 +702,7 @@ parse_cred_scope(boost::string_view credential_scope)
 }
 
 static inline std::vector<unsigned char>
-transform_secret_key(const boost::string_view& secret_access_key)
+transform_secret_key(const std::string_view& secret_access_key)
 {
   /* TODO(rzarzynski): switch to constexpr when C++14 becomes available. */
   static const std::initializer_list<unsigned char> AWS4 { 'A', 'W', 'S', '4' };
@@ -728,10 +728,10 @@ transform_secret_key(const boost::string_view& secret_access_key)
  */
 static sha256_digest_t
 get_v4_signing_key(CephContext* const cct,
-                   const boost::string_view& credential_scope,
-                   const boost::string_view& secret_access_key)
+                   const std::string_view& credential_scope,
+                   const std::string_view& secret_access_key)
 {
-  boost::string_view date, region, service;
+  std::string_view date, region, service;
   std::tie(date, region, service) = parse_cred_scope(credential_scope);
 
   const auto utfed_sec_key = transform_secret_key(secret_access_key);
@@ -741,7 +741,7 @@ get_v4_signing_key(CephContext* const cct,
 
   /* aws4_request */
   const auto signing_key = calc_hmac_sha256(service_k,
-                                            boost::string_view("aws4_request"));
+                                            std::string_view("aws4_request"));
 
   ldout(cct, 10) << "date_k    = " << date_k << dendl;
   ldout(cct, 10) << "region_k  = " << region_k << dendl;
@@ -761,9 +761,9 @@ get_v4_signing_key(CephContext* const cct,
  * dynamic allocations.
  */
 AWSEngine::VersionAbstractor::server_signature_t
-get_v4_signature(const boost::string_view& credential_scope,
+get_v4_signature(const std::string_view& credential_scope,
                  CephContext* const cct,
-                 const boost::string_view& secret_key,
+                 const std::string_view& secret_key,
                  const AWSEngine::VersionAbstractor::string_to_sign_t& string_to_sign)
 {
   auto signing_key = get_v4_signing_key(cct, credential_scope, secret_key);
@@ -833,10 +833,10 @@ AWSv4ComplMulti::ChunkMeta::create_next(CephContext* const cct,
                                         const char* const metabuf,
                                         const size_t metabuf_len)
 {
-  boost::string_ref metastr(metabuf, metabuf_len);
+  std::string_view metastr(metabuf, metabuf_len);
 
   const size_t semicolon_pos = metastr.find(";");
-  if (semicolon_pos == boost::string_ref::npos) {
+  if (semicolon_pos == std::string_view::npos) {
     ldout(cct, 20) << "AWSv4ComplMulti cannot find the ';' separator"
                    << dendl;
     throw rgw::io::Exception(EINVAL, std::system_category());
@@ -854,7 +854,7 @@ AWSv4ComplMulti::ChunkMeta::create_next(CephContext* const cct,
   /* Parse the chunk_signature=... part. */
   const auto signature_part = metastr.substr(semicolon_pos + 1);
   const size_t eq_sign_pos = signature_part.find("=");
-  if (eq_sign_pos == boost::string_ref::npos) {
+  if (eq_sign_pos == std::string_view::npos) {
     ldout(cct, 20) << "AWSv4ComplMulti: cannot find the '=' separator"
                    << dendl;
     throw rgw::io::Exception(EINVAL, std::system_category());
@@ -862,7 +862,7 @@ AWSv4ComplMulti::ChunkMeta::create_next(CephContext* const cct,
 
   /* OK, we have at least the beginning of a signature. */
   const size_t data_sep_pos = signature_part.find("\r\n");
-  if (data_sep_pos == boost::string_ref::npos) {
+  if (data_sep_pos == std::string_view::npos) {
     ldout(cct, 20) << "AWSv4ComplMulti: no new line at signature end"
                    << dendl;
     throw rgw::io::Exception(EINVAL, std::system_category());
@@ -1058,9 +1058,9 @@ bool AWSv4ComplMulti::complete()
 
 rgw::auth::Completer::cmplptr_t
 AWSv4ComplMulti::create(const req_state* const s,
-                        boost::string_view date,
-                        boost::string_view credential_scope,
-                        boost::string_view seed_signature,
+                        std::string_view date,
+                        std::string_view credential_scope,
+                        std::string_view seed_signature,
                         const boost::optional<std::string>& secret_key)
 {
   if (!secret_key) {
index 0809ee854eb8783c3a2f6fe970a69f06b3997a98..d7aaa52b47ad7444579a3197f9d68257b70cf013 100644 (file)
@@ -7,12 +7,11 @@
 #include <array>
 #include <memory>
 #include <string>
+#include <string_view>
 #include <tuple>
 
 #include <boost/algorithm/string.hpp>
 #include <boost/container/static_vector.hpp>
-#include <boost/utility/string_ref.hpp>
-#include <boost/utility/string_view.hpp>
 
 #include "common/sstring.hh"
 #include "rgw_common.h"
@@ -271,8 +270,8 @@ class AWSv4ComplMulti : public rgw::auth::Completer,
 
   CephContext* const cct;
 
-  const boost::string_view date;
-  const boost::string_view credential_scope;
+  const std::string_view date;
+  const std::string_view credential_scope;
   const signing_key_t signing_key;
 
   class ChunkMeta {
@@ -282,14 +281,14 @@ class AWSv4ComplMulti : public rgw::auth::Completer,
 
     ChunkMeta(const size_t data_starts_in_stream,
               const size_t data_length,
-              const boost::string_ref signature)
+              const std::string_view signature)
       : data_offset_in_stream(data_starts_in_stream),
         data_length(data_length),
-        signature(signature.to_string()) {
+        signature(std::string(signature)) {
     }
 
-    explicit ChunkMeta(const boost::string_view& signature)
-      : signature(signature.to_string()) {
+    explicit ChunkMeta(const std::string_view& signature)
+      : signature(std::string(signature)) {
     }
 
   public:
@@ -315,7 +314,7 @@ class AWSv4ComplMulti : public rgw::auth::Completer,
 
     /* Factory: create an object representing metadata of first, initial chunk
      * in a stream. */
-    static ChunkMeta create_first(const boost::string_view& seed_signature) {
+    static ChunkMeta create_first(const std::string_view& seed_signature) {
       return ChunkMeta(seed_signature);
     }
 
@@ -340,9 +339,9 @@ public:
   /* We need the constructor to be public because of the std::make_shared that
    * is employed by the create() method. */
   AWSv4ComplMulti(const req_state* const s,
-                  boost::string_view date,
-                  boost::string_view credential_scope,
-                  boost::string_view seed_signature,
+                  std::string_view date,
+                  std::string_view credential_scope,
+                  std::string_view seed_signature,
                   const signing_key_t& signing_key)
     : io_base_t(nullptr),
       cct(s->cct),
@@ -372,9 +371,9 @@ public:
 
   /* Factories. */
   static cmplptr_t create(const req_state* s,
-                          boost::string_view date,
-                          boost::string_view credential_scope,
-                          boost::string_view seed_signature,
+                          std::string_view date,
+                          std::string_view credential_scope,
+                          std::string_view seed_signature,
                           const boost::optional<std::string>& secret_key);
 
 };
@@ -456,12 +455,12 @@ static constexpr char AWS4_STREAMING_PAYLOAD_HASH[] = \
   "STREAMING-AWS4-HMAC-SHA256-PAYLOAD";
 
 int parse_v4_credentials(const req_info& info,                     /* in */
-                        boost::string_view& access_key_id,        /* out */
-                        boost::string_view& credential_scope,     /* out */
-                        boost::string_view& signedheaders,        /* out */
-                        boost::string_view& signature,            /* out */
-                        boost::string_view& date,                 /* out */
-                        boost::string_view& session_token,        /* out */
+                        std::string_view& access_key_id,        /* out */
+                        std::string_view& credential_scope,     /* out */
+                        std::string_view& signedheaders,        /* out */
+                        std::string_view& signature,            /* out */
+                        std::string_view& date,                 /* out */
+                        std::string_view& session_token,        /* out */
                         const bool using_qs);                     /* in */
 
 static inline bool char_needs_aws4_escaping(const char c, bool encode_slash)
@@ -501,7 +500,7 @@ static inline std::string aws4_uri_encode(const std::string& src, bool encode_sl
   return result;
 }
 
-static inline std::string aws4_uri_recode(const boost::string_view& src, bool encode_slash)
+static inline std::string aws4_uri_recode(const std::string_view& src, bool encode_slash)
 {
   std::string decoded = url_decode(src);
   return aws4_uri_encode(decoded, encode_slash);
@@ -581,30 +580,30 @@ std::string get_v4_canonical_qs(const req_info& info, bool using_qs);
 
 boost::optional<std::string>
 get_v4_canonical_headers(const req_info& info,
-                         const boost::string_view& signedheaders,
+                         const std::string_view& signedheaders,
                          bool using_qs,
                          bool force_boto2_compat);
 
 extern sha256_digest_t
 get_v4_canon_req_hash(CephContext* cct,
-                      const boost::string_view& http_verb,
+                      const std::string_view& http_verb,
                       const std::string& canonical_uri,
                       const std::string& canonical_qs,
                       const std::string& canonical_hdrs,
-                      const boost::string_view& signed_hdrs,
-                      const boost::string_view& request_payload_hash);
+                      const std::string_view& signed_hdrs,
+                      const std::string_view& request_payload_hash);
 
 AWSEngine::VersionAbstractor::string_to_sign_t
 get_v4_string_to_sign(CephContext* cct,
-                      const boost::string_view& algorithm,
-                      const boost::string_view& request_date,
-                      const boost::string_view& credential_scope,
+                      const std::string_view& algorithm,
+                      const std::string_view& request_date,
+                      const std::string_view& credential_scope,
                       const sha256_digest_t& canonreq_hash);
 
 extern AWSEngine::VersionAbstractor::server_signature_t
-get_v4_signature(const boost::string_view& credential_scope,
+get_v4_signature(const std::string_view& credential_scope,
                  CephContext* const cct,
-                 const boost::string_view& secret_key,
+                 const std::string_view& secret_key,
                  const AWSEngine::VersionAbstractor::string_to_sign_t& string_to_sign);
 
 extern AWSEngine::VersionAbstractor::server_signature_t
index 06bd67038ebd17d30fdb604118799a3af3b27624..063f8744cbe24fbc716f0282fd4d49f431f6ba72 100644 (file)
@@ -4,14 +4,13 @@
 #ifndef RGW_B64_H
 #define RGW_B64_H
 
-#include <boost/utility/string_ref.hpp>
-#include <boost/utility/string_view.hpp>
 #include <boost/archive/iterators/base64_from_binary.hpp>
 #include <boost/archive/iterators/binary_from_base64.hpp>
 #include <boost/archive/iterators/insert_linebreaks.hpp>
 #include <boost/archive/iterators/transform_width.hpp>
 #include <boost/archive/iterators/remove_whitespace.hpp>
 #include <limits>
+#include <string_view>
 
 namespace rgw {
 
@@ -19,14 +18,14 @@ namespace rgw {
    * A header-only Base64 encoder built on boost::archive.  The
    * formula is based on a class poposed for inclusion in boost in
    * 2011 by Denis Shevchenko (abandoned), updated slightly
-   * (e.g., uses boost::string_view).
+   * (e.g., uses std::string_view).
    *
    * Also, wrap_width added as template argument, based on
    * feedback from Marcus.
    */
 
   template<int wrap_width = std::numeric_limits<int>::max()>
-  inline std::string to_base64(boost::string_view sview)
+  inline std::string to_base64(std::string_view sview)
   {
     using namespace boost::archive::iterators;
 
@@ -43,7 +42,7 @@ namespace rgw {
       insert_linebreaks<
         base64_from_binary<
           transform_width<
-           boost::string_view::const_iterator
+           std::string_view::const_iterator
             ,6,8>
           >
           ,wrap_width
@@ -59,7 +58,7 @@ namespace rgw {
     return outstr;
   }
 
-  inline std::string from_base64(boost::string_view sview)
+  inline std::string from_base64(std::string_view sview)
   {
     using namespace boost::archive::iterators;
     if (sview.empty())
@@ -70,7 +69,7 @@ namespace rgw {
       transform_width<
       binary_from_base64<
        remove_whitespace<
-         boost::string_view::const_iterator>>
+         std::string_view::const_iterator>>
       ,8,6
       > b64_iter;
 
index c1a99887b553fde11772628bfcd9cbe7eee099fc..8b197b2db97adbda233ab6c687885a455bd71d0d 100644 (file)
@@ -6,8 +6,8 @@
 #include <string>
 #include <map>
 #include <sstream>
+#include <string_view>
 
-#include <boost/utility/string_ref.hpp>
 #include <boost/format.hpp>
 
 #include "common/errno.h"
@@ -198,8 +198,8 @@ int rgw_bucket_parse_bucket_instance(const string& bucket_instance, string *buck
 int rgw_bucket_parse_bucket_key(CephContext *cct, const string& key,
                                 rgw_bucket *bucket, int *shard_id)
 {
-  boost::string_ref name{key};
-  boost::string_ref instance;
+  std::string_view name{key};
+  std::string_view instance;
 
   // split tenant/name
   auto pos = name.find('/');
index df54c125f7f681eb78cc08ff84eccbef3846ef50..3607e679273a6efcdd3f9cf48fb8f44690798155 100644 (file)
@@ -2,9 +2,9 @@
 // vim: ts=8 sw=2 smarttab ft=cpp
 
 #include <string.h>
+#include <string_view>
 
 #include <boost/algorithm/string/predicate.hpp>
-#include <boost/utility/string_ref.hpp>
 
 #include "civetweb/civetweb.h"
 #include "rgw_civetweb.h"
@@ -102,7 +102,7 @@ int RGWCivetWeb::init_env(CephContext *cct)
       return -EINVAL;
     }
 
-    const boost::string_ref name(header->name);
+    const std::string_view name(header->name);
     const auto& value = header->value;
 
     if (boost::algorithm::iequals(name, "content-length")) {
@@ -118,7 +118,7 @@ int RGWCivetWeb::init_env(CephContext *cct)
       explicit_conn_close = boost::algorithm::iequals(value, "close");
     }
 
-    static const boost::string_ref HTTP_{"HTTP_"};
+    static const std::string_view HTTP_{"HTTP_"};
 
     char buf[name.size() + HTTP_.size() + 1];
     auto dest = std::copy(std::begin(HTTP_), std::end(HTTP_), buf);
@@ -182,8 +182,8 @@ size_t RGWCivetWeb::send_100_continue()
   return sent;
 }
 
-size_t RGWCivetWeb::send_header(const boost::string_ref& name,
-                                const boost::string_ref& value)
+size_t RGWCivetWeb::send_header(const std::string_view& name,
+                                const std::string_view& value)
 {
   static constexpr char HEADER_SEP[] = ": ";
   static constexpr char HEADER_END[] = "\r\n";
index c2437bcdfeaf871a39f2c12465d10dc1c344b9be..8288b9705f37493cf04e4da2081d5e1f5dd977a1 100644 (file)
@@ -32,8 +32,8 @@ public:
 
   size_t send_status(int status, const char *status_name) override;
   size_t send_100_continue() override;
-  size_t send_header(const boost::string_ref& name,
-                     const boost::string_ref& value) override;
+  size_t send_header(const std::string_view& name,
+                     const std::string_view& value) override;
   size_t send_content_length(uint64_t len) override;
   size_t complete_header() override;
 
index 4656adb58df5c4a1671d12d18eab562115308c23..6375e8c643e209b5f2d8b2435c0b4667e0dc24a3 100644 (file)
@@ -3,8 +3,7 @@
 
 #include <set>
 #include <string>
-
-#include <boost/utility/string_ref.hpp>
+#include <string_view>
 
 #include "rgw_frontend.h"
 #include "rgw_client_io_filters.h"
@@ -122,7 +121,7 @@ int RGWCivetWebFrontend::run()
   }
 
   /* Prepare options for CivetWeb. */
-  const std::set<boost::string_ref> rgw_opts = { "port", "prefix" };
+  const std::set<std::string_view> rgw_opts = { "port", "prefix" };
 
   std::vector<const char*> options;
 
index 3331bacddbbc0e993d7d80368331078f8e30541c..df0ccd831cc83dffdb782afb6a6daf6fc49bf04c 100644 (file)
@@ -6,13 +6,12 @@
 
 #include <exception>
 #include <string>
+#include <string_view>
 #include <streambuf>
 #include <istream>
 #include <stdlib.h>
 #include <system_error>
 
-#include <boost/utility/string_ref.hpp>
-
 #include "include/types.h"
 #include "rgw_common.h"
 
@@ -103,9 +102,9 @@ public:
   /* Generate header. On success returns number of bytes generated for a direct
    * client of RadosGW. On failure throws rgw::io::Exception containing errno.
    *
-   * boost::string_ref is being used because of length it internally carries. */
-  virtual size_t send_header(const boost::string_ref& name,
-                             const boost::string_ref& value) = 0;
+   * std::string_view is being used because of length it internally carries. */
+  virtual size_t send_header(const std::string_view& name,
+                             const std::string_view& value) = 0;
 
   /* Inform a client about a content length. Takes number of bytes as @len.
    * On success returns number of bytes generated for a direct client of RadosGW.
@@ -215,8 +214,8 @@ public:
     return get_decoratee().send_100_continue();
   }
 
-  size_t send_header(const boost::string_ref& name,
-                     const boost::string_ref& value) override {
+  size_t send_header(const std::string_view& name,
+                     const std::string_view& value) override {
     return get_decoratee().send_header(name, value);
   }
 
index bf6034ce863eab34f6e894719076ba630125fb28..538d7f16723d64581c1e9618d161912bab5a05d1 100644 (file)
@@ -55,8 +55,8 @@ public:
     return sent;
   }
 
-  size_t send_header(const boost::string_ref& name,
-                     const boost::string_ref& value) override {
+  size_t send_header(const std::string_view& name,
+                     const std::string_view& value) override {
     const auto sent = DecoratedRestfulClient<T>::send_header(name, value);
     lsubdout(cct, rgw, 30) << "AccountingFilter::send_header: e="
         << (enabled ? "1" : "0") << ", sent=" << sent << ", total="
@@ -386,8 +386,8 @@ protected:
 
   std::vector<std::pair<std::string, std::string>> headers;
 
-  size_t send_header(const boost::string_ref& name,
-                     const boost::string_ref& value) override {
+  size_t send_header(const std::string_view& name,
+                     const std::string_view& value) override {
     switch (phase) {
     case ReorderState::RGW_EARLY_HEADERS:
     case ReorderState::RGW_STATUS_SEEN:
index 2e9b751177bafa712e861d07cc899938a6ea51cd..3b368916c3e53a23909f18bb717eb6fc6872eaf6 100644 (file)
@@ -562,7 +562,7 @@ bool parse_iso8601(const char *s, struct tm *t, uint32_t *pns, bool extended_for
     dout(0) << "parse_iso8601 failed" << dendl;
     return false;
   }
-  const boost::string_view str = rgw_trim_whitespace(boost::string_view(p));
+  const std::string_view str = rgw_trim_whitespace(std::string_view(p));
   int len = str.size();
 
   if (len == 0 || (len == 1 && str[0] == 'Z'))
@@ -573,8 +573,8 @@ bool parse_iso8601(const char *s, struct tm *t, uint32_t *pns, bool extended_for
     return false;
 
   uint32_t ms;
-  boost::string_view nsstr = str.substr(1,  len - 2);
-  int r = stringtoul(nsstr.to_string(), &ms);
+  std::string_view nsstr = str.substr(1,  len - 2);
+  int r = stringtoul(std::string(nsstr), &ms);
   if (r < 0)
     return false;
 
@@ -623,12 +623,12 @@ int parse_key_value(string& in_str, string& key, string& val)
   return parse_key_value(in_str, "=", key,val);
 }
 
-boost::optional<std::pair<boost::string_view, boost::string_view>>
-parse_key_value(const boost::string_view& in_str,
-                const boost::string_view& delim)
+boost::optional<std::pair<std::string_view, std::string_view>>
+parse_key_value(const std::string_view& in_str,
+                const std::string_view& delim)
 {
   const size_t pos = in_str.find(delim);
-  if (pos == boost::string_view::npos) {
+  if (pos == std::string_view::npos) {
     return boost::none;
   }
 
@@ -638,8 +638,8 @@ parse_key_value(const boost::string_view& in_str,
   return std::make_pair(key, val);
 }
 
-boost::optional<std::pair<boost::string_view, boost::string_view>>
-parse_key_value(const boost::string_view& in_str)
+boost::optional<std::pair<std::string_view, std::string_view>>
+parse_key_value(const std::string_view& in_str)
 {
   return parse_key_value(in_str, "=");
 }
@@ -725,7 +725,7 @@ using ceph::crypto::SHA256;
 /*
  * calculate the sha256 hash value of a given msg
  */
-sha256_digest_t calc_hash_sha256(const boost::string_view& msg)
+sha256_digest_t calc_hash_sha256(const std::string_view& msg)
 {
   sha256_digest_t hash;
 
@@ -1511,7 +1511,7 @@ static char hex_to_num(char c)
   return hex_table.to_num(c);
 }
 
-std::string url_decode(const boost::string_view& src_str, bool in_query)
+std::string url_decode(const std::string_view& src_str, bool in_query)
 {
   std::string dest_str;
   dest_str.reserve(src_str.length() + 1);
@@ -1651,9 +1651,9 @@ string rgw_trim_whitespace(const string& src)
   return src.substr(start, end - start + 1);
 }
 
-boost::string_view rgw_trim_whitespace(const boost::string_view& src)
+std::string_view rgw_trim_whitespace(const std::string_view& src)
 {
-  boost::string_view res = src;
+  std::string_view res = src;
 
   while (res.size() > 0 && std::isspace(res.front())) {
     res.remove_prefix(1);
@@ -1935,7 +1935,7 @@ int rgw_parse_op_type_list(const string& str, uint32_t *perm)
   return rgw_parse_list_of_flags(op_type_mapping, str, perm);
 }
 
-bool match_policy(boost::string_view pattern, boost::string_view input,
+bool match_policy(std::string_view pattern, std::string_view input,
                   uint32_t flag)
 {
   const uint32_t flag2 = flag & (MATCH_POLICY_ACTION|MATCH_POLICY_ARN) ?
@@ -1943,8 +1943,8 @@ bool match_policy(boost::string_view pattern, boost::string_view input,
   const bool colonblocks = !(flag & (MATCH_POLICY_RESOURCE |
                                     MATCH_POLICY_STRING));
 
-  const auto npos = boost::string_view::npos;
-  boost::string_view::size_type last_pos_input = 0, last_pos_pattern = 0;
+  const auto npos = std::string_view::npos;
+  std::string_view::size_type last_pos_input = 0, last_pos_pattern = 0;
   while (true) {
     auto cur_pos_input = colonblocks ? input.find(":", last_pos_input) : npos;
     auto cur_pos_pattern =
index 56b0d1590ddf027ac1382e9107167d78f67cdd16..0986c2b8323378fca86d87c8349345d5a49f8162 100644 (file)
@@ -18,8 +18,7 @@
 #define CEPH_RGW_COMMON_H
 
 #include <array>
-
-#include <boost/utility/string_view.hpp>
+#include <string_view>
 
 #include "common/ceph_crypto.h"
 #include "common/random_string.h"
@@ -2085,11 +2084,11 @@ extern void parse_csv_string(const string& ival, vector<string>& ovals);
 extern int parse_key_value(string& in_str, string& key, string& val);
 extern int parse_key_value(string& in_str, const char *delim, string& key, string& val);
 
-extern boost::optional<std::pair<boost::string_view, boost::string_view>>
-parse_key_value(const boost::string_view& in_str,
-                const boost::string_view& delim);
-extern boost::optional<std::pair<boost::string_view, boost::string_view>>
-parse_key_value(const boost::string_view& in_str);
+extern boost::optional<std::pair<std::string_view, std::string_view>>
+parse_key_value(const std::string_view& in_str,
+                const std::string_view& delim);
+extern boost::optional<std::pair<std::string_view, std::string_view>>
+parse_key_value(const std::string_view& in_str);
 
 
 /** time parsing */
@@ -2097,7 +2096,7 @@ extern int parse_time(const char *time_str, real_time *time);
 extern bool parse_rfc2616(const char *s, struct tm *t);
 extern bool parse_iso8601(const char *s, struct tm *t, uint32_t *pns = NULL, bool extended_format = true);
 extern string rgw_trim_whitespace(const string& src);
-extern boost::string_view rgw_trim_whitespace(const boost::string_view& src);
+extern std::string_view rgw_trim_whitespace(const std::string_view& src);
 extern string rgw_trim_quotes(const string& val);
 
 extern void rgw_to_iso8601(const real_time& t, char *dest, int buf_size);
@@ -2256,7 +2255,7 @@ extern bool verify_object_permission_no_policy(const DoutPrefixProvider* dpp, st
 /** Convert an input URL into a sane object name
  * by converting %-escaped strings into characters, etc*/
 extern void rgw_uri_escape_char(char c, string& dst);
-extern std::string url_decode(const boost::string_view& src_str,
+extern std::string url_decode(const std::string_view& src_str,
                               bool in_query = false);
 extern void url_encode(const std::string& src, string& dst,
                        bool encode_slash = true);
@@ -2267,7 +2266,7 @@ extern void calc_hmac_sha1(const char *key, int key_len,
                           const char *msg, int msg_len, char *dest);
 
 static inline sha1_digest_t
-calc_hmac_sha1(const boost::string_view& key, const boost::string_view& msg) {
+calc_hmac_sha1(const std::string_view& key, const std::string_view& msg) {
   sha1_digest_t dest;
   calc_hmac_sha1(key.data(), key.size(), msg.data(), msg.size(),
                  reinterpret_cast<char*>(dest.v));
@@ -2289,7 +2288,7 @@ calc_hmac_sha256(const char *key, const int key_len,
 }
 
 static inline sha256_digest_t
-calc_hmac_sha256(const boost::string_view& key, const boost::string_view& msg) {
+calc_hmac_sha256(const std::string_view& key, const std::string_view& msg) {
   sha256_digest_t dest;
   calc_hmac_sha256(key.data(), key.size(),
                    msg.data(), msg.size(),
@@ -2299,7 +2298,7 @@ calc_hmac_sha256(const boost::string_view& key, const boost::string_view& msg) {
 
 static inline sha256_digest_t
 calc_hmac_sha256(const sha256_digest_t &key,
-                 const boost::string_view& msg) {
+                 const std::string_view& msg) {
   sha256_digest_t dest;
   calc_hmac_sha256(reinterpret_cast<const char*>(key.v), sha256_digest_t::SIZE,
                    msg.data(), msg.size(),
@@ -2309,7 +2308,7 @@ calc_hmac_sha256(const sha256_digest_t &key,
 
 static inline sha256_digest_t
 calc_hmac_sha256(const std::vector<unsigned char>& key,
-                 const boost::string_view& msg) {
+                 const std::string_view& msg) {
   sha256_digest_t dest;
   calc_hmac_sha256(reinterpret_cast<const char*>(key.data()), key.size(),
                    msg.data(), msg.size(),
@@ -2320,7 +2319,7 @@ calc_hmac_sha256(const std::vector<unsigned char>& key,
 template<size_t KeyLenN>
 static inline sha256_digest_t
 calc_hmac_sha256(const std::array<unsigned char, KeyLenN>& key,
-                 const boost::string_view& msg) {
+                 const std::string_view& msg) {
   sha256_digest_t dest;
   calc_hmac_sha256(reinterpret_cast<const char*>(key.data()), key.size(),
                    msg.data(), msg.size(),
@@ -2328,7 +2327,7 @@ calc_hmac_sha256(const std::array<unsigned char, KeyLenN>& key,
   return dest;
 }
 
-extern sha256_digest_t calc_hash_sha256(const boost::string_view& msg);
+extern sha256_digest_t calc_hash_sha256(const std::string_view& msg);
 
 extern ceph::crypto::SHA256* calc_hash_sha256_open_stream();
 extern void calc_hash_sha256_update_stream(ceph::crypto::SHA256* hash,
@@ -2344,7 +2343,7 @@ static constexpr uint32_t MATCH_POLICY_RESOURCE = 0x02;
 static constexpr uint32_t MATCH_POLICY_ARN = 0x04;
 static constexpr uint32_t MATCH_POLICY_STRING = 0x08;
 
-extern bool match_policy(boost::string_view pattern, boost::string_view input,
+extern bool match_policy(std::string_view pattern, std::string_view input,
                          uint32_t flag);
 
 extern string camelcase_dash_http_attr(const string& orig);
index 9d3e2f545573bbf18ecf1ca67d18353a4e2fecaa..176a830430e0909219e91c32f54d8147bbd7c755 100644 (file)
@@ -5,13 +5,14 @@
  * Crypto filters for Put/Post/Get operations.
  */
 
+#include <string_view>
+
 #include <rgw/rgw_op.h>
 #include <rgw/rgw_crypt.h>
 #include <auth/Crypto.h>
 #include <rgw/rgw_b64.h>
 #include <rgw/rgw_rest_s3.h>
 #include "include/ceph_assert.h"
-#include <boost/utility/string_view.hpp>
 #include "crypto/crypto_accel.h"
 #include "crypto/crypto_plugin.h"
 #include "rgw/rgw_kms.h"
@@ -579,7 +580,7 @@ std::string create_random_key_selector(CephContext * const cct) {
 
 static inline void set_attr(map<string, bufferlist>& attrs,
                             const char* key,
-                            boost::string_view value)
+                            std::string_view value)
 {
   bufferlist bl;
   bl.append(value.data(), value.size());
@@ -618,7 +619,7 @@ static const crypt_option_names crypt_options[] = {
     {"HTTP_X_AMZ_SERVER_SIDE_ENCRYPTION_AWS_KMS_KEY_ID",      "x-amz-server-side-encryption-aws-kms-key-id"},
 };
 
-static boost::string_view get_crypt_attribute(
+static std::string_view get_crypt_attribute(
     const RGWEnv* env,
     std::map<std::string,
              RGWPostObj_ObjStore::post_form_part,
@@ -632,16 +633,16 @@ static boost::string_view get_crypt_attribute(
     auto iter
       = parts->find(crypt_options[option].post_part_name);
     if (iter == parts->end())
-      return boost::string_view();
+      return std::string_view();
     bufferlist& data = iter->second.data;
-    boost::string_view str = boost::string_view(data.c_str(), data.length());
+    std::string_view str = std::string_view(data.c_str(), data.length());
     return rgw_trim_whitespace(str);
   } else {
     const char* hdr = env->get(crypt_options[option].http_header_name, nullptr);
     if (hdr != nullptr) {
-      return boost::string_view(hdr);
+      return std::string_view(hdr);
     } else {
-      return boost::string_view();
+      return std::string_view();
     }
   }
 }
@@ -658,7 +659,7 @@ int rgw_s3_prepare_encrypt(struct req_state* s,
   int res = 0;
   crypt_http_responses.clear();
   {
-    boost::string_view req_sse_ca =
+    std::string_view req_sse_ca =
         get_crypt_attribute(s->info.env, parts, X_AMZ_SERVER_SIDE_ENCRYPTION_CUSTOMER_ALGORITHM);
     if (! req_sse_ca.empty()) {
       if (req_sse_ca != "AES256") {
@@ -694,7 +695,7 @@ int rgw_s3_prepare_encrypt(struct req_state* s,
         return -EINVAL;
       }
 
-      boost::string_view keymd5 =
+      std::string_view keymd5 =
           get_crypt_attribute(s->info.env, parts, X_AMZ_SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY_MD5);
 
       std::string keymd5_bin;
@@ -737,10 +738,10 @@ int rgw_s3_prepare_encrypt(struct req_state* s,
       }
 
       crypt_http_responses["x-amz-server-side-encryption-customer-algorithm"] = "AES256";
-      crypt_http_responses["x-amz-server-side-encryption-customer-key-MD5"] = keymd5.to_string();
+      crypt_http_responses["x-amz-server-side-encryption-customer-key-MD5"] = std::string(keymd5);
       return 0;
     } else {
-      boost::string_view customer_key =
+      std::string_view customer_key =
           get_crypt_attribute(s->info.env, parts, X_AMZ_SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY);
       if (!customer_key.empty()) {
         ldout(s->cct, 5) << "ERROR: SSE-C encryption request is missing the header "
@@ -751,7 +752,7 @@ int rgw_s3_prepare_encrypt(struct req_state* s,
         return -EINVAL;
       }
 
-      boost::string_view customer_key_md5 =
+      std::string_view customer_key_md5 =
           get_crypt_attribute(s->info.env, parts, X_AMZ_SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY_MD5);
       if (!customer_key_md5.empty()) {
         ldout(s->cct, 5) << "ERROR: SSE-C encryption request is missing the header "
@@ -764,7 +765,7 @@ int rgw_s3_prepare_encrypt(struct req_state* s,
     }
 
     /* AMAZON server side encryption with KMS (key management service) */
-    boost::string_view req_sse =
+    std::string_view req_sse =
         get_crypt_attribute(s->info.env, parts, X_AMZ_SERVER_SIDE_ENCRYPTION);
     if (! req_sse.empty()) {
 
@@ -775,7 +776,7 @@ int rgw_s3_prepare_encrypt(struct req_state* s,
       }
 
       if (req_sse == "aws:kms") {
-       boost::string_view key_id =
+       std::string_view key_id =
           get_crypt_attribute(s->info.env, parts, X_AMZ_SERVER_SIDE_ENCRYPTION_AWS_KMS_KEY_ID);
        if (key_id.empty()) {
          ldout(s->cct, 5) << "ERROR: not provide a valid key id" << dendl;
@@ -789,7 +790,7 @@ int rgw_s3_prepare_encrypt(struct req_state* s,
        res = get_actual_key_from_kms(s->cct, key_id, key_selector, actual_key);
        if (res != 0) {
          ldout(s->cct, 5) << "ERROR: failed to retrieve actual key from key_id: " << key_id << dendl;
-         s->err.message = "Failed to retrieve the actual key, kms-keyid: " + key_id.to_string();
+         s->err.message = "Failed to retrieve the actual key, kms-keyid: " + std::string(key_id);
          return res;
        }
        if (actual_key.size() != AES_256_KEYSIZE) {
@@ -810,7 +811,7 @@ int rgw_s3_prepare_encrypt(struct req_state* s,
        actual_key.replace(0, actual_key.length(), actual_key.length(), '\000');
 
        crypt_http_responses["x-amz-server-side-encryption"] = "aws:kms";
-       crypt_http_responses["x-amz-server-side-encryption-aws-kms-key-id"] = key_id.to_string();
+       crypt_http_responses["x-amz-server-side-encryption-aws-kms-key-id"] = std::string(key_id);
        return 0;
       } else if (req_sse == "AES256") {
        /* if a default encryption key was provided, we will use it for SSE-S3 */
@@ -823,7 +824,7 @@ int rgw_s3_prepare_encrypt(struct req_state* s,
       }
     } else {
       /* x-amz-server-side-encryption not present or empty */
-      boost::string_view key_id =
+      std::string_view key_id =
        get_crypt_attribute(s->info.env, parts,
                            X_AMZ_SERVER_SIDE_ENCRYPTION_AWS_KMS_KEY_ID);
       if (!key_id.empty()) {
index 29726a4a4f35d00ec14194c222d53a27ce84ab13..ba23221bcad90863e75270a78d2f40827e4287be 100644 (file)
@@ -8,11 +8,12 @@
 #ifndef CEPH_RGW_CRYPT_H
 #define CEPH_RGW_CRYPT_H
 
+#include <string_view>
+
 #include <rgw/rgw_op.h>
 #include <rgw/rgw_rest.h>
 #include <rgw/rgw_rest_s3.h>
 #include "rgw_putobj.h"
-#include <boost/utility/string_view.hpp>
 
 /**
  * \brief Interface for block encryption methods
index 64d37186c9c57f81797b228a8db8f09efce745a3..662a7977d31275019931708f464f9e3c002059b9 100644 (file)
@@ -4,8 +4,7 @@
 #ifndef RGW_RGW_CRYPT_SANITIZE_H_
 #define RGW_RGW_CRYPT_SANITIZE_H_
 
-#include <boost/utility/string_view.hpp>
-
+#include <string_view>
 #include "rgw_common.h"
 
 namespace rgw {
@@ -15,10 +14,10 @@ namespace crypt_sanitize {
  * Temporary container for suppressing printing if variable contains secret key.
  */
 struct env {
-  boost::string_ref name;
-  boost::string_ref value;
+  std::string_view name;
+  std::string_view value;
 
-  env(boost::string_ref name, boost::string_ref value)
+  env(std::string_view name, std::string_view value)
   : name(name), value(value) {}
 };
 
@@ -26,9 +25,9 @@ struct env {
  * Temporary container for suppressing printing if aws meta attributes contains secret key.
  */
 struct x_meta_map {
-  boost::string_ref name;
-  boost::string_ref value;
-  x_meta_map(boost::string_ref name, boost::string_ref value)
+  std::string_view name;
+  std::string_view value;
+  x_meta_map(std::string_view name, std::string_view value)
   : name(name), value(value) {}
 };
 
@@ -36,9 +35,9 @@ struct x_meta_map {
  * Temporary container for suppressing printing if s3_policy calculation variable contains secret key.
  */
 struct s3_policy {
-  boost::string_ref name;
-  boost::string_ref value;
-  s3_policy(boost::string_ref name, boost::string_ref value)
+  std::string_view name;
+  std::string_view value;
+  s3_policy(std::string_view name, std::string_view value)
   : name(name), value(value) {}
 };
 
@@ -47,8 +46,8 @@ struct s3_policy {
  */
 struct auth {
   const req_state* const s;
-  boost::string_ref value;
-  auth(const req_state* const s, boost::string_ref value)
+  std::string_view value;
+  auth(const req_state* const s, std::string_view value)
   : s(s), value(value) {}
 };
 
@@ -56,8 +55,8 @@ struct auth {
  * Temporary container for suppressing printing if log made from civetweb may contain secret key.
  */
 struct log_content {
-  const boost::string_view buf;
-  explicit log_content(const boost::string_view buf)
+  const std::string_view buf;
+  explicit log_content(const std::string_view buf)
   : buf(buf) {}
 };
 
index 4090512b2d0695ec7424649d0d3c9cf0c6f6124a..deaf913559e5a5f2e5e8cb97e8c1e7964c85e61d 100644 (file)
@@ -1,8 +1,6 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
 // vim: ts=8 sw=2 smarttab ft=cpp
 
-#include <boost/utility/string_ref.hpp>
-
 #include "common/ceph_json.h"
 #include "common/RWLock.h"
 #include "common/RefCountedObj.h"
@@ -39,6 +37,7 @@
 #include "include/random.h"
 
 #include <boost/asio/yield.hpp>
+#include <string_view>
 
 #define dout_subsys ceph_subsys_rgw
 
index 8396b10967e28d40f8cb5ad4411e719a85a8af80..2a0e9f91798e114995a09330e8342bfbdc1886d7 100644 (file)
@@ -54,8 +54,8 @@ size_t RGWFCGX::send_100_continue()
   return sent;
 }
 
-size_t RGWFCGX::send_header(const boost::string_ref& name,
-                            const boost::string_ref& value)
+size_t RGWFCGX::send_header(const std::string_view& name,
+                            const std::string_view& value)
 {
   static constexpr char HEADER_SEP[] = ": ";
   static constexpr char HEADER_END[] = "\r\n";
index f332ae8ae4744940c44c673de89f3607c28113cb..552bebc8c4c908c31cd3cea1e6b66e8f04936831 100644 (file)
@@ -30,8 +30,8 @@ public:
   int init_env(CephContext* cct) override;
   size_t send_status(int status, const char* status_name) override;
   size_t send_100_continue() override;
-  size_t send_header(const boost::string_ref& name,
-                     const boost::string_ref& value) override;
+  size_t send_header(const std::string_view& name,
+                     const std::string_view& value) override;
   size_t send_content_length(uint64_t len) override;
   size_t complete_header() override;
 
index 8132b24ac22a0da88d0dbb5dfdc07418de96ebee..b7aa9796dd67e4c9062dc5b22ca4c8e94ca8da0e 100644 (file)
@@ -8,6 +8,7 @@
 
 /* internal header */
 #include <string.h>
+#include <string_view>
 #include <sys/stat.h>
 #include <stdint.h>
 
@@ -23,7 +24,6 @@
 #include <boost/range/adaptor/reversed.hpp>
 #include <boost/container/flat_map.hpp>
 #include <boost/variant.hpp>
-#include <boost/utility/string_ref.hpp>
 #include <boost/optional.hpp>
 #include "xxhash.h"
 #include "include/buffer.h"
@@ -1387,7 +1387,7 @@ public:
       return;
     map<string, rgw::sal::RGWBucket*>& m = buckets.get_buckets();
     for (const auto& iter : m) {
-      boost::string_ref marker{iter.first};
+      std::string_view marker{iter.first};
       rgw::sal::RGWBucket* ent = iter.second;
       if (! this->operator()(ent->get_name(), marker)) {
        /* caller cannot accept more */
@@ -1406,8 +1406,8 @@ public:
     // do nothing
   }
 
-  int operator()(const boost::string_ref& name,
-                const boost::string_ref& marker) {
+  int operator()(const std::string_view& name,
+                const std::string_view& marker) {
     uint64_t off = XXH64(name.data(), name.length(), fh_key::seed);
     if (!! ioff) {
       *ioff = off;
@@ -1519,7 +1519,7 @@ public:
     return 0;
   }
 
-  int operator()(const boost::string_ref name, const rgw_obj_key& marker,
+  int operator()(const std::string_view name, const rgw_obj_key& marker,
                 const ceph::real_time& t, const uint64_t fsz, uint8_t type) {
 
     assert(name.length() > 0); // all cases handled in callers
@@ -1562,7 +1562,7 @@ public:
     struct req_state* s = get_state();
     for (const auto& iter : objs) {
 
-      boost::string_ref sref {iter.key.name};
+      std::string_view sref {iter.key.name};
 
       lsubdout(cct, rgw, 15) << "readdir objects prefix: " << prefix
                             << " obj: " << sref << dendl;
@@ -1617,7 +1617,7 @@ public:
       if (iter.first.back() == '/')
        const_cast<std::string&>(iter.first).pop_back();
 
-      boost::string_ref sref{iter.first};
+      std::string_view sref{iter.first};
 
       size_t last_del = sref.find_last_of('/');
       if (last_del != string::npos)
index 0d3d7a427759e66b9cbaa3f98d944f415c69f517..83169a7a0e4812f2de39c3de42d83b715e7451e3 100644 (file)
@@ -4,7 +4,6 @@
 #include "include/compat.h"
 #include "common/errno.h"
 
-#include <boost/utility/string_ref.hpp>
 
 #include <curl/curl.h>
 #include <curl/easy.h>
@@ -20,6 +19,7 @@
 #include "rgw_tools.h"
 
 #include <atomic>
+#include <string_view>
 
 #define dout_context g_ceph_context
 #define dout_subsys ceph_subsys_rgw
@@ -606,12 +606,12 @@ RGWHTTPClient::~RGWHTTPClient()
 
 int RGWHTTPHeadersCollector::receive_header(void * const ptr, const size_t len)
 {
-  const boost::string_ref header_line(static_cast<const char *>(ptr), len);
+  const std::string_view header_line(static_cast<const char *>(ptr), len);
 
   /* We're tokening the line that way due to backward compatibility. */
   const size_t sep_loc = header_line.find_first_of(" \t:");
 
-  if (boost::string_ref::npos == sep_loc) {
+  if (std::string_view::npos == sep_loc) {
     /* Wrongly formatted header? Just skip it. */
     return 0;
   }
@@ -628,8 +628,8 @@ int RGWHTTPHeadersCollector::receive_header(void * const ptr, const size_t len)
   const size_t val_loc_s = value_part.find_first_not_of(' ');
   const size_t val_loc_e = value_part.find_first_of("\r\n");
 
-  if (boost::string_ref::npos == val_loc_s ||
-      boost::string_ref::npos == val_loc_e) {
+  if (std::string_view::npos == val_loc_s ||
+      std::string_view::npos == val_loc_e) {
     /* Empty value case. */
     found_headers.emplace(name, header_value_t());
   } else {
index 60d8ba68e529321b03f6e5682c00a0cec7199385..3dfcc187587c886f9c2518631acca1d3224d2a3f 100644 (file)
@@ -382,7 +382,7 @@ bool ParseState::key(const char* s, size_t l) {
   bool ifexists = false;
   if (w->id == TokenID::Condition && w->kind == TokenKind::statement) {
     static constexpr char IfExists[] = "IfExists";
-    if (boost::algorithm::ends_with(boost::string_view{s, l}, IfExists)) {
+    if (boost::algorithm::ends_with(std::string_view{s, l}, IfExists)) {
       ifexists = true;
       token_len -= sizeof(IfExists)-1;
     }
index 106af5b60cf807bed1f5caae7e99b4a96316057f..4f2c144f29f4b362fa80208787910338b448022c 100644 (file)
@@ -9,13 +9,13 @@
 #include <cstdint>
 #include <iostream>
 #include <string>
+#include <string_view>
 
 #include <boost/algorithm/string/predicate.hpp>
 #include <boost/container/flat_map.hpp>
 #include <boost/container/flat_set.hpp>
 #include <boost/optional.hpp>
 #include <boost/thread/shared_mutex.hpp>
-#include <boost/utility/string_ref.hpp>
 #include <boost/variant.hpp>
 
 #include "common/ceph_time.h"
@@ -312,7 +312,7 @@ struct Condition {
                                  * 1000000000)));
       }
 
-      return from_iso_8601(boost::string_ref(s), false);
+      return from_iso_8601(std::string_view(s), false);
     } catch (const std::logic_error& e) {
       return boost::none;
     }
index d95f7e8fd37bf95ce74efcbe0c5bbfbfaf76a3b5..035adf9b0e17803f941fc2ad70549a9937af450c 100644 (file)
@@ -1823,7 +1823,7 @@ void rgw_bucket_shard_sync_info::dump(Formatter *f) const
  * provided by string_ref since Boost 1.54 as it's defined outside of the std
  * namespace. I hope we'll remove it soon - just after merging the Matt's PR
  * for bundled Boost. It would allow us to forget that CentOS 7 has Boost 1.53. */
-static inline std::string to_string(const boost::string_ref& s)
+static inline std::string to_string(const std::string_view& s)
 {
   return std::string(s.data(), s.length());
 }
index af0396bc6582dea999af014f56d999bbeefeb93f..574cae19cd3b36945251951d504fcd8164633c3b 100644 (file)
@@ -5,9 +5,9 @@
 #define CEPH_RGW_KEYSTONE_H
 
 #include <type_traits>
+#include <string_view>
 
 #include <boost/optional.hpp>
-#include <boost/utility/string_ref.hpp>
 
 #include "rgw_common.h"
 #include "rgw_http_client.h"
@@ -45,11 +45,11 @@ public:
   virtual ApiVersion get_api_version() const noexcept = 0;
 
   virtual std::string get_admin_token() const noexcept = 0;
-  virtual boost::string_ref get_admin_user() const noexcept = 0;
+  virtual std::string_view get_admin_user() const noexcept = 0;
   virtual std::string get_admin_password() const noexcept = 0;
-  virtual boost::string_ref get_admin_tenant() const noexcept = 0;
-  virtual boost::string_ref get_admin_project() const noexcept = 0;
-  virtual boost::string_ref get_admin_domain() const noexcept = 0;
+  virtual std::string_view get_admin_tenant() const noexcept = 0;
+  virtual std::string_view get_admin_project() const noexcept = 0;
+  virtual std::string_view get_admin_domain() const noexcept = 0;
 };
 
 class CephCtxConfig : public Config {
@@ -70,21 +70,21 @@ public:
 
   std::string get_admin_token() const noexcept override;
 
-  boost::string_ref get_admin_user() const noexcept override {
+  std::string_view get_admin_user() const noexcept override {
     return g_ceph_context->_conf->rgw_keystone_admin_user;
   }
 
   std::string get_admin_password() const noexcept override;
 
-  boost::string_ref get_admin_tenant() const noexcept override {
+  std::string_view get_admin_tenant() const noexcept override {
     return g_ceph_context->_conf->rgw_keystone_admin_tenant;
   }
 
-  boost::string_ref get_admin_project() const noexcept override {
+  std::string_view get_admin_project() const noexcept override {
     return g_ceph_context->_conf->rgw_keystone_admin_project;
   }
 
-  boost::string_ref get_admin_domain() const noexcept override {
+  std::string_view get_admin_domain() const noexcept override {
     return g_ceph_context->_conf->rgw_keystone_admin_domain;
   }
 };
index dd6ba062d08dda7a4f82d80bfff2381cc96282fb..dfd2b58f7a084da38e850e520c022d17d72162a8 100644 (file)
@@ -85,7 +85,7 @@ protected:
     return res;
   }
 
-  int send_request(boost::string_view key_id, JSONParser* parser) override
+  int send_request(std::string_view key_id, JSONParser* parser) override
   {
     bufferlist secret_bl;
     int res;
@@ -173,14 +173,14 @@ public:
 class TransitSecretEngine: public VaultSecretEngine {
 
 private:
-  int get_key_version(boost::string_view key_id, string& version)
+  int get_key_version(std::string_view key_id, string& version)
   {
     size_t pos = 0;
 
     pos = key_id.rfind("/");
-    if (pos != boost::string_view::npos){
-      boost::string_view token = key_id.substr(pos+1, key_id.length()-pos);
-      if (!token.empty() && token.find_first_not_of("0123456789") == boost::string_view::npos){
+    if (pos != std::string_view::npos){
+      std::string_view token = key_id.substr(pos+1, key_id.length()-pos);
+      if (!token.empty() && token.find_first_not_of("0123456789") == std::string_view::npos){
         version.assign(std::string(token));
         return 0;
       }
@@ -191,7 +191,7 @@ private:
 public:
   TransitSecretEngine(CephContext *cct): VaultSecretEngine(cct){ }
 
-  int get_key(boost::string_view key_id, std::string& actual_key)
+  int get_key(std::string_view key_id, std::string& actual_key)
   {
     JSONParser parser;
     string version;
@@ -229,7 +229,7 @@ public:
 
   virtual ~KvSecretEngine(){}
 
-  int get_key(boost::string_view key_id, std::string& actual_key){
+  int get_key(std::string_view key_id, std::string& actual_key){
     JSONParser parser;
     int res = send_request(key_id, &parser);
     if (res < 0) {
@@ -259,8 +259,8 @@ static map<string,string> get_str_map(const string &str) {
 
 
 static int get_actual_key_from_conf(CephContext *cct,
-                                    boost::string_view key_id,
-                                    boost::string_view key_selector,
+                                    std::string_view key_id,
+                                    std::string_view key_selector,
                                     std::string& actual_key)
 {
   int res = 0;
@@ -302,7 +302,7 @@ static int get_actual_key_from_conf(CephContext *cct,
 }
 
 static int request_key_from_barbican(CephContext *cct,
-                                     boost::string_view key_id,
+                                     std::string_view key_id,
                                      const std::string& barbican_token,
                                      std::string& actual_key) {
   int res;
@@ -341,7 +341,7 @@ static int request_key_from_barbican(CephContext *cct,
 }
 
 static int get_actual_key_from_barbican(CephContext *cct,
-                                        boost::string_view key_id,
+                                        std::string_view key_id,
                                         std::string& actual_key)
 {
   int res = 0;
@@ -361,7 +361,7 @@ static int get_actual_key_from_barbican(CephContext *cct,
 
 
 static int get_actual_key_from_vault(CephContext *cct,
-                                     boost::string_view key_id,
+                                     std::string_view key_id,
                                      std::string& actual_key)
 {
   std::string secret_engine = cct->_conf->rgw_crypt_vault_secret_engine;
@@ -384,8 +384,8 @@ static int get_actual_key_from_vault(CephContext *cct,
 
 
 int get_actual_key_from_kms(CephContext *cct,
-                            boost::string_view key_id,
-                            boost::string_view key_selector,
+                            std::string_view key_id,
+                            std::string_view key_selector,
                             std::string& actual_key)
 {
   std::string kms_backend;
index bffebab8e69a75e57b9109ebda6e052c01b690f7..92e85aefe0936a649f369c4c198dc6431a36fee4 100644 (file)
@@ -29,8 +29,8 @@ static const std::string RGW_SSE_KMS_VAULT_SE_KV = "kv";
  * \return
  */
 int get_actual_key_from_kms(CephContext *cct,
-                            boost::string_view key_id,
-                            boost::string_view key_selector,
+                            std::string_view key_id,
+                            std::string_view key_selector,
                             std::string& actual_key);
 
 /**
@@ -41,10 +41,10 @@ int get_actual_key_from_kms(CephContext *cct,
 class SecretEngine {
 
 public:
-  virtual int get_key(boost::string_view key_id, std::string& actual_key) = 0;
+  virtual int get_key(std::string_view key_id, std::string& actual_key) = 0;
   virtual ~SecretEngine(){};
 protected:
-  virtual int send_request(boost::string_view key_id, JSONParser* parser) = 0;
+  virtual int send_request(std::string_view key_id, JSONParser* parser) = 0;
   virtual int decode_secret(JSONObj* json_obj, std::string& actual_key) = 0;
 };
 #endif
index a8e6fd7b2bf6550583b73152c7ced0eda1c3649b..e8de0f4498eb3cc8583e91fff912a796d1053bac 100644 (file)
@@ -111,8 +111,8 @@ size_t RGWLoadGenIO::send_100_continue()
   return 0;
 }
 
-size_t RGWLoadGenIO::send_header(const boost::string_ref& name,
-                                 const boost::string_ref& value)
+size_t RGWLoadGenIO::send_header(const std::string_view& name,
+                                 const std::string_view& value)
 {
   return 0;
 }
index 3b115012dc026856afd0ec813fee7b6f106d8323..44f434f487829e1b1050de8a48691cf1782fe6fa 100644 (file)
@@ -50,8 +50,8 @@ public:
 
   size_t send_status(int status, const char *status_name) override;
   size_t send_100_continue() override;
-  size_t send_header(const boost::string_ref& name,
-                     const boost::string_ref& value) override;
+  size_t send_header(const std::string_view& name,
+                     const std::string_view& value) override;
   size_t complete_header() override;
   size_t send_content_length(uint64_t len) override;
 
index 08a610d2550bff90474aeee72441993d54876119..b2b13af6197f01a8ebf3a4527d85134fe1f49a9e 100644 (file)
@@ -7,12 +7,12 @@
 #include <unistd.h>
 
 #include <sstream>
+#include <string_view>
 
 #include <boost/algorithm/string/predicate.hpp>
 #include <boost/bind.hpp>
 #include <boost/optional.hpp>
 #include <boost/utility/in_place_factory.hpp>
-#include <boost/utility/string_view.hpp>
 
 #include "include/scope_guard.h"
 #include "common/Clock.h"
@@ -1889,7 +1889,7 @@ static int get_obj_user_manifest_iterate_cb(rgw_bucket& bucket,
 
 int RGWGetObj::handle_user_manifest(const char *prefix)
 {
-  const boost::string_view prefix_view(prefix);
+  const std::string_view prefix_view(prefix);
   ldpp_dout(this, 2) << "RGWGetObj::handle_user_manifest() prefix="
                    << prefix_view << dendl;
 
@@ -4750,7 +4750,7 @@ int RGWDeleteObj::handle_slo_manifest(bufferlist& bl)
     const string& path_str = iter.path;
 
     const size_t sep_pos = path_str.find('/', 1 /* skip first slash */);
-    if (boost::string_view::npos == sep_pos) {
+    if (std::string_view::npos == sep_pos) {
       return -EINVAL;
     }
 
@@ -5002,12 +5002,12 @@ void RGWDeleteObj::execute()
   }
 }
 
-bool RGWCopyObj::parse_copy_location(const boost::string_view& url_src,
+bool RGWCopyObj::parse_copy_location(const std::string_view& url_src,
                                     string& bucket_name,
                                     rgw_obj_key& key)
 {
-  boost::string_view name_str;
-  boost::string_view params_str;
+  std::string_view name_str;
+  std::string_view params_str;
 
   // search for ? before url-decoding so we don't accidentally match %3F
   size_t pos = url_src.find('?');
@@ -5018,7 +5018,7 @@ bool RGWCopyObj::parse_copy_location(const boost::string_view& url_src,
     params_str = url_src.substr(pos + 1);
   }
 
-  boost::string_view dec_src{name_str};
+  std::string_view dec_src{name_str};
   if (dec_src[0] == '/')
     dec_src.remove_prefix(1);
 
@@ -5035,7 +5035,7 @@ bool RGWCopyObj::parse_copy_location(const boost::string_view& url_src,
 
   if (! params_str.empty()) {
     RGWHTTPArgs args;
-    args.set(params_str.to_string());
+    args.set(std::string(params_str));
     args.parse();
 
     key.instance = args.get("versionId", NULL);
@@ -5608,7 +5608,7 @@ void RGWPutLC::execute()
 
   std::string content_md5_bin;
   try {
-    content_md5_bin = rgw::from_base64(boost::string_view(content_md5));
+    content_md5_bin = rgw::from_base64(std::string_view(content_md5));
   } catch (...) {
     s->err.message = "Request header Content-MD5 contains character "
                      "that is not base64 encoded.";
@@ -6900,26 +6900,26 @@ void RGWBulkUploadOp::pre_exec()
 }
 
 boost::optional<std::pair<std::string, rgw_obj_key>>
-RGWBulkUploadOp::parse_path(const boost::string_ref& path)
+RGWBulkUploadOp::parse_path(const std::string_view& path)
 {
   /* We need to skip all slashes at the beginning in order to preserve
    * compliance with Swift. */
   const size_t start_pos = path.find_first_not_of('/');
 
-  if (boost::string_ref::npos != start_pos) {
+  if (std::string_view::npos != start_pos) {
     /* Seperator is the first slash after the leading ones. */
     const size_t sep_pos = path.substr(start_pos).find('/');
 
-    if (boost::string_ref::npos != sep_pos) {
+    if (std::string_view::npos != sep_pos) {
       const auto bucket_name = path.substr(start_pos, sep_pos - start_pos);
       const auto obj_name = path.substr(sep_pos + 1);
 
-      return std::make_pair(bucket_name.to_string(),
-                            rgw_obj_key(obj_name.to_string()));
+      return std::make_pair(std::string(bucket_name),
+                            rgw_obj_key(std::string(obj_name)));
     } else {
       /* It's guaranteed here that bucket name is at least one character
        * long and is different than slash. */
-      return std::make_pair(path.substr(start_pos).to_string(),
+      return std::make_pair(std::string(path.substr(start_pos)),
                             rgw_obj_key());
     }
   }
@@ -6990,7 +6990,7 @@ void RGWBulkUploadOp::init(rgw::sal::RGWRadosStore* const store,
   dir_ctx.emplace(store->svc()->sysobj->init_obj_ctx());
 }
 
-int RGWBulkUploadOp::handle_dir(const boost::string_ref path)
+int RGWBulkUploadOp::handle_dir(const std::string_view path)
 {
   ldpp_dout(this, 20) << "got directory=" << path << dendl;
 
@@ -7184,7 +7184,7 @@ bool RGWBulkUploadOp::handle_file_verify_permission(RGWBucketInfo& binfo,
                                            &bacl, RGW_PERM_WRITE);
 }
 
-int RGWBulkUploadOp::handle_file(const boost::string_ref path,
+int RGWBulkUploadOp::handle_file(const std::string_view path,
                                  const size_t size,
                                  AlignedStreamGetter& body)
 {
@@ -7394,8 +7394,8 @@ void RGWBulkUploadOp::execute()
         case rgw::tar::FileType::NORMAL_FILE: {
           ldpp_dout(this, 2) << "handling regular file" << dendl;
 
-          boost::string_ref filename = bucket_path.empty() ? header->get_filename() : \
-                            file_prefix + header->get_filename().to_string();
+          std::string_view filename = bucket_path.empty() ? header->get_filename() : \
+                            file_prefix + std::string(header->get_filename());
           auto body = AlignedStreamGetter(0, header->get_filesize(),
                                           rgw::tar::BLOCK_SIZE, *stream);
           op_ret = handle_file(filename,
@@ -7405,17 +7405,17 @@ void RGWBulkUploadOp::execute()
             /* Only regular files counts. */
             num_created++;
           } else {
-            failures.emplace_back(op_ret, filename.to_string());
+            failures.emplace_back(op_ret, std::string(filename));
           }
           break;
         }
         case rgw::tar::FileType::DIRECTORY: {
           ldpp_dout(this, 2) << "handling regular directory" << dendl;
 
-          boost::string_ref dirname = bucket_path.empty() ? header->get_filename() : bucket_path;
+          std::string_view dirname = bucket_path.empty() ? header->get_filename() : bucket_path;
           op_ret = handle_dir(dirname);
           if (op_ret < 0 && op_ret != -ERR_BUCKET_EXISTS) {
-            failures.emplace_back(op_ret, dirname.to_string());
+            failures.emplace_back(op_ret, std::string(dirname));
           }
           break;
         }
index dc554a37b714b00583b51773c796cb28e3620699..124d547888831afb5ce9eb335bf6e6e508b2a6e8 100644 (file)
@@ -620,7 +620,7 @@ protected:
   virtual void send_response() override = 0;
 
   boost::optional<std::pair<std::string, rgw_obj_key>>
-  parse_path(const boost::string_ref& path);
+  parse_path(const std::string_view& path);
   
   std::pair<std::string, std::string>
   handle_upload_path(struct req_state *s);
@@ -629,12 +629,12 @@ protected:
                                     const rgw_obj& obj,
                                     std::map<std::string, ceph::bufferlist>& battrs,
                                      ACLOwner& bucket_owner /* out */);
-  int handle_file(boost::string_ref path,
+  int handle_file(std::string_view path,
                   size_t size,
                   AlignedStreamGetter& body);
 
   int handle_dir_verify_permission();
-  int handle_dir(boost::string_ref path);
+  int handle_dir(std::string_view path);
 
 public:
   RGWBulkUploadOp()
@@ -1476,7 +1476,7 @@ public:
     copy_if_newer = false;
   }
 
-  static bool parse_copy_location(const boost::string_view& src,
+  static bool parse_copy_location(const std::string_view& src,
                                   string& bucket_name,
                                   rgw_obj_key& object);
 
index 04571049107514081da70c52bee1d7adc8b46b93..76dbf3c2ca74efa8cf20159352724f6998e6aa58 100644 (file)
@@ -330,8 +330,8 @@ void dump_errno(struct req_state *s, int http_ret)
 }
 
 void dump_header(struct req_state* const s,
-                 const boost::string_ref& name,
-                 const boost::string_ref& val)
+                 const std::string_view& name,
+                 const std::string_view& val)
 {
   try {
     RESTFUL_IO(s)->send_header(name, val);
@@ -342,24 +342,24 @@ void dump_header(struct req_state* const s,
 }
 
 void dump_header(struct req_state* const s,
-                 const boost::string_ref& name,
+                 const std::string_view& name,
                  ceph::buffer::list& bl)
 {
   return dump_header(s, name, rgw_sanitized_hdrval(bl));
 }
 
 void dump_header(struct req_state* const s,
-                 const boost::string_ref& name,
+                 const std::string_view& name,
                  const long long val)
 {
   char buf[32];
   const auto len = snprintf(buf, sizeof(buf), "%lld", val);
 
-  return dump_header(s, name, boost::string_ref(buf, len));
+  return dump_header(s, name, std::string_view(buf, len));
 }
 
 void dump_header(struct req_state* const s,
-                 const boost::string_ref& name,
+                 const std::string_view& name,
                  const utime_t& ut)
 {
   char buf[32];
@@ -367,7 +367,7 @@ void dump_header(struct req_state* const s,
                            static_cast<long long>(ut.sec()),
                             static_cast<int>(ut.usec() / 10));
 
-  return dump_header(s, name, boost::string_ref(buf, len));
+  return dump_header(s, name, std::string_view(buf, len));
 }
 
 void dump_content_length(struct req_state* const s, const uint64_t len)
@@ -392,7 +392,7 @@ static void dump_chunked_encoding(struct req_state* const s)
 }
 
 void dump_etag(struct req_state* const s,
-               const boost::string_ref& etag,
+               const std::string_view& etag,
                const bool quoted)
 {
   if (etag.empty()) {
@@ -448,7 +448,7 @@ void dump_time_header(struct req_state *s, const char *name, real_time t)
     return;
   }
 
-  return dump_header(s, name, boost::string_ref(timestr, len));
+  return dump_header(s, name, std::string_view(timestr, len));
 }
 
 std::string dump_time_to_str(const real_time& t)
@@ -473,7 +473,7 @@ void dump_epoch_header(struct req_state *s, const char *name, real_time t)
                             (long long)ut.sec(),
                             (long long)ut.nsec());
 
-  return dump_header(s, name, boost::string_ref(buf, len));
+  return dump_header(s, name, std::string_view(buf, len));
 }
 
 void dump_time(struct req_state *s, const char *name, real_time *t)
@@ -748,7 +748,7 @@ void dump_range(struct req_state* const s,
                    static_cast<long long>(total));
   }
 
-  return dump_header(s, "Content-Range", boost::string_ref(range_buf, len));
+  return dump_header(s, "Content-Range", std::string_view(range_buf, len));
 }
 
 
index ce9498453125f0604dd4d5a9243d0ec1a1b839c0..928f8bd822650a92058b778611f0f0fd5f98392d 100644 (file)
@@ -5,7 +5,7 @@
 
 #define TIME_BUF_SIZE 128
 
-#include <boost/utility/string_ref.hpp>
+#include <string_view>
 #include <boost/container/flat_set.hpp>
 #include "common/sstring.hh"
 #include "common/ceph_json.h"
@@ -28,9 +28,9 @@ std::tuple<int, bufferlist > rgw_rest_read_all_input(struct req_state *s,
                                         const uint64_t max_len,
                                         const bool allow_chunked=true);
 
-static inline boost::string_ref rgw_sanitized_hdrval(ceph::buffer::list& raw)
+static inline std::string_view rgw_sanitized_hdrval(ceph::buffer::list& raw)
 {
-  /* std::string and thus boost::string_ref ARE OBLIGED to carry multiple
+  /* std::string and thus std::string_view ARE OBLIGED to carry multiple
    * 0x00 and count them to the length of a string. We need to take that
    * into consideration and sanitize the size of a ceph::buffer::list used
    * to store metadata values (x-amz-meta-*, X-Container-Meta-*, etags).
@@ -45,7 +45,7 @@ static inline boost::string_ref rgw_sanitized_hdrval(ceph::buffer::list& raw)
     len--;
   }
 
-  return boost::string_ref(data, len);
+  return std::string_view(data, len);
 }
 
 template <class T>
@@ -729,22 +729,22 @@ extern void list_all_buckets_start(struct req_state *s);
 extern void dump_owner(struct req_state *s, const rgw_user& id, string& name,
                       const char *section = NULL);
 extern void dump_header(struct req_state* s,
-                        const boost::string_ref& name,
-                        const boost::string_ref& val);
+                        const std::string_view& name,
+                        const std::string_view& val);
 extern void dump_header(struct req_state* s,
-                        const boost::string_ref& name,
+                        const std::string_view& name,
                         ceph::buffer::list& bl);
 extern void dump_header(struct req_state* s,
-                        const boost::string_ref& name,
+                        const std::string_view& name,
                         long long val);
 extern void dump_header(struct req_state* s,
-                        const boost::string_ref& name,
+                        const std::string_view& name,
                         const utime_t& val);
 
 template <class... Args>
 static inline void dump_header_prefixed(struct req_state* s,
-                                        const boost::string_ref& name_prefix,
-                                        const boost::string_ref& name,
+                                        const std::string_view& name_prefix,
+                                        const std::string_view& name,
                                         Args&&... args) {
   char full_name_buf[name_prefix.size() + name.size() + 1];
   const auto len = snprintf(full_name_buf, sizeof(full_name_buf), "%.*s%.*s",
@@ -752,15 +752,15 @@ static inline void dump_header_prefixed(struct req_state* s,
                             name_prefix.data(),
                             static_cast<int>(name.length()),
                             name.data());
-  boost::string_ref full_name(full_name_buf, len);
+  std::string_view full_name(full_name_buf, len);
   return dump_header(s, std::move(full_name), std::forward<Args>(args)...);
 }
 
 template <class... Args>
 static inline void dump_header_infixed(struct req_state* s,
-                                       const boost::string_ref& prefix,
-                                       const boost::string_ref& infix,
-                                       const boost::string_ref& sufix,
+                                       const std::string_view& prefix,
+                                       const std::string_view& infix,
+                                       const std::string_view& sufix,
                                        Args&&... args) {
   char full_name_buf[prefix.size() + infix.size() + sufix.size() + 1];
   const auto len = snprintf(full_name_buf, sizeof(full_name_buf), "%.*s%.*s%.*s",
@@ -770,24 +770,24 @@ static inline void dump_header_infixed(struct req_state* s,
                             infix.data(),
                             static_cast<int>(sufix.length()),
                             sufix.data());
-  boost::string_ref full_name(full_name_buf, len);
+  std::string_view full_name(full_name_buf, len);
   return dump_header(s, std::move(full_name), std::forward<Args>(args)...);
 }
 
 template <class... Args>
 static inline void dump_header_quoted(struct req_state* s,
-                                      const boost::string_ref& name,
-                                      const boost::string_ref& val) {
+                                      const std::string_view& name,
+                                      const std::string_view& val) {
   /* We need two extra bytes for quotes. */
   char qvalbuf[val.size() + 2 + 1];
   const auto len = snprintf(qvalbuf, sizeof(qvalbuf), "\"%.*s\"",
                             static_cast<int>(val.length()), val.data());
-  return dump_header(s, name, boost::string_ref(qvalbuf, len));
+  return dump_header(s, name, std::string_view(qvalbuf, len));
 }
 
 template <class ValueT>
 static inline void dump_header_if_nonempty(struct req_state* s,
-                                           const boost::string_ref& name,
+                                           const std::string_view& name,
                                            const ValueT& value) {
   if (name.length() > 0 && value.length() > 0) {
     return dump_header(s, name, value);
@@ -813,7 +813,7 @@ static inline std::string compute_domain_uri(const struct req_state *s) {
 extern void dump_content_length(struct req_state *s, uint64_t len);
 extern int64_t parse_content_length(const char *content_length);
 extern void dump_etag(struct req_state *s,
-                      const boost::string_ref& etag,
+                      const std::string_view& etag,
                       bool quoted = false);
 extern void dump_epoch_header(struct req_state *s, const char *name, real_time t);
 extern void dump_time_header(struct req_state *s, const char *name, real_time t);
index 444102ff6018f477bba0a57ec3326598e3495507..4d896e4fffc4fa548febc92a6750109f208efdbb 100644 (file)
@@ -4,6 +4,7 @@
 #include <errno.h>
 #include <array>
 #include <string.h>
+#include <string_view>
 
 #include "common/ceph_crypto.h"
 #include "common/split.h"
@@ -15,7 +16,6 @@
 #include "auth/Crypto.h"
 #include <boost/algorithm/string.hpp>
 #include <boost/algorithm/string/replace.hpp>
-#include <boost/utility/string_view.hpp>
 #include <boost/tokenizer.hpp>
 
 #include <liboath/oath.h>
@@ -603,7 +603,7 @@ int RGWPutBucketTags_ObjStore_S3::get_params()
   try {
     RGWXMLDecoder::decode_xml("Tagging", tagging, &parser);
   } catch (RGWXMLDecoder::err& err) {
-    
+
     ldout(s->cct, 5) << "Malformed tagging request: " << err << dendl;
     return -ERR_MALFORMED_XML;
   }
@@ -634,7 +634,7 @@ void RGWPutBucketTags_ObjStore_S3::send_response()
   dump_start(s);
 }
 
-void RGWDeleteBucketTags_ObjStore_S3::send_response() 
+void RGWDeleteBucketTags_ObjStore_S3::send_response()
 {
   if (op_ret)
     set_req_state_err(s, op_ret);
@@ -1171,7 +1171,7 @@ int RGWPutBucketReplication_ObjStore_S3::get_params()
   try {
     RGWXMLDecoder::decode_xml("ReplicationConfiguration", conf, &parser);
   } catch (RGWXMLDecoder::err& err) {
-    
+
     ldout(s->cct, 5) << "Malformed tagging request: " << err << dendl;
     return -ERR_MALFORMED_XML;
   }
@@ -1205,7 +1205,7 @@ void RGWDeleteBucketReplication_ObjStore_S3::update_sync_policy(rgw_sync_policy_
   policy->groups.erase(disabled_group_id);
 }
 
-void RGWDeleteBucketReplication_ObjStore_S3::send_response() 
+void RGWDeleteBucketReplication_ObjStore_S3::send_response()
 {
   if (op_ret)
     set_req_state_err(s, op_ret);
@@ -1259,7 +1259,7 @@ void RGWListBuckets_ObjStore_S3::send_response_end()
 int RGWGetUsage_ObjStore_S3::get_params()
 {
   start_date = s->info.args.get("start-date");
-  end_date = s->info.args.get("end-date"); 
+  end_date = s->info.args.get("end-date");
   return 0;
 }
 
@@ -1307,7 +1307,7 @@ void RGWGetUsage_ObjStore_S3::send_response()
   Formatter *formatter = s->formatter;
   string last_owner;
   bool user_section_open = false;
-  
+
   formatter->open_object_section("Usage");
   if (show_log_entries) {
     formatter->open_array_section("Entries");
@@ -1415,7 +1415,7 @@ int RGWListBucket_ObjStore_S3::get_common_params()
   if (s->system_request) {
     s->info.args.get_bool("objs-container", &objs_container, false);
     const char *shard_id_str = s->info.env->get("HTTP_RGWX_SHARD_ID");
-    if (shard_id_str) {  
+    if (shard_id_str) {
       string err;
       shard_id = strict_strtol(shard_id_str, 10, &err);
       if (!err.empty()) {
@@ -1490,7 +1490,7 @@ void RGWListBucket_ObjStore_S3::send_common_versioned_response()
       }
     }
   }
-  
+
 void RGWListBucket_ObjStore_S3::send_versioned_response()
 {
   s->formatter->open_object_section_in_ns("ListVersionsResult", XMLNS_AWS_S3);
@@ -1504,7 +1504,7 @@ void RGWListBucket_ObjStore_S3::send_versioned_response()
   if (is_truncated && !next_marker.empty()) {
     s->formatter->dump_string("NextKeyMarker", next_marker.name);
     if (next_marker.instance.empty()) {
-      s->formatter->dump_string("NextVersionIdMarker", "null");  
+      s->formatter->dump_string("NextVersionIdMarker", "null");
     }
     else {
       s->formatter->dump_string("NextVersionIdMarker", next_marker.instance);
@@ -1515,7 +1515,7 @@ void RGWListBucket_ObjStore_S3::send_versioned_response()
     if (objs_container) {
       s->formatter->open_array_section("Entries");
     }
+
     vector<rgw_bucket_dir_entry>::iterator iter;
     for (iter = objs.begin(); iter != objs.end(); ++iter) {
       const char *section_name = (iter->is_delete_marker() ? "DeleteMarker"
@@ -1529,7 +1529,7 @@ void RGWListBucket_ObjStore_S3::send_versioned_response()
         string key_name;
         url_encode(key.name, key_name);
         s->formatter->dump_string("Key", key_name);
-      } 
+      }
       else {
         s->formatter->dump_string("Key", key.name);
       }
@@ -1599,7 +1599,7 @@ void RGWListBucket_ObjStore_S3::send_common_response()
       }
     }
   }
-  
+
 void RGWListBucket_ObjStore_S3::send_response()
 {
   if (op_ret < 0) {
@@ -1661,7 +1661,7 @@ void RGWListBucket_ObjStore_S3::send_response()
     s->formatter->close_section();
     rgw_flush_formatter_and_reset(s, s->formatter);
 }
-  
+
 void RGWListBucket_ObjStore_S3v2::send_versioned_response()
 {
   s->formatter->open_object_section_in_ns("ListVersionsResult", XMLNS_AWS_S3);
@@ -1682,7 +1682,7 @@ void RGWListBucket_ObjStore_S3v2::send_versioned_response()
     if (objs_container) {
       s->formatter->open_array_section("Entries");
     }
+
     vector<rgw_bucket_dir_entry>::iterator iter;
     for (iter = objs.begin(); iter != objs.end(); ++iter) {
       const char *section_name = (iter->is_delete_marker() ? "DeleteContinuationToken"
@@ -1696,7 +1696,7 @@ void RGWListBucket_ObjStore_S3v2::send_versioned_response()
         string key_name;
         url_encode(key.name, key_name);
         s->formatter->dump_string("Key", key_name);
-      } 
+      }
       else {
         s->formatter->dump_string("Key", key.name);
       }
@@ -1750,7 +1750,7 @@ void RGWListBucket_ObjStore_S3v2::send_versioned_response()
       s->formatter->close_section();
       }
     }
-  
+
     s->formatter->close_section();
     rgw_flush_formatter_and_reset(s, s->formatter);
   }
@@ -2184,7 +2184,7 @@ int RGWCreateBucket_ObjStore_S3::get_params()
 {
   RGWAccessControlPolicy_S3 s3policy(s->cct);
   bool relaxed_names = s->cct->_conf->rgw_relaxed_s3_bucket_names;
+
   int r = valid_s3_bucket_name(s->bucket_name, relaxed_names);
   if (r)
     return r;
@@ -2208,7 +2208,7 @@ int RGWCreateBucket_ObjStore_S3::get_params()
   if (auth_ret < 0) {
     return auth_ret;
   }
-  
+
   in_data.append(data);
 
   if (data.length()) {
@@ -2326,11 +2326,11 @@ int RGWPutObj_ObjStore_S3::get_params()
   copy_source_range = s->info.env->get("HTTP_X_AMZ_COPY_SOURCE_RANGE");
 
   /* handle x-amz-copy-source */
-  boost::string_view cs_view(copy_source);
+  std::string_view cs_view(copy_source);
   if (! cs_view.empty()) {
     if (cs_view[0] == '/')
       cs_view.remove_prefix(1);
-    copy_source_bucket_name = cs_view.to_string();
+    copy_source_bucket_name = std::string(cs_view);
     pos = copy_source_bucket_name.find("/");
     if (pos == std::string::npos) {
       ret = -EINVAL;
@@ -2483,7 +2483,7 @@ int RGWPutObj_ObjStore_S3::get_params()
       position = strtoull(pos_str.c_str(), NULL, 10);
     }
   }
-  
+
   return RGWPutObj_ObjStore::get_params();
 }
 
@@ -3427,7 +3427,7 @@ void RGWGetLC_ObjStore_S3::execute()
 void RGWGetLC_ObjStore_S3::send_response()
 {
   if (op_ret) {
-    if (op_ret == -ENOENT) {   
+    if (op_ret == -ENOENT) {
       set_req_state_err(s, ERR_NO_SUCH_LC);
     } else {
       set_req_state_err(s, op_ret);
@@ -3457,7 +3457,7 @@ void RGWDeleteLC_ObjStore_S3::send_response()
 {
   if (op_ret == 0)
       op_ret = STATUS_NO_CONTENT;
-  if (op_ret) {   
+  if (op_ret) {
     set_req_state_err(s, op_ret);
   }
   dump_errno(s);
@@ -4316,7 +4316,7 @@ RGWOp *RGWHandler_REST_Service_S3::op_post()
 RGWOp *RGWHandler_REST_Bucket_S3::get_obj_op(bool get_data) const
 {
   // Non-website mode
-  if (get_data) {   
+  if (get_data) {
     int list_type = 1;
     s->info.args.get_int("list-type", &list_type, 1);
     switch (list_type) {
@@ -5162,7 +5162,7 @@ AWSGeneralAbstractor::get_auth_data(const req_state* const s) const
 boost::optional<std::string>
 AWSGeneralAbstractor::get_v4_canonical_headers(
   const req_info& info,
-  const boost::string_view& signedheaders,
+  const std::string_view& signedheaders,
   const bool using_qs) const
 {
   return rgw::auth::s3::get_v4_canonical_headers(info, signedheaders,
@@ -5173,13 +5173,13 @@ AWSEngine::VersionAbstractor::auth_data_t
 AWSGeneralAbstractor::get_auth_data_v4(const req_state* const s,
                                        const bool using_qs) const
 {
-  boost::string_view access_key_id;
-  boost::string_view signed_hdrs;
+  std::string_view access_key_id;
+  std::string_view signed_hdrs;
 
-  boost::string_view date;
-  boost::string_view credential_scope;
-  boost::string_view client_signature;
-  boost::string_view session_token;
+  std::string_view date;
+  std::string_view credential_scope;
+  std::string_view client_signature;
+  std::string_view session_token;
 
   int ret = rgw::auth::s3::parse_v4_credentials(s->info,
                                                access_key_id,
@@ -5395,7 +5395,7 @@ AWSGeneralAbstractor::get_auth_data_v4(const req_state* const s,
 boost::optional<std::string>
 AWSGeneralBoto2Abstractor::get_v4_canonical_headers(
   const req_info& info,
-  const boost::string_view& signedheaders,
+  const std::string_view& signedheaders,
   const bool using_qs) const
 {
   return rgw::auth::s3::get_v4_canonical_headers(info, signedheaders,
@@ -5406,9 +5406,9 @@ AWSGeneralBoto2Abstractor::get_v4_canonical_headers(
 AWSEngine::VersionAbstractor::auth_data_t
 AWSGeneralAbstractor::get_auth_data_v2(const req_state* const s) const
 {
-  boost::string_view access_key_id;
-  boost::string_view signature;
-  boost::string_view session_token;
+  std::string_view access_key_id;
+  std::string_view signature;
+  std::string_view session_token;
   bool qsr = false;
 
   const char* http_auth = s->info.env->get("HTTP_AUTHORIZATION");
@@ -5419,7 +5419,7 @@ AWSGeneralAbstractor::get_auth_data_v2(const req_state* const s) const
     signature = s->info.args.get("Signature");
     qsr = true;
 
-    boost::string_view expires = s->info.args.get("Expires");
+    std::string_view expires = s->info.args.get("Expires");
     if (expires.empty()) {
       throw -EPERM;
     }
@@ -5442,9 +5442,9 @@ AWSGeneralAbstractor::get_auth_data_v2(const req_state* const s) const
 
   } else {
     /* The "Authorization" HTTP header is being used. */
-    const boost::string_view auth_str(http_auth + strlen("AWS "));
+    const std::string_view auth_str(http_auth + strlen("AWS "));
     const size_t pos = auth_str.rfind(':');
-    if (pos != boost::string_view::npos) {
+    if (pos != std::string_view::npos) {
       access_key_id = auth_str.substr(0, pos);
       signature = auth_str.substr(pos + 1);
     }
@@ -5501,15 +5501,15 @@ AWSBrowserUploadAbstractor::get_auth_data_v2(const req_state* const s) const
 AWSEngine::VersionAbstractor::auth_data_t
 AWSBrowserUploadAbstractor::get_auth_data_v4(const req_state* const s) const
 {
-  const boost::string_view credential = s->auth.s3_postobj_creds.x_amz_credential;
+  const std::string_view credential = s->auth.s3_postobj_creds.x_amz_credential;
 
   /* grab access key id */
   const size_t pos = credential.find("/");
-  const boost::string_view access_key_id = credential.substr(0, pos);
+  const std::string_view access_key_id = credential.substr(0, pos);
   dout(10) << "access key id = " << access_key_id << dendl;
 
   /* grab credential scope */
-  const boost::string_view credential_scope = credential.substr(pos + 1);
+  const std::string_view credential_scope = credential.substr(pos + 1);
   dout(10) << "credential scope = " << credential_scope << dendl;
 
   const auto sig_factory = std::bind(rgw::auth::s3::get_v4_signature,
@@ -5625,9 +5625,9 @@ rgw::auth::s3::LDAPEngine::get_creds_info(const rgw::RGWToken& token) const noex
 rgw::auth::Engine::result_t
 rgw::auth::s3::LDAPEngine::authenticate(
   const DoutPrefixProvider* dpp,
-  const boost::string_view& access_key_id,
-  const boost::string_view& signature,
-  const boost::string_view& session_token,
+  const std::string_view& access_key_id,
+  const std::string_view& signature,
+  const std::string_view& session_token,
   const string_to_sign_t& string_to_sign,
   const signature_factory_t&,
   const completer_factory_t& completer_factory,
@@ -5677,9 +5677,9 @@ void rgw::auth::s3::LDAPEngine::shutdown() {
 rgw::auth::Engine::result_t
 rgw::auth::s3::LocalEngine::authenticate(
   const DoutPrefixProvider* dpp,
-  const boost::string_view& _access_key_id,
-  const boost::string_view& signature,
-  const boost::string_view& session_token,
+  const std::string_view& _access_key_id,
+  const std::string_view& signature,
+  const std::string_view& session_token,
   const string_to_sign_t& string_to_sign,
   const signature_factory_t& signature_factory,
   const completer_factory_t& completer_factory,
@@ -5688,7 +5688,7 @@ rgw::auth::s3::LocalEngine::authenticate(
   /* get the user info */
   RGWUserInfo user_info;
   /* TODO(rzarzynski): we need to have string-view taking variant. */
-  const std::string access_key_id = _access_key_id.to_string();
+  const std::string access_key_id(_access_key_id);
   if (rgw_get_user_info_by_access_key(ctl->user, access_key_id, user_info) < 0) {
       ldpp_dout(dpp, 5) << "error reading user info, uid=" << access_key_id
               << " can't authenticate" << dendl;
@@ -5745,7 +5745,7 @@ rgw::auth::s3::STSEngine::get_creds_info(const STS::SessionToken& token) const n
 }
 
 int
-rgw::auth::s3::STSEngine::get_session_token(const DoutPrefixProvider* dpp, const boost::string_view& session_token,
+rgw::auth::s3::STSEngine::get_session_token(const DoutPrefixProvider* dpp, const std::string_view& session_token,
                                             STS::SessionToken& token) const
 {
   string decodedSessionToken;
@@ -5798,9 +5798,9 @@ rgw::auth::s3::STSEngine::get_session_token(const DoutPrefixProvider* dpp, const
 rgw::auth::Engine::result_t
 rgw::auth::s3::STSEngine::authenticate(
   const DoutPrefixProvider* dpp,
-  const boost::string_view& _access_key_id,
-  const boost::string_view& signature,
-  const boost::string_view& session_token,
+  const std::string_view& _access_key_id,
+  const std::string_view& signature,
+  const std::string_view& session_token,
   const string_to_sign_t& string_to_sign,
   const signature_factory_t& signature_factory,
   const completer_factory_t& completer_factory,
index a4f9fb41ce3abe00efaeee2f5ce78836d956ef72..c0b58f7597156a64f3c1f5b66a8395373662b639 100644 (file)
@@ -6,8 +6,8 @@
 #define TIME_BUF_SIZE 128
 
 #include <mutex>
+#include <string_view>
 
-#include <boost/utility/string_view.hpp>
 #include <boost/container/static_vector.hpp>
 
 #include "common/sstring.hh"
@@ -893,9 +893,9 @@ public:
   public:
     virtual ~VersionAbstractor() {};
 
-    using access_key_id_t = boost::string_view;
-    using client_signature_t = boost::string_view;
-    using session_token_t = boost::string_view;
+    using access_key_id_t = std::string_view;
+    using client_signature_t = std::string_view;
+    using session_token_t = std::string_view;
     using server_signature_t = basic_sstring<char, uint16_t, SIGNATURE_MAX_SIZE>;
     using string_to_sign_t = std::string;
 
@@ -944,9 +944,9 @@ protected:
    * the signature get_auth_data() of VersionAbstractor is too complicated.
    * Replace these thing with a simple, dedicated structure. */
   virtual result_t authenticate(const DoutPrefixProvider* dpp,
-                                const boost::string_view& access_key_id,
-                                const boost::string_view& signature,
-                                const boost::string_view& session_token,
+                                const std::string_view& access_key_id,
+                                const std::string_view& signature,
+                                const std::string_view& session_token,
                                 const string_to_sign_t& string_to_sign,
                                 const signature_factory_t& signature_factory,
                                 const completer_factory_t& completer_factory,
@@ -962,7 +962,7 @@ class AWSGeneralAbstractor : public AWSEngine::VersionAbstractor {
 
   virtual boost::optional<std::string>
   get_v4_canonical_headers(const req_info& info,
-                           const boost::string_view& signedheaders,
+                           const std::string_view& signedheaders,
                            const bool using_qs) const;
 
   auth_data_t get_auth_data_v2(const req_state* s) const;
@@ -979,7 +979,7 @@ public:
 class AWSGeneralBoto2Abstractor : public AWSGeneralAbstractor {
   boost::optional<std::string>
   get_v4_canonical_headers(const req_info& info,
-                           const boost::string_view& signedheaders,
+                           const std::string_view& signedheaders,
                            const bool using_qs) const override;
 
 public:
@@ -1021,9 +1021,9 @@ protected:
   auth_info_t get_creds_info(const rgw::RGWToken& token) const noexcept;
 
   result_t authenticate(const DoutPrefixProvider* dpp,
-                        const boost::string_view& access_key_id,
-                        const boost::string_view& signature,
-                        const boost::string_view& session_token,
+                        const std::string_view& access_key_id,
+                        const std::string_view& signature,
+                        const std::string_view& session_token,
                         const string_to_sign_t& string_to_sign,
                         const signature_factory_t&,
                         const completer_factory_t& completer_factory,
@@ -1054,9 +1054,9 @@ class LocalEngine : public AWSEngine {
   const rgw::auth::LocalApplier::Factory* const apl_factory;
 
   result_t authenticate(const DoutPrefixProvider* dpp,
-                        const boost::string_view& access_key_id,
-                        const boost::string_view& signature,
-                        const boost::string_view& session_token,
+                        const std::string_view& access_key_id,
+                        const std::string_view& signature,
+                        const std::string_view& session_token,
                         const string_to_sign_t& string_to_sign,
                         const signature_factory_t& signature_factory,
                         const completer_factory_t& completer_factory,
@@ -1090,13 +1090,13 @@ class STSEngine : public AWSEngine {
   acl_strategy_t get_acl_strategy() const { return nullptr; };
   auth_info_t get_creds_info(const STS::SessionToken& token) const noexcept;
 
-  int get_session_token(const DoutPrefixProvider* dpp, const boost::string_view& session_token,
+  int get_session_token(const DoutPrefixProvider* dpp, const std::string_view& session_token,
                         STS::SessionToken& token) const;
 
   result_t authenticate(const DoutPrefixProvider* dpp, 
-                        const boost::string_view& access_key_id,
-                        const boost::string_view& signature,
-                        const boost::string_view& session_token,
+                        const std::string_view& access_key_id,
+                        const std::string_view& signature,
+                        const std::string_view& session_token,
                         const string_to_sign_t& string_to_sign,
                         const signature_factory_t& signature_factory,
                         const completer_factory_t& completer_factory,
index 729c61e2e515f19350342bcbb9e59f2a7abf5627..7ef6455cd323f63a828ff34abc905f14373b24c8 100644 (file)
@@ -3,6 +3,7 @@
 #include <vector>
 #include <string>
 #include <array>
+#include <string_view>
 #include <sstream>
 #include <memory>
 
@@ -35,7 +36,7 @@
 
 #include "rgw_sts.h"
 #include "rgw_rest_oidc_provider.h"
-#include <boost/utility/string_ref.hpp>
+
 
 #define dout_context g_ceph_context
 #define dout_subsys ceph_subsys_rgw
@@ -128,7 +129,7 @@ WebTokenEngine::get_from_jwt(const DoutPrefixProvider* dpp, const std::string& t
   WebTokenEngine::token_t t;
   try {
     const auto& decoded = jwt::decode(token);
-  
+
     auto& payload = decoded.get_payload();
     ldpp_dout(dpp, 20) << " payload = " << payload << dendl;
     if (decoded.has_issuer()) {
@@ -580,7 +581,7 @@ void RGWHandler_REST_STS::rgw_sts_parse_input()
                               url_decode(t.substr(pos+1, t.size() -1)));
         }
       }
-    } 
+    }
   }
   auto payload_hash = rgw::auth::s3::calc_v4_payload_hash(post_body);
   s->info.args.append("PayloadHash", payload_hash);
index fb392828a42ac405187fb43dad6c5e0f05429e7c..7b01b57dc02b691d03d74944522c48d6c926d546 100644 (file)
 #include "services/svc_zone.h"
 
 #include <array>
+#include <string_view>
 #include <sstream>
 #include <memory>
 
-#include <boost/utility/string_ref.hpp>
-
 #define dout_context g_ceph_context
 #define dout_subsys ceph_subsys_rgw
 
@@ -2395,14 +2394,14 @@ int RGWSwiftWebsiteHandler::error_handler(const int err_no,
 
 bool RGWSwiftWebsiteHandler::is_web_mode() const
 {
-  const boost::string_ref webmode = s->info.env->get("HTTP_X_WEB_MODE", "");
+  const std::string_view webmode = s->info.env->get("HTTP_X_WEB_MODE", "");
   return boost::algorithm::iequals(webmode, "true");
 }
 
 bool RGWSwiftWebsiteHandler::can_be_website_req() const
 {
   /* Static website works only with the GET or HEAD method. Nothing more. */
-  static const std::set<boost::string_ref> ws_methods = { "GET", "HEAD" };
+  static const std::set<std::string_view> ws_methods = { "GET", "HEAD" };
   if (ws_methods.count(s->info.method) == 0) {
     return false;
   }
index 98e2fb144f0980a7eb25173aab247d1d20505d11..cf8b224313fbb65aa8c5763514958b11e1f72f52 100644 (file)
@@ -4,6 +4,8 @@
 #pragma once
 #define TIME_BUF_SIZE 128
 
+#include <string_view>
+
 #include <boost/optional.hpp>
 #include <boost/utility/typed_in_place_factory.hpp>
 
@@ -12,7 +14,6 @@
 #include "rgw_swift_auth.h"
 #include "rgw_http_errors.h"
 
-#include <boost/utility/string_ref.hpp>
 
 class RGWGetObj_ObjStore_SWIFT : public RGWGetObj_ObjStore {
   int custom_http_ret = 0;
@@ -296,11 +297,11 @@ public:
   SignatureHelper() = default;
 
   const char* calc(const std::string& key,
-                   const boost::string_ref& path_info,
-                   const boost::string_ref& redirect,
-                   const boost::string_ref& max_file_size,
-                   const boost::string_ref& max_file_count,
-                   const boost::string_ref& expires) {
+                   const std::string_view& path_info,
+                   const std::string_view& redirect,
+                   const std::string_view& max_file_size,
+                   const std::string_view& max_file_count,
+                   const std::string_view& expires) {
     using ceph::crypto::HMACSHA1;
     using UCHARPTR = const unsigned char*;
 
index 73380a25c5f149b7a035edf663177abd56af7d7c..7be82f854a844512dcf2b1d6b268d35a91756e76 100644 (file)
@@ -13,7 +13,7 @@ static bool ci_char_eq(char c1, char c2)
   return tolower(c1) == tolower(c2);
 }
 
-bool match_wildcards(boost::string_view pattern, boost::string_view input,
+bool match_wildcards(std::string_view pattern, std::string_view input,
                      uint32_t flags)
 {
   const auto eq = (flags & MATCH_CASE_INSENSITIVE) ? &ci_char_eq : &char_eq;
index d7ccc9f06d2b42b850614ad64d84cc81259fcadb..257daa9c1fe6e7c11b85c522be67ad962db9ddbe 100644 (file)
@@ -7,9 +7,9 @@
 #include <errno.h>
 #include <stdlib.h>
 #include <limits.h>
+#include <string_view>
 
 #include <boost/container/small_vector.hpp>
-#include <boost/utility/string_view.hpp>
 
 struct ltstr_nocase
 {
@@ -98,12 +98,12 @@ static inline int stringtoul(const std::string& s, uint32_t *val)
   return 0;
 }
 
-/* A converter between boost::string_view and null-terminated C-strings.
+/* A converter between std::string_view and null-terminated C-strings.
  * It copies memory while trying to utilize the local memory instead of
  * issuing dynamic allocations. */
 template<std::size_t N = 128>
 static inline boost::container::small_vector<char, N>
-sview2cstr(const boost::string_view& sv)
+sview2cstr(const std::string_view& sv)
 {
   boost::container::small_vector<char, N> cstr;
   cstr.reserve(sv.size() + sizeof('\0'));
@@ -157,27 +157,27 @@ struct string_traits<char[N]> : string_traits<const char[N]> {};
 // helpers for string_cat_reserve()
 static inline void append_to(std::string& s) {}
 template <typename... Args>
-void append_to(std::string& s, const boost::string_view& v, const Args&... args)
+void append_to(std::string& s, const std::string_view& v, const Args&... args)
 {
   s.append(v.begin(), v.end());
   append_to(s, args...);
 }
 
 // helpers for string_join_reserve()
-static inline void join_next(std::string& s, const boost::string_view& d) {}
+static inline void join_next(std::string& s, const std::string_view& d) {}
 template <typename... Args>
-void join_next(std::string& s, const boost::string_view& d,
-               const boost::string_view& v, const Args&... args)
+void join_next(std::string& s, const std::string_view& d,
+               const std::string_view& v, const Args&... args)
 {
   s.append(d.begin(), d.end());
   s.append(v.begin(), v.end());
   join_next(s, d, args...);
 }
 
-static inline void join(std::string& s, const boost::string_view& d) {}
+static inline void join(std::string& s, const std::string_view& d) {}
 template <typename... Args>
-void join(std::string& s, const boost::string_view& d,
-          const boost::string_view& v, const Args&... args)
+void join(std::string& s, const std::string_view& d,
+          const std::string_view& v, const Args&... args)
 {
   s.append(v.begin(), v.end());
   join_next(s, d, args...);
@@ -207,7 +207,7 @@ std::string string_cat_reserve(const Args&... args)
 /// joins the given string arguments with a delimiter, returning as a
 /// std::string that gets preallocated with reserve()
 template <typename... Args>
-std::string string_join_reserve(const boost::string_view& delim,
+std::string string_join_reserve(const std::string_view& delim,
                                 const Args&... args)
 {
   size_t delim_size = delim.size() * std::max<ssize_t>(0, sizeof...(args) - 1);
@@ -220,7 +220,7 @@ std::string string_join_reserve(const boost::string_view& delim,
 template <typename... Args>
 std::string string_join_reserve(char delim, const Args&... args)
 {
-  return string_join_reserve(boost::string_view{&delim, 1}, args...);
+  return string_join_reserve(std::string_view{&delim, 1}, args...);
 }
 
 
@@ -229,8 +229,8 @@ static constexpr uint32_t MATCH_CASE_INSENSITIVE = 0x01;
 
 /// attempt to match the given input string with the pattern, which may contain
 /// the wildcard characters * and ?
-extern bool match_wildcards(boost::string_view pattern,
-                            boost::string_view input,
+extern bool match_wildcards(std::string_view pattern,
+                            std::string_view input,
                             uint32_t flags = 0);
 
 #endif
index 72288edf923be04d2e2f505cbb83750062be411a..44bb3efd9e306452112f6a8374b80987ef61430b 100644 (file)
@@ -3,8 +3,8 @@
 
 #include <array>
 #include <algorithm>
+#include <string_view>
 
-#include <boost/utility/string_view.hpp>
 #include <boost/container/static_vector.hpp>
 #include <boost/algorithm/string/predicate.hpp>
 #include <boost/algorithm/string.hpp>
@@ -193,8 +193,8 @@ public:
   SignatureHelper() = default;
 
   const char* calc(const std::string& key,
-                   const boost::string_view& method,
-                   const boost::string_view& path,
+                   const std::string_view& method,
+                   const std::string_view& path,
                    const std::string& expires) {
 
     using ceph::crypto::HMACSHA1;
@@ -227,9 +227,9 @@ class TempURLEngine::PrefixableSignatureHelper
     : private TempURLEngine::SignatureHelper {
   using base_t = SignatureHelper;
 
-  const boost::string_view decoded_uri;
-  const boost::string_view object_name;
-  boost::string_view no_obj_uri;
+  const std::string_view decoded_uri;
+  const std::string_view object_name;
+  std::string_view no_obj_uri;
 
   const boost::optional<const std::string&> prefix;
 
@@ -242,7 +242,7 @@ public:
       prefix(prefix) {
     /* Transform: v1/acct/cont/obj - > v1/acct/cont/
      *
-     * NOTE(rzarzynski): we really want to substr() on boost::string_view,
+     * NOTE(rzarzynski): we really want to substr() on std::string_view,
      * not std::string. Otherwise we would end with no_obj_uri referencing
      * a temporary. */
     no_obj_uri = \
@@ -250,8 +250,8 @@ public:
   }
 
   const char* calc(const std::string& key,
-                   const boost::string_view& method,
-                   const boost::string_view& path,
+                   const std::string_view& method,
+                   const std::string_view& path,
                    const std::string& expires) {
     if (!prefix) {
       return base_t::calc(key, method, path, expires);
@@ -327,14 +327,14 @@ TempURLEngine::authenticate(const DoutPrefixProvider* dpp, const req_state* cons
 
   /* XXX can we search this ONCE? */
   const size_t pos = g_conf()->rgw_swift_url_prefix.find_last_not_of('/') + 1;
-  const boost::string_view ref_uri = s->decoded_uri;
-  const std::array<boost::string_view, 2> allowed_paths = {
+  const std::string_view ref_uri = s->decoded_uri;
+  const std::array<std::string_view, 2> allowed_paths = {
     ref_uri,
     ref_uri.substr(pos + 1)
   };
 
   /* Account owner calculates the signature also against a HTTP method. */
-  boost::container::static_vector<boost::string_view, 3> allowed_methods;
+  boost::container::static_vector<std::string_view, 3> allowed_methods;
   if (strcmp("HEAD", s->info.method) == 0) {
     /* HEAD requests are specially handled. */
     /* TODO: after getting a newer boost (with static_vector supporting
index 2bfb1140ab9468455e123348295a626e2f98ae92..9cc0e9c05b5d1fcc455bce4cbdca6e4b5ec1bc97 100644 (file)
@@ -7,12 +7,12 @@
 #include <algorithm>
 #include <array>
 #include <cstring>
+#include <string_view>
 #include <tuple>
 #include <utility>
 
 #include <boost/optional.hpp>
 #include <boost/range/adaptor/reversed.hpp>
-#include <boost/utility/string_ref.hpp>
 
 namespace rgw {
 namespace tar {
@@ -107,8 +107,8 @@ public:
     }
   }
 
-  boost::string_ref get_filename() const {
-    return boost::string_ref(header->filename,
+  std::string_view get_filename() const {
+    return std::string_view(header->filename,
                              std::min(sizeof(header->filename),
                                       strlen(header->filename)));
   }
@@ -116,13 +116,13 @@ public:
   size_t get_filesize() const {
     /* The string_ref is pretty suitable here because tar encodes its
      * metadata in ASCII. */
-    const boost::string_ref raw(header->filesize, sizeof(header->filesize));
+    const std::string_view raw(header->filesize, sizeof(header->filesize));
 
     /* We need to find where the padding ends. */
     const auto pad_ends_at = std::min(raw.find_last_not_of('\0'),
                                       raw.find_last_not_of(' '));
     const auto trimmed = raw.substr(0,
-      pad_ends_at == boost::string_ref::npos ? boost::string_ref::npos
+      pad_ends_at == std::string_view::npos ? std::string_view::npos
                                              : pos2len(pad_ends_at));
 
     size_t sum = 0, mul = 1;
index 1f5740e082acbac4c2c020c512398bc8f866aa6c..658b501f55598b2d975305f07a73541940e08091 100644 (file)
@@ -348,7 +348,7 @@ struct BucketTrimObserver {
   virtual ~BucketTrimObserver() = default;
 
   virtual void on_bucket_trimmed(std::string&& bucket_instance) = 0;
-  virtual bool trimmed_recently(const boost::string_view& bucket_instance) = 0;
+  virtual bool trimmed_recently(const std::string_view& bucket_instance) = 0;
 };
 
 /// populate the status with the minimum stable marker of each shard
@@ -1101,7 +1101,7 @@ class BucketTrimManager::Impl : public TrimCounters::Server,
     trimmed.insert(std::move(bucket_instance), clock_type::now());
   }
 
-  bool trimmed_recently(const boost::string_view& bucket_instance) override {
+  bool trimmed_recently(const std::string_view& bucket_instance) override {
     std::lock_guard<std::mutex> lock(mutex);
     return trimmed.lookup(bucket_instance);
   }
@@ -1119,14 +1119,14 @@ int BucketTrimManager::init()
   return impl->watcher.start();
 }
 
-void BucketTrimManager::on_bucket_changed(const boost::string_view& bucket)
+void BucketTrimManager::on_bucket_changed(const std::string_view& bucket)
 {
   std::lock_guard<std::mutex> lock(impl->mutex);
   // filter recently trimmed bucket instances out of bucket change counter
   if (impl->trimmed.lookup(bucket)) {
     return;
   }
-  impl->counter.insert(bucket.to_string());
+  impl->counter.insert(std::string(bucket));
 }
 
 RGWCoroutine* BucketTrimManager::create_bucket_trim_cr(RGWHTTPManager *http)
index c675112270fea981936218978e51dc918a956223..5bc5c3cfd9b89acbba8a2830c00191fd52f1a1a0 100644 (file)
@@ -18,7 +18,8 @@
 #define RGW_SYNC_LOG_TRIM_H
 
 #include <memory>
-#include <boost/utility/string_view.hpp>
+#include <string_view>
+
 #include "include/common_fwd.h"
 #include "include/encoding.h"
 #include "common/ceph_time.h"
@@ -36,7 +37,7 @@ namespace sal {
 struct BucketChangeObserver {
   virtual ~BucketChangeObserver() = default;
 
-  virtual void on_bucket_changed(const boost::string_view& bucket_instance) = 0;
+  virtual void on_bucket_changed(const std::string_view& bucket_instance) = 0;
 };
 
 /// Configuration for BucketTrimManager
@@ -78,7 +79,7 @@ class BucketTrimManager : public BucketChangeObserver {
   int init();
 
   /// increment a counter for the given bucket instance
-  void on_bucket_changed(const boost::string_view& bucket_instance) override;
+  void on_bucket_changed(const std::string_view& bucket_instance) override;
 
   /// create a coroutine to run the bucket trim process every trim interval
   RGWCoroutine* create_bucket_trim_cr(RGWHTTPManager *http);
index 1ab9559284034bff99428257d76ad1610ff4bca1..b0dbabfd4e22ad8e87f47dc6b627efea936e099d 100644 (file)
@@ -35,7 +35,7 @@ public:
 
   int handle_data(bufferlist& bl, off_t bl_ofs, off_t bl_len) override
   {
-    sink << boost::string_ref(bl.c_str()+bl_ofs, bl_len);
+    sink << std::string_view(bl.c_str()+bl_ofs, bl_len);
     return 0;
   }
   std::string get_sink()
@@ -50,7 +50,7 @@ class ut_put_sink: public rgw::putobj::DataProcessor
 public:
   int process(bufferlist&& bl, uint64_t ofs) override
   {
-    sink << boost::string_ref(bl.c_str(),bl.length());
+    sink << std::string_view(bl.c_str(),bl.length());
     return 0;
   }
   std::string get_sink()
@@ -138,8 +138,8 @@ TEST(TestRGWCrypto, verify_AES_256_CBC_identity)
       ASSERT_TRUE(aes->decrypt(encrypted, 0, end - begin, decrypted, offset));
 
       ASSERT_EQ(decrypted.length(), end - begin);
-      ASSERT_EQ(boost::string_ref(input.c_str() + begin, end - begin),
-                boost::string_ref(decrypted.c_str(), end - begin) );
+      ASSERT_EQ(std::string_view(input.c_str() + begin, end - begin),
+                std::string_view(decrypted.c_str(), end - begin) );
     }
   }
 }
@@ -186,8 +186,8 @@ TEST(TestRGWCrypto, verify_AES_256_CBC_identity_2)
       ASSERT_TRUE(aes->decrypt(encrypted, 0, end, decrypted, offset));
 
       ASSERT_EQ(decrypted.length(), end);
-      ASSERT_EQ(boost::string_ref(input.c_str(), end),
-                boost::string_ref(decrypted.c_str(), end) );
+      ASSERT_EQ(std::string_view(input.c_str(), end),
+                std::string_view(decrypted.c_str(), end) );
     }
   }
 }
@@ -263,8 +263,8 @@ TEST(TestRGWCrypto, verify_AES_256_CBC_identity_3)
       }
       ASSERT_EQ(encrypted1.length(), end);
       ASSERT_EQ(encrypted2.length(), end);
-      ASSERT_EQ(boost::string_ref(encrypted1.c_str(), end),
-                boost::string_ref(encrypted2.c_str(), end) );
+      ASSERT_EQ(std::string_view(encrypted1.c_str(), end),
+                std::string_view(encrypted2.c_str(), end) );
     }
   }
 }
@@ -312,8 +312,8 @@ TEST(TestRGWCrypto, verify_AES_256_CBC_size_0_15)
       ASSERT_TRUE(aes->encrypt(encrypted, 0, end, decrypted, offset));
       ASSERT_EQ(encrypted.length(), end);
       ASSERT_EQ(decrypted.length(), end);
-      ASSERT_EQ(boost::string_ref(input.c_str(), end),
-                boost::string_ref(decrypted.c_str(), end) );
+      ASSERT_EQ(std::string_view(input.c_str(), end),
+                std::string_view(decrypted.c_str(), end) );
     }
   }
 }
@@ -388,8 +388,8 @@ TEST(TestRGWCrypto, verify_AES_256_CBC_identity_last_block)
       }
       ASSERT_EQ(encrypted1.length(), end);
       ASSERT_EQ(encrypted2.length(), end);
-      ASSERT_EQ(boost::string_ref(encrypted1.c_str(), end),
-                boost::string_ref(encrypted2.c_str(), end) );
+      ASSERT_EQ(std::string_view(encrypted1.c_str(), end),
+                std::string_view(encrypted2.c_str(), end) );
     }
   }
 }
@@ -436,7 +436,7 @@ TEST(TestRGWCrypto, verify_RGWGetObj_BlockDecrypt_ranges)
     const std::string& decrypted = get_sink.get_sink();
     size_t expected_len = end - begin + 1;
     ASSERT_EQ(decrypted.length(), expected_len);
-    ASSERT_EQ(decrypted, boost::string_ref(input.c_str()+begin, expected_len));
+    ASSERT_EQ(decrypted, std::string_view(input.c_str()+begin, expected_len));
   }
 }
 
@@ -492,7 +492,7 @@ TEST(TestRGWCrypto, verify_RGWGetObj_BlockDecrypt_chunks)
     const std::string& decrypted = get_sink.get_sink();
     size_t expected_len = end - begin + 1;
     ASSERT_EQ(decrypted.length(), expected_len);
-    ASSERT_EQ(decrypted, boost::string_ref(input.c_str()+begin, expected_len));
+    ASSERT_EQ(decrypted, std::string_view(input.c_str()+begin, expected_len));
   }
 }
 
@@ -740,8 +740,8 @@ TEST(TestRGWCrypto, verify_RGWPutObj_BlockEncrypt_chunks)
     ASSERT_TRUE(cbc->decrypt(encrypted, 0, test_size, decrypted, 0));
 
     ASSERT_EQ(decrypted.length(), test_size);
-    ASSERT_EQ(boost::string_ref(decrypted.c_str(), test_size),
-              boost::string_ref(input.c_str(), test_size));
+    ASSERT_EQ(std::string_view(decrypted.c_str(), test_size),
+              std::string_view(input.c_str(), test_size));
   }
 }
 
@@ -790,7 +790,7 @@ TEST(TestRGWCrypto, verify_Encrypt_Decrypt)
     decrypt.handle_data(bl, 0, bl.length());
     decrypt.flush();
     ASSERT_EQ(get_sink.get_sink().length(), test_size);
-    ASSERT_EQ(get_sink.get_sink(), boost::string_ref((char*)test_in,test_size));
+    ASSERT_EQ(get_sink.get_sink(), std::string_view((char*)test_in,test_size));
   }
   while (test_size < 20000);
 }
index 4246a1c1d8c3145bfb7f41216f416f4a414631ee..96ca0c0ef81749ae5b9ab7cb18dd2bf6fe45b086 100644 (file)
@@ -18,7 +18,7 @@ class MockTransitSecretEngine : public TransitSecretEngine {
 public:
   MockTransitSecretEngine(CephContext *cct) : TransitSecretEngine(cct){}
 
-  MOCK_METHOD(int, send_request, (boost::string_view key_id, JSONParser* parser), (override));
+  MOCK_METHOD(int, send_request, (std::string_view key_id, JSONParser* parser), (override));
 
 };
 
@@ -27,7 +27,7 @@ class MockKvSecretEngine : public KvSecretEngine {
 public:
   MockKvSecretEngine(CephContext *cct) : KvSecretEngine(cct){}
 
-  MOCK_METHOD(int, send_request, (boost::string_view key_id, JSONParser* parser), (override));
+  MOCK_METHOD(int, send_request, (std::string_view key_id, JSONParser* parser), (override));
 
 };
 
@@ -58,7 +58,7 @@ TEST_F(TestSSEKMS, vault_token_file_unset)
   TransitSecretEngine te(cct);
   KvSecretEngine kv(cct);
 
-  boost::string_view key_id("my_key");
+  std::string_view key_id("my_key");
   std::string actual_key;
 
   ASSERT_EQ(te.get_key(key_id, actual_key), -EINVAL);
@@ -73,7 +73,7 @@ TEST_F(TestSSEKMS, non_existent_vault_token_file)
   TransitSecretEngine te(cct);
   KvSecretEngine kv(cct);
 
-  boost::string_view key_id("my_key/1");
+  std::string_view key_id("my_key/1");
   std::string actual_key;
 
   ASSERT_EQ(te.get_key(key_id, actual_key), -ENOENT);
@@ -81,7 +81,7 @@ TEST_F(TestSSEKMS, non_existent_vault_token_file)
 }
 
 
-typedef int SendRequestMethod(boost::string_view, JSONParser*);
+typedef int SendRequestMethod(std::string_view, JSONParser*);
 
 class SetPointedValueAction : public ActionInterface<SendRequestMethod> {
  public:
@@ -91,7 +91,7 @@ class SetPointedValueAction : public ActionInterface<SendRequestMethod> {
     this->json = json;
   }
 
-  int Perform(const ::std::tuple<boost::string_view, JSONParser*>& args) override {
+  int Perform(const ::std::tuple<std::string_view, JSONParser*>& args) override {
     JSONParser* p = ::std::get<1>(args);
     JSONParser* parser = new JSONParser();
 
@@ -117,11 +117,11 @@ TEST_F(TestSSEKMS, test_transit_key_version_extraction){
 
   int res;
   for (const auto &test: tests) {
-    res = transit_engine->get_key(boost::string_view(test), actual_key);
+    res = transit_engine->get_key(std::string_view(test), actual_key);
     ASSERT_EQ(res, -EINVAL);
   }
 
-  res = transit_engine->get_key(boost::string_view("1/2/3/4/5/6"), actual_key);
+  res = transit_engine->get_key(std::string_view("1/2/3/4/5/6"), actual_key);
   ASSERT_EQ(res, 0);
   ASSERT_EQ(actual_key, from_base64("8qgPWvdtf6zrriS5+nkOzDJ14IGVR6Bgkub5dJn6qeg="));
 }
@@ -129,7 +129,7 @@ TEST_F(TestSSEKMS, test_transit_key_version_extraction){
 
 TEST_F(TestSSEKMS, test_transit_backend){
 
-  boost::string_view my_key("my_key/1");
+  std::string_view my_key("my_key/1");
   std::string actual_key;
 
   // Mocks the expected return Value from Vault Server using custom Argument Action
@@ -145,7 +145,7 @@ TEST_F(TestSSEKMS, test_transit_backend){
 
 TEST_F(TestSSEKMS, test_kv_backend){
 
-  boost::string_view my_key("my_key");
+  std::string_view my_key("my_key");
   std::string actual_key;
 
   // Mocks the expected return value from Vault Server using custom Argument Action
@@ -186,7 +186,7 @@ TEST_F(TestSSEKMS, concat_url)
 
 TEST_F(TestSSEKMS, test_transit_backend_empty_response)
 {
-  boost::string_view my_key("/key/nonexistent/1");
+  std::string_view my_key("/key/nonexistent/1");
   std::string actual_key;
 
   // Mocks the expected return Value from Vault Server using custom Argument Action
index 96dc8a9bf26b4edaefd1aeb16c0b36a204fad2dc..5d20718ae0308d8141fcb4d3a4db1475160093a8 100644 (file)
@@ -19,7 +19,7 @@ const std::string abc{"abc"};
 const char *def{"def"}; // const char*
 char ghi_arr[] = {'g', 'h', 'i', '\0'};
 char *ghi{ghi_arr}; // char*
-constexpr boost::string_view jkl{"jkl", 3};
+constexpr std::string_view jkl{"jkl", 3};
 #define mno "mno" // string literal (char[4])
 char pqr[] = {'p', 'q', 'r', '\0'};