aboutsummaryrefslogtreecommitdiff
path: root/libbbot/manifest.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2023-04-27 20:34:44 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2023-05-17 19:04:57 +0300
commit6679ad0de1fddc9f78087aaa67432f3d48ce08b4 (patch)
tree9b7f0a3f4d0d34285870c6d16b6d7db6f8909ecf /libbbot/manifest.cxx
parent29aed111bc9833010993ddc36393a69366936635 (diff)
Add support for *-upload-url task response manifest values
Diffstat (limited to 'libbbot/manifest.cxx')
-rw-r--r--libbbot/manifest.cxx28
1 files changed, 26 insertions, 2 deletions
diff --git a/libbbot/manifest.cxx b/libbbot/manifest.cxx
index 7412e74..be642a0 100644
--- a/libbbot/manifest.cxx
+++ b/libbbot/manifest.cxx
@@ -12,6 +12,7 @@
#include <cstddef> // size_t
#include <utility> // move()
#include <cstdint> // uint64_t
+#include <algorithm> // find_if()
#include <stdexcept> // invalid_argument
#include <libbutl/regex.hxx>
@@ -955,6 +956,23 @@ namespace bbot
result_url = move (v);
}
+ else if (n.size () > 11 &&
+ n.compare (n.size () - 11, 11, "-upload-url") == 0)
+ {
+ n.resize (n.size () - 11);
+
+ if (find_if (upload_urls.begin (), upload_urls.end (),
+ [&n] (const upload_url& u) {return u.type == n;}) !=
+ upload_urls.end ())
+ {
+ bad_name ("task response upload url redefinition");
+ }
+
+ if (v.empty ())
+ bad_value ("empty task response upload url");
+
+ upload_urls.emplace_back (move (v), move (n));
+ }
else if (n == "agent-checksum")
{
if (agent_checksum)
@@ -993,12 +1011,15 @@ namespace bbot
if (result_url)
bad_value ("unexpected task response result url");
+ if (!upload_urls.empty ())
+ bad_value ("unexpected task response upload url");
+
if (agent_checksum)
bad_value ("unexpected task response agent checksum");
}
- // If session is not empty then the task manifest must follow, otherwise it
- // shouldn't.
+ // If session is not empty then the task manifest must follow, otherwise
+ // it shouldn't.
//
nv = p.next ();
@@ -1034,6 +1055,9 @@ namespace bbot
if (result_url)
s.next ("result-url", *result_url);
+ for (const upload_url& u: upload_urls)
+ s.next (u.type + "-upload-url", u.url);
+
if (agent_checksum)
s.next ("agent-checksum", *agent_checksum);