diff options
author | Yves Fischer <yvesf-git@xapek.org> | 2013-04-18 15:42:54 +0200 |
---|---|---|
committer | Yves Fischer <yvesf-git@xapek.org> | 2013-04-18 15:42:54 +0200 |
commit | 7c8e064216cc672557cbf3892ff090490505e408 (patch) | |
tree | 2bbc9f5541bc2d7d90e4867af1d20d6d7d28105a /datastore-leveldb/src/main.cpp | |
parent | 67376eb18a6be1aae934407ad9d86bd6427cc05c (diff) | |
download | ebus-alt-7c8e064216cc672557cbf3892ff090490505e408.tar.gz ebus-alt-7c8e064216cc672557cbf3892ff090490505e408.zip |
leveldb: size restricted range query
Diffstat (limited to 'datastore-leveldb/src/main.cpp')
-rw-r--r-- | datastore-leveldb/src/main.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/datastore-leveldb/src/main.cpp b/datastore-leveldb/src/main.cpp index 3b0dd98..3000a25 100644 --- a/datastore-leveldb/src/main.cpp +++ b/datastore-leveldb/src/main.cpp @@ -19,10 +19,12 @@ struct mg_context *ctx; int begin_request_handler(struct mg_connection *conn) { boost::cmatch match; - const char *url = mg_get_request_info(conn)->uri; + const struct mg_request_info *request_info = mg_get_request_info(conn); for (auto item = web_handler.begin(); item != web_handler.end(); ++item) { - if (boost::regex_match(url, match, (*item).first)) { + if (boost::regex_match(request_info->uri, match, (*item).first)) { + std::cout << request_info->request_method << " " + << request_info->uri << std::endl; (*item).second(match, conn); return 1; } @@ -52,12 +54,15 @@ int main(int argc, char **argv) { // Routing web_handler.push_front(std::make_pair( - boost::regex("/api/value/([a-zA-Z0-9]+)/([0-9]+)"), + web_handle_api_value_R, web_handle_api_value)); web_handler.push_front(std::make_pair( - boost::regex("/api/range/([a-zA-Z0-9]+)/([0-9]+)/([0-9]+)"), + web_handle_api_range_R, web_handle_api_range)); - + web_handler.push_front(std::make_pair( + web_handle_api_range_size_R, + web_handle_api_range_size)); + // Signals: handle C-c struct sigaction action; |