summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--datastore-leveldb/src/db.cpp2
-rw-r--r--datastore-leveldb/src/web.cpp8
2 files changed, 5 insertions, 5 deletions
diff --git a/datastore-leveldb/src/db.cpp b/datastore-leveldb/src/db.cpp
index 991a82e..e307535 100644
--- a/datastore-leveldb/src/db.cpp
+++ b/datastore-leveldb/src/db.cpp
@@ -14,7 +14,7 @@ static bool sensor_name_is_sane(std::string& name) {
if (not ((*it >= '0' and *it <= '9') or
(*it >= 'A' and *it <= 'Z') or
(*it >= 'a' and *it <= 'z') or
- (*it == '.'))) {
+ (*it == '.') or (*it == '_'))) {
return false;
}
}
diff --git a/datastore-leveldb/src/web.cpp b/datastore-leveldb/src/web.cpp
index 443e782..503e3aa 100644
--- a/datastore-leveldb/src/web.cpp
+++ b/datastore-leveldb/src/web.cpp
@@ -37,7 +37,7 @@ static inline bool parse_key(leveldb::Slice &&key, uint64_t *value) {
}
const boost::regex web_handle_api_value_R(
- "/api/value/([a-zA-Z0-9\\.]+)");
+ "/api/value/([a-zA-Z0-9_\\.]+)");
void web_handle_api_value(const boost::cmatch &match, struct mg_connection *conn) {
std::string sensor(match[1].str());
uint64_t timestamp = now();
@@ -53,7 +53,7 @@ void web_handle_api_value(const boost::cmatch &match, struct mg_connection *conn
}
const boost::regex web_handle_api_value_timestamp_R(
- "/api/value/([a-zA-Z0-9\\.]+)/([0-9]+)");
+ "/api/value/([a-zA-Z0-9_\\.]+)/([0-9]+)");
void web_handle_api_value_timestamp(const boost::cmatch &match, struct mg_connection *conn) {
std::string sensor(match[1].str());
uint64_t timestamp; strToL(&timestamp, match[2].str());
@@ -95,7 +95,7 @@ static inline void print_json_tuple(struct mg_connection *conn,
const boost::regex web_handle_api_range_R(
- "/api/range/([a-zA-Z0-9\\.]+)/([0-9]+)/([0-9]+)");
+ "/api/range/([a-zA-Z0-9_\\.]+)/([0-9]+)/([0-9]+)");
void web_handle_api_range(const boost::cmatch &match, struct mg_connection *conn) {
std::string sensor(match[1].str());
uint64_t start; strToL(&start, match[2].str());
@@ -133,7 +133,7 @@ void web_handle_api_range(const boost::cmatch &match, struct mg_connection *conn
}
const boost::regex web_handle_api_range_size_R(
- "/api/range/([a-zA-Z0-9\\.]+)/([0-9]+)/([0-9]+)/([0-9]+)");
+ "/api/range/([a-zA-Z0-9_\\.]+)/([0-9]+)/([0-9]+)/([0-9]+)");
void web_handle_api_range_size(const boost::cmatch &match, struct mg_connection *conn) {
std::string sensor(match[1].str());
uint64_t start; strToL(&start, match[2].str());