diff options
author | Ebus-at-dockstar <ebus@dockstar> | 2014-07-27 17:07:25 +0200 |
---|---|---|
committer | Ebus-at-dockstar <ebus@dockstar> | 2014-07-27 17:11:51 +0200 |
commit | b5f713a888d1fc90c3c3664a5197a4cfcb969750 (patch) | |
tree | 87c8683f809b45416bced734560a58b807ad12a5 /datastore-leveldb/src | |
parent | 3cd78de16f985af16438d04cefedd28019257824 (diff) | |
download | ebus-alt-b5f713a888d1fc90c3c3664a5197a4cfcb969750.tar.gz ebus-alt-b5f713a888d1fc90c3c3664a5197a4cfcb969750.zip |
allow underscore in value name
Diffstat (limited to 'datastore-leveldb/src')
-rw-r--r-- | datastore-leveldb/src/db.cpp | 2 | ||||
-rw-r--r-- | datastore-leveldb/src/web.cpp | 8 |
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(×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()); |