diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index c0a956154d..26359b866c 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -1442,7 +1442,8 @@ const std::vector& PhysicalPrinter::printer_options() "printhost_authorization_type", // HTTP digest authentization (RFC 2617) "printhost_user", - "printhost_password" + "printhost_password", + "printhost_ignore_check" }; } return s_opts; diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index e64824d0db..dffb8ac0c2 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -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"); diff --git a/src/slic3r/GUI/PhysicalPrinterDialog.cpp b/src/slic3r/GUI/PhysicalPrinterDialog.cpp index f189378a6d..9c570172c0 100644 --- a/src/slic3r/GUI/PhysicalPrinterDialog.cpp +++ b/src/slic3r/GUI/PhysicalPrinterDialog.cpp @@ -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{ "printhost_user", "printhost_password" }) { diff --git a/src/slic3r/Utils/Http.cpp b/src/slic3r/Utils/Http.cpp index 2afb7ed504..69093988ab 100644 --- a/src/slic3r/Utils/Http.cpp +++ b/src/slic3r/Utils/Http.cpp @@ -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);} diff --git a/src/slic3r/Utils/Http.hpp b/src/slic3r/Utils/Http.hpp index f34a27fbcc..3cce250862 100644 --- a/src/slic3r/Utils/Http.hpp +++ b/src/slic3r/Utils/Http.hpp @@ -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. diff --git a/src/slic3r/Utils/OctoPrint.cpp b/src/slic3r/Utils/OctoPrint.cpp index ee669c36fe..3a2335b1ef 100644 --- a/src/slic3r/Utils/OctoPrint.cpp +++ b/src/slic3r/Utils/OctoPrint.cpp @@ -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; diff --git a/src/slic3r/Utils/OctoPrint.hpp b/src/slic3r/Utils/OctoPrint.hpp index 62bdfb6fa1..42683dc62b 100644 --- a/src/slic3r/Utils/OctoPrint.hpp +++ b/src/slic3r/Utils/OctoPrint.hpp @@ -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;