aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-12-21 17:22:57 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-01-28 15:50:49 +0300
commitb3b31466afd6852d53a542daa17322deb8d908ac (patch)
treef76c6cf09c01bda97ce79e5e7c6168c9e923588d /mod
parent7159420700a0f179babc2f66d782853928fa3fe7 (diff)
Relax requirements for CI and submit service parameters
Diffstat (limited to 'mod')
-rw-r--r--mod/mod-ci.cxx14
-rw-r--r--mod/mod-submit.cxx14
2 files changed, 4 insertions, 24 deletions
diff --git a/mod/mod-ci.cxx b/mod/mod-ci.cxx
index 5a56526..b6db669 100644
--- a/mod/mod-ci.cxx
+++ b/mod/mod-ci.cxx
@@ -265,23 +265,13 @@ handle (request& rq, response& rs)
}
// Verify that unknown parameter values satisfy the requirements (contain
- // only ASCII printable characters plus '\r', '\n', and '\t').
+ // only UTF-8 encoded graphic characters plus '\t', '\r', and '\n').
//
// Actually, the expected ones must satisfy too, so check them as well.
//
- auto printable = [] (const string& s) -> bool
- {
- for (char c: s)
- {
- if (!((c >= 0x20 && c <= 0x7E) || c == '\n' || c == '\r' || c == '\t'))
- return false;
- }
- return true;
- };
-
for (const name_value& nv: rps)
{
- if (nv.value && !printable (*nv.value))
+ if (nv.value && !utf8 (*nv.value, codepoint_types::graphic, U"\r\n\t"))
return respond_manifest (400, "invalid parameter " + nv.name);
}
diff --git a/mod/mod-submit.cxx b/mod/mod-submit.cxx
index 3130823..2dd8591 100644
--- a/mod/mod-submit.cxx
+++ b/mod/mod-submit.cxx
@@ -254,23 +254,13 @@ handle (request& rq, response& rs)
return respond_manifest (400, "invalid package archive checksum");
// Verify that unknown parameter values satisfy the requirements (contain
- // only ASCII printable characters plus '\r', '\n', and '\t').
+ // only UTF-8 encoded graphic characters plus '\t', '\r', and '\n').
//
// Actually, the expected ones must satisfy too, so check them as well.
//
- auto printable = [] (const string& s) -> bool
- {
- for (char c: s)
- {
- if (!((c >= 0x20 && c <= 0x7E) || c == '\n' || c == '\r' || c == '\t'))
- return false;
- }
- return true;
- };
-
for (const name_value& nv: rps)
{
- if (nv.value && !printable (*nv.value))
+ if (nv.value && !utf8 (*nv.value, codepoint_types::graphic, U"\r\n\t"))
return respond_manifest (400, "invalid parameter " + nv.name);
}