OctoPrint upload: ignore certificate revocation checks
Fixes Hostname incorrect While test is positive (Bonjour discovery not supported for the address field) #1781 (partial fix of #1781)
This commit is contained in:
parent
0b654e1518
commit
6b03b66167
7 changed files with 35 additions and 3 deletions
|
@ -1442,7 +1442,8 @@ const std::vector<std::string>& PhysicalPrinter::printer_options()
|
|||
"printhost_authorization_type",
|
||||
// HTTP digest authentization (RFC 2617)
|
||||
"printhost_user",
|
||||
"printhost_password"
|
||||
"printhost_password",
|
||||
"printhost_ignore_check"
|
||||
};
|
||||
}
|
||||
return s_opts;
|
||||
|
|
|
@ -310,6 +310,12 @@ void PrintConfigDef::init_common_params()
|
|||
// def->tooltip = L("");
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionString(""));
|
||||
|
||||
def = this->add("printhost_ignore_check", coBool);
|
||||
def->label = L("Ignore certificate revocation checks");
|
||||
// def->tooltip = L("");
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionBool(false));
|
||||
|
||||
def = this->add("preset_names", coStrings);
|
||||
def->label = L("Printer preset names");
|
||||
|
|
|
@ -396,6 +396,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
|
|||
m_optgroup->append_line(cafile_hint);
|
||||
}
|
||||
else {
|
||||
|
||||
Line line{ "", "" };
|
||||
line.full_width = 1;
|
||||
|
||||
|
@ -411,8 +412,14 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
|
|||
sizer->Add(txt, 1, wxEXPAND);
|
||||
return sizer;
|
||||
};
|
||||
|
||||
m_optgroup->append_line(line);
|
||||
|
||||
#ifdef WIN32
|
||||
option = m_optgroup->get_option("printhost_ignore_check");
|
||||
option.opt.width = Field::def_width_wider();
|
||||
m_optgroup->append_single_option_line(option);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
for (const std::string& opt_key : std::vector<std::string>{ "printhost_user", "printhost_password" }) {
|
||||
|
|
|
@ -491,6 +491,14 @@ Http& Http::form_add_file(const std::string &name, const fs::path &path, const s
|
|||
return *this;
|
||||
}
|
||||
|
||||
Http& Http::revoke_best_effort(bool set)
|
||||
{
|
||||
if(p && set){
|
||||
::curl_easy_setopt(p->curl, CURLOPT_SSL_OPTIONS, CURLSSLOPT_REVOKE_BEST_EFFORT);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
Http& Http::set_post_body(const fs::path &path)
|
||||
{
|
||||
if (p) { p->set_post_body(path);}
|
||||
|
|
|
@ -80,6 +80,8 @@ public:
|
|||
// Same as above except also override the file's filename with a custom one
|
||||
Http& form_add_file(const std::string &name, const boost::filesystem::path &path, const std::string &filename);
|
||||
|
||||
Http& revoke_best_effort(bool set);
|
||||
|
||||
// Set the file contents as a POST request body.
|
||||
// The data is used verbatim, it is not additionally encoded in any way.
|
||||
// This can be used for hosts which do not support multipart requests.
|
||||
|
|
|
@ -25,7 +25,8 @@ namespace Slic3r {
|
|||
OctoPrint::OctoPrint(DynamicPrintConfig *config) :
|
||||
host(config->opt_string("print_host")),
|
||||
apikey(config->opt_string("printhost_apikey")),
|
||||
cafile(config->opt_string("printhost_cafile"))
|
||||
cafile(config->opt_string("printhost_cafile")),
|
||||
ignore_checks(config->opt_bool("printhost_ignore_check"))
|
||||
{}
|
||||
|
||||
const char* OctoPrint::get_name() const { return "OctoPrint"; }
|
||||
|
@ -73,6 +74,9 @@ bool OctoPrint::test(wxString &msg) const
|
|||
msg = "Could not parse server response";
|
||||
}
|
||||
})
|
||||
#ifdef WIN32
|
||||
.revoke_best_effort(ignore_checks)
|
||||
#endif
|
||||
.perform_sync();
|
||||
|
||||
return res;
|
||||
|
@ -137,6 +141,9 @@ bool OctoPrint::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, Erro
|
|||
res = false;
|
||||
}
|
||||
})
|
||||
#ifdef WIN32
|
||||
.revoke_best_effort(ignore_checks)
|
||||
#endif
|
||||
.perform_sync();
|
||||
|
||||
return res;
|
||||
|
|
|
@ -40,6 +40,7 @@ private:
|
|||
std::string host;
|
||||
std::string apikey;
|
||||
std::string cafile;
|
||||
bool ignore_checks;
|
||||
|
||||
virtual void set_auth(Http &http) const;
|
||||
std::string make_url(const std::string &path) const;
|
||||
|
|
Loading…
Reference in a new issue