diff --git a/Build.PL b/Build.PL index 2dd18435a5..457df08420 100755 --- a/Build.PL +++ b/Build.PL @@ -48,7 +48,9 @@ if ($gui) { Wx::GLCanvas 0 OpenGL 0 LWP::UserAgent 0 + Bundle::LWP 0 Net::Bonjour 0 + Net::SSL 0 ); if ($^O eq 'MSWin32') { $recommends{"Win32::TieRegistry"} = 0; diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index 1218a25b4e..2096954831 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -33,6 +33,10 @@ use Wx::Event qw(EVT_BUTTON EVT_COMMAND EVT_KEY_DOWN EVT_MOUSE_EVENTS EVT_PAINT use base qw(Wx::Panel Class::Accessor); use Slic3r::GUI::ColorScheme; +use Net::SSL; +$ENV{HTTPS_VERSION} = 3; +$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0; + __PACKAGE__->mk_accessors(qw(presets)); use constant TB_ADD => &Wx::NewId; @@ -2345,13 +2349,21 @@ sub prepare_send { "Checking whether file already exists…", 100, $self, 0); $progress->Pulse; + my $host; + if ($self->{config}->print_host !~ /^http/) { + $host = "http://" . $self->{config}->print_host; + } + else { + $host = $self->{config}->print_host; + } + my $ua = LWP::UserAgent->new; $ua->timeout(5); my $res; if ($self->{config}->print_host) { if($self->{config}->host_type eq 'octoprint'){ $res = $ua->get( - "http://" . $self->{config}->print_host . "/api/files/local", + $host . "/api/files/local", 'X-Api-Key' => $self->{config}->octoprint_apikey, ); }else { @@ -2395,9 +2407,16 @@ sub send_gcode { my $filename = basename($self->{print}->output_filepath($main::opt{output} // '')); my $res; if($self->{config}->print_host){ + my $host; + if ($self->{config}->print_host !~ /^http/) { + $host = "http://" . $self->{config}->print_host; + } + else { + $host = $self->{config}->print_host; + } if($self->{config}->host_type eq 'octoprint'){ $res = $ua->post( - "http://" . $self->{config}->print_host . "/api/files/local", + $host . "/api/files/local", Content_Type => 'form-data', 'X-Api-Key' => $self->{config}->octoprint_apikey, Content => [ diff --git a/lib/Slic3r/GUI/PresetEditor.pm b/lib/Slic3r/GUI/PresetEditor.pm index 8dd307e808..c9306ac12d 100644 --- a/lib/Slic3r/GUI/PresetEditor.pm +++ b/lib/Slic3r/GUI/PresetEditor.pm @@ -9,6 +9,9 @@ use Wx qw(:bookctrl :dialog :keycode :icon :id :misc :panel :sizer :treectrl :wi :button wxTheApp); use Wx::Event qw(EVT_BUTTON EVT_CHOICE EVT_KEY_DOWN EVT_TREE_SEL_CHANGED EVT_CHECKBOX); use base qw(Wx::Panel Class::Accessor); +use Net::SSL; +$ENV{HTTPS_VERSION} = 3; +$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0; __PACKAGE__->mk_accessors(qw(current_preset config)); @@ -1387,9 +1390,15 @@ sub build { $host_line->append_button("Test", "wrench.png", sub { my $ua = LWP::UserAgent->new; $ua->timeout(10); - + my $host; + if ($self->{config}->print_host !~ /^http/) { + $host = "http://" . $self->{config}->print_host; + } + else { + $host = $self->{config}->print_host; + } my $res = $ua->get( - "http://" . $self->config->print_host . "/api/version", + $host . "/api/version", 'X-Api-Key' => $self->config->octoprint_apikey, ); if ($res->is_success) { diff --git a/package/win/package_win32.ps1 b/package/win/package_win32.ps1 index c6a5e1ce8e..df85e6172c 100644 --- a/package/win/package_win32.ps1 +++ b/package/win/package_win32.ps1 @@ -121,6 +121,7 @@ pp ` -a "${STRAWBERRY_PATH}\c\bin\${glut};${glut}" ` -M AutoLoader ` -M B ` +-M Bundle::LWP ` -M Carp ` -M Class::Accessor ` -M Config ` @@ -161,6 +162,7 @@ pp ` -M LWP::Protocol ` -M LWP::Protocol::http ` -M LWP::UserAgent ` +-M Net::SSL ` -M List::Util ` -M Math::Trig ` -M Method::Generate::Accessor `