aboutsummaryrefslogtreecommitdiff
path: root/mod/mod-submit.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-07-20 22:48:34 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-07-25 20:32:30 +0300
commit7407647bf6c73c1b128749ed788d53b5f174b4be (patch)
treec2ea4b5f745baa86b4ed414d21778f6ddfefa4c1 /mod/mod-submit.cxx
parent8c0326c9433d47dfbeab8d1514512de1160d5792 (diff)
Add support for submission simulating
Diffstat (limited to 'mod/mod-submit.cxx')
-rw-r--r--mod/mod-submit.cxx20
1 files changed, 8 insertions, 12 deletions
diff --git a/mod/mod-submit.cxx b/mod/mod-submit.cxx
index ff5fa9d..6dbb4ec 100644
--- a/mod/mod-submit.cxx
+++ b/mod/mod-submit.cxx
@@ -527,24 +527,20 @@ handle (request& rq, response& rs)
parser p (is, "handler");
manifest_name_value nv (p.next ());
- auto bad_name ([&p, &nv] (const string& d) {
- throw parsing (p.name (), nv.name_line, nv.name_column, d);});
-
auto bad_value ([&p, &nv] (const string& d) {
throw parsing (p.name (), nv.value_line, nv.value_column, d);});
+ if (nv.empty ())
+ bad_value ("empty manifest");
+
const string& n (nv.name);
const string& v (nv.value);
- // Make sure this is the start and we support the version.
+ // The format version pair is verified by the parser.
//
- if (!n.empty ())
- bad_name ("start of manifest expected");
-
- if (v != "1")
- bad_value ("unsupported format version");
+ assert (n.empty () && v == "1");
- // Cache start of manifest.
+ // Cache the format version pair.
//
rvs.push_back (move (nv));
@@ -656,7 +652,7 @@ handle (request& rq, response& rs)
return respond_error ();
}
- // Send email, if configured.
+ // Send email, if configured, and the submission is not simulated.
//
// Note that we don't consider the email sending failure to be a submission
// failure as the submission data is successfully persisted and the handler
@@ -666,7 +662,7 @@ handle (request& rq, response& rs)
// web server error log is monitored and the email sending failure will be
// noticed.
//
- if (options_->submit_email_specified ())
+ if (options_->submit_email_specified () && !params.simulate ())
try
{
// Redirect the diagnostics to the web server error log.