From b5f713a888d1fc90c3c3664a5197a4cfcb969750 Mon Sep 17 00:00:00 2001 From: Ebus-at-dockstar Date: Sun, 27 Jul 2014 17:07:25 +0200 Subject: allow underscore in value name --- datastore-leveldb/src/db.cpp | 2 +- datastore-leveldb/src/web.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'datastore-leveldb/src') 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(×tamp, 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()); -- cgit v1.2.1