Skip to content

Commit 30eac77

Browse files
committed
Fix MistOutTSRIST output argument handling
1 parent ef81b94 commit 30eac77

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

src/output/output_tsrist.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ uint64_t upBytes = 0;
1515

1616
namespace Mist{
1717

18+
std::set<std::string> ristOpts;
1819

1920
struct rist_logging_settings log_settings;
2021
int rist_log_callback(void *, enum rist_log_level llvl, const char *msg){
@@ -47,20 +48,23 @@ namespace Mist{
4748
}
4849

4950
static void addIntOpt(JSON::Value & pp, const std::string & param, const std::string & name, const std::string & help, size_t def = 0){
51+
ristOpts.insert(param);
5052
pp[param]["name"] = name;
5153
pp[param]["help"] = help;
5254
pp[param]["type"] = "int";
5355
pp[param]["default"] = (uint64_t)def;
5456
}
5557

5658
static void addStrOpt(JSON::Value & pp, const std::string & param, const std::string & name, const std::string & help, const std::string & def = ""){
59+
ristOpts.insert(param);
5760
pp[param]["name"] = name;
5861
pp[param]["help"] = help;
5962
pp[param]["type"] = "str";
6063
pp[param]["default"] = def;
6164
}
6265

6366
static void addBoolOpt(JSON::Value & pp, const std::string & param, const std::string & name, const std::string & help, bool def = false){
67+
ristOpts.insert(param);
6468
pp[param]["name"] = name;
6569
pp[param]["help"] = help;
6670
pp[param]["type"] = "select";
@@ -90,12 +94,20 @@ namespace Mist{
9094
std::string extraParams = ristURL.substr(ristURL.rfind('?')+1);
9195
std::map<std::string, std::string> arguments;
9296
HTTP::parseVars(extraParams, arguments);
93-
for (std::map<std::string, std::string>::iterator it = arguments.begin(); it != arguments.end(); ++it){
94-
targetParams[it->first] = it->second;
95-
}
97+
for (auto & it : arguments) { targetParams[it.first] = it.second; }
9698
ristURL.erase(ristURL.rfind('?'));
9799
}
98100
target = HTTP::URL(ristURL);
101+
{
102+
// Restore all arguments from targetParams
103+
std::map<std::string, std::string> arguments;
104+
HTTP::parseVars(target.args, arguments);
105+
for (auto & it : targetParams) {
106+
if (ristOpts.count(it.first)) { arguments[it.first] = it.second; }
107+
}
108+
target.args = HTTP::argStr(arguments, false);
109+
ristURL = target.getUrl();
110+
}
99111
if (target.protocol != "rist"){
100112
FAIL_MSG("Target %s must begin with rist://, aborting", target.getUrl().c_str());
101113
onFail("Invalid RIST target: doesn't start with rist://", true);

0 commit comments

Comments
 (0)