// vim: ts=8 sw=2 smarttab
#include <errno.h>
+#include <boost/algorithm/string.hpp>
#include "json_spirit/json_spirit.h"
#include "common/ceph_json.h"
return !(http_ret >= 200 && http_ret <= 399);
}
-static bool starts_with(const string& s, const string& prefix) {
- if (s.size() < prefix.size()) {
- return false;
- }
- for (unsigned int i = 0; i < prefix.size(); ++i) {
- if (prefix[i] != s[i]) {
- return false;
- }
- }
- return true;
-}
-
// The requestURI transferred from the frontend can be abs_path or absoluteURI
// If it is absoluteURI, we should adjust it to abs_path for the following
// S3 authorization and some other processes depending on the requestURI
const static string ABS_PREFIXS[] = {"http://", "https://", "ws://", "wss://"};
bool isAbs = false;
for (int i = 0; i < 4; ++i) {
- if (starts_with(request_uri, ABS_PREFIXS[i])) {
+ if (boost::algorithm::starts_with(request_uri, ABS_PREFIXS[i])) {
isAbs = true;
break;
}
return out << o.bucket.name << ":" << o.get_object();
}
-static inline bool str_startswith(const string& str, const string& prefix)
-{
- return (str.compare(0, prefix.size(), prefix) == 0);
-}
-
static inline void buf_to_hex(const unsigned char *buf, int len, char *str)
{
int i;
#include <errno.h>
#include <stdlib.h>
#include <sys/types.h>
+#include <boost/algorithm/string.hpp>
#include "common/ceph_json.h"
#include "common/utf8.h"
map<string, bufferlist>::iterator iter;
for (iter = unfiltered_attrset.lower_bound(check_prefix);
iter != unfiltered_attrset.end(); ++iter) {
- if (!str_startswith(iter->first, check_prefix))
+ if (!boost::algorithm::starts_with(iter->first, check_prefix))
break;
(*attrset)[iter->first] = iter->second;
}