diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-08-11 20:11:47 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-08-23 13:50:52 +0200 |
commit | 24903813d11813f8ff9ac906d23b21e6c33b981d (patch) | |
tree | b4a7c1cc6dc4c2e7a1588573c86e2b20aa763a41 /brep/search.cxx | |
parent | a7e766e1aa77fff846d8426658befd9a01fe2861 (diff) |
Parse http request parameters using CLI
Diffstat (limited to 'brep/search.cxx')
-rw-r--r-- | brep/search.cxx | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/brep/search.cxx b/brep/search.cxx index 3aa6503..9185aa5 100644 --- a/brep/search.cxx +++ b/brep/search.cxx @@ -30,9 +30,9 @@ namespace brep { MODULE_DIAG; - options_ = make_shared<search_options> (s, - cli::unknown_mode::fail, - cli::unknown_mode::fail); + options_ = make_shared<options::search> (s, + cli::unknown_mode::fail, + cli::unknown_mode::fail); db_ = shared_database (options_->db_host (), options_->db_port ()); @@ -141,6 +141,21 @@ namespace brep o << "<br>\n" << p.name << "=" << p.value; } + param_scanner s (ps); + unique_ptr<params::search> prm; + + try + { + prm.reset (new params::search (s, + cli::unknown_mode::fail, + cli::unknown_mode::fail)); + } + catch (const cli::unknown_argument& e) + { + throw invalid_request (400, e.what ()); + } + + o << "<br>\nPage num: " << prm->page (); o << "<p>\n<b>Cookies:</b>"; for (const auto& c: rq.cookies ()) |