From 7407647bf6c73c1b128749ed788d53b5f174b4be Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 20 Jul 2018 22:48:34 +0300 Subject: Add support for submission simulating --- mod/mod-submit.cxx | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'mod/mod-submit.cxx') 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. -- cgit v1.1