aboutsummaryrefslogtreecommitdiff
path: root/brep/search.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'brep/search.cxx')
-rw-r--r--brep/search.cxx31
1 files changed, 24 insertions, 7 deletions
diff --git a/brep/search.cxx b/brep/search.cxx
index 683016c..93690e4 100644
--- a/brep/search.cxx
+++ b/brep/search.cxx
@@ -5,6 +5,10 @@
#include <brep/search>
#include <ostream>
+#include <iostream>
+#include <chrono>
+
+#include <web/module>
using namespace std;
@@ -15,26 +19,39 @@ namespace brep
{
MODULE_DIAG;
+ chrono::seconds ma (60);
+ rs.cookie ("Oh", " Ah\n\n", &ma, "/");
+ rs.cookie ("Hm", ";Yes", &ma);
+
+ info << "handling search request from "; // << rq.client_ip ();
+
+ ostream& o (rs.content (200, "text/html;charset=utf-8", false));
+
+ o << "<html><head></head><body><b>Params:</b>";
+
const name_values& ps (rq.parameters ());
if (ps.empty ())
- throw invalid_request ("search parameters expected");
+ throw invalid_request (422, "search parameters expected");
if (ps.size () > 100)
fail << "too many parameters: " << ps.size () <<
info << "are you crazy to specify so many?";
- info << "handling search request from "; // << rq.client_ip ();
-
level2 ([&]{trace << "search request with " << ps.size () << " params";});
- ostream& o (rs.content (202, "text/html;charset=utf-8"));
+ for (const auto& p: ps)
+ {
+ o << "<br>\n" << p.name << "=" << p.value;
+ }
- o << "Search page:" << endl;
+ o << "<br>\n<b>Cookies:</b>";
- for (const name_value& p: ps)
+ for (const auto& c : rq.cookies ())
{
- o << p.name << "=" << p.value << endl;
+ o << "<br>\n" << c.name << "=" << c.value << " ";
}
+
+ o << "</body></html>";
}
}