blob: 1402d1f4f19665c2a8c1ba5da09893dc2ab61e47 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
// file : brep/view.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2015 Code Synthesis Tools CC
// license : MIT; see accompanying LICENSE file
#include <brep/view>
#include <memory> // shared_ptr, make_shared()
#include <ostream>
#include <web/module>
using namespace std;
namespace brep
{
void view::
init (cli::scanner& s)
{
options_ = make_shared<view_options> (s,
cli::unknown_mode::fail,
cli::unknown_mode::fail);
}
void view::
handle (request& rq, response& rs)
{
ostream& o (rs.content (200, "text/html;charset=utf-8", false));
o << "<html><head></head><body>";
o << "<b>Options:</b>"
<< "<br>\ntracing verbosity: " << options_->verb ()
<< "<br>\ndb endpoint: " << options_->db_host () << ":"
<< options_->db_port ();
o << "<p>\n<b>Cookies:</b>";
for (const auto& c: rq.cookies ())
{
o << "<br>\n" << c.name << "=" << c.value;
}
o << "<p><a href='search?a=1&b&c=2&d=&&x=a+b'>Search</a>"
<< "</body></html>";
}
}
|