Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
}
}
+int RGWHTTPArgs::get_int(const char *name, int *val, int def_val)
+{
+ bool exists = false;
+ string val_str;
+ val_str = get(name, &exists);
+ if (!exists) {
+ *val = def_val;
+ return 0;
+ }
+
+ string err;
+
+ *val = (int)strict_strtol(val_str.c_str(), 10, &err);
+ if (!err.empty()) {
+ *val = def_val;
+ return -EINVAL;
+ }
+ return 0;
+}
+
string RGWHTTPArgs::sys_get(const string& name, bool * const exists) const
{
const auto iter = sys_val_map.find(name);
int get_bool(const string& name, bool *val, bool *exists);
int get_bool(const char *name, bool *val, bool *exists);
void get_bool(const char *name, bool *val, bool def_val);
+ int get_int(const char *name, int *val, int def_val);
/** Get the value for specific system argument parameter */
std::string sys_get(const string& name, bool *exists = nullptr) const;