p5-IO-Socket-SSL message

classic Classic list List threaded Threaded
5 messages Options
db
Reply | Threaded
Open this post in threaded view
|

p5-IO-Socket-SSL message

db
On:
OpenBSD 6.4-current (GENERIC.MP) #493: Wed Dec  5 22:00:48 MST 2018
     [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC.MP


with this packages installed:
p5-Net-SSLeay-1.85p1.tgz                           07-Dec-2018 13:47    
            323994
p5-IO-Socket-SSL-2.060.tgz                         07-Dec-2018 13:47    
            183608


When using following perl code (connecting to a https location):

use HTTP::Tiny;
my $ua = HTTP::Tiny->new( agent => $UA );
my $response = $ua->get($BASE_URL);


I'm getting this message:
Your vendor has not defined SSLeay macro TLS1_3_VERSION at  
/usr/local/libdata/perl5/site_perl/IO/Socket/SSL.pm line 104.



Reply | Threaded
Open this post in threaded view
|

Re: p5-IO-Socket-SSL message

Alexander Bluhm
On Mon, Dec 10, 2018 at 08:00:16PM +0100, [hidden email] wrote:
> use HTTP::Tiny;
> my $ua = HTTP::Tiny->new( agent => $UA );
> my $response = $ua->get($BASE_URL);

Is this your complete Perl program?  Or just an excerpt?  Can you
provide a minimal program that triggers the bug.  Obviously in your
example $UA and $BASE_URL are undefined.

I get this error:

Use of uninitialized value $url in pattern match (m//) at /usr/libdata/perl5/HTTP/Tiny.pm line 836.
Use of uninitialized value $url in concatenation (.) or string at /usr/libdata/perl5/HTTP/Tiny.pm line 836.

> I'm getting this message:
> Your vendor has not defined SSLeay macro TLS1_3_VERSION at  
> /usr/local/libdata/perl5/site_perl/IO/Socket/SSL.pm line 104.

Do you have code like this somewhere in your program?

$SIG{__DIE__} = sub {warn @_}

I don't think your problem is OpenBSD specific.  But on systems
with OpenSSL 1.1 it cannot happen.

bluhm

db
Reply | Threaded
Open this post in threaded view
|

Re: p5-IO-Socket-SSL message

db
Thank you very much!
Certainly $SIG{__DIE__} = sub {warn @_} makes the difference.
Even you helped me already, if you could give me a clue to investigate  
further the
interference of $SIG{__DIE__} = ...


Following two test programs. First one with SIG handler, second one,  
without SIG handler.

With this program I get the reported message:
#!/usr/bin/perl -w

use strict;
use Cwd qw( abs_path );

my $CW_DIR = abs_path;
my $BASE_URL = 'https://www.openbsd.org/';

my $UA = "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:60.0)  
Gecko/20100101 Firefox/60.0";

local $SIG{ __DIE__ } = sub {  ## Whenever die, restore cwd
   my $message = shift;
   warn $message;
   chdir( $CW_DIR ) or warn "Couldn't change to directory ", $CW_DIR, ": $!";
   exit 1;
};

base_get();

sub base_get {
   use HTTP::Tiny;

   my $ua = HTTP::Tiny->new( agent => $UA );
   my $response = $ua->get($BASE_URL);

   die "Failed getting web page!" unless $response->{success};

   print "$response->{status} $response->{reason}\n";

   if ( $response->{success} and length $response->{content} ) {
     print "Web page size: ", length $response->{content}, "\n";
     my $content_page = $response->{content};
   } else {
     warn "No content!\n";
   }
}

With this program everything is ok (no message):
#!/usr/bin/perl -w

use strict;
use Cwd qw( abs_path );

my $CW_DIR = abs_path;
my $BASE_URL = 'https://www.openbsd.org/';

my $UA = "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:60.0)  
Gecko/20100101 Firefox/60.0";

base_get();

sub base_get {
   use HTTP::Tiny;

   my $ua = HTTP::Tiny->new( agent => $UA );
   my $response = $ua->get($BASE_URL);

   die "Failed getting web page!" unless $response->{success};

   print "$response->{status} $response->{reason}\n";

   if ( $response->{success} and length $response->{content} ) {
     print "Web page size: ", length $response->{content}, "\n";
     my $content_page = $response->{content};
   } else {
     warn "No content!\n";
   }
}


Thanks and greetings!
Daniel

Quoting Alexander Bluhm <[hidden email]>:

> On Mon, Dec 10, 2018 at 08:00:16PM +0100, [hidden email] wrote:
>> use HTTP::Tiny;
>> my $ua = HTTP::Tiny->new( agent => $UA );
>> my $response = $ua->get($BASE_URL);
>
> Is this your complete Perl program?  Or just an excerpt?  Can you
> provide a minimal program that triggers the bug.  Obviously in your
> example $UA and $BASE_URL are undefined.
>
> I get this error:
>
> Use of uninitialized value $url in pattern match (m//) at  
> /usr/libdata/perl5/HTTP/Tiny.pm line 836.
> Use of uninitialized value $url in concatenation (.) or string at  
> /usr/libdata/perl5/HTTP/Tiny.pm line 836.
>
>> I'm getting this message:
>> Your vendor has not defined SSLeay macro TLS1_3_VERSION at
>> /usr/local/libdata/perl5/site_perl/IO/Socket/SSL.pm line 104.
>
> Do you have code like this somewhere in your program?
>
> $SIG{__DIE__} = sub {warn @_}
>
> I don't think your problem is OpenBSD specific.  But on systems
> with OpenSSL 1.1 it cannot happen.
>
> bluhm



Reply | Threaded
Open this post in threaded view
|

Re: p5-IO-Socket-SSL message

Alexander Bluhm
On Wed, Dec 12, 2018 at 05:40:44PM +0100, [hidden email] wrote:
> Thank you very much!
> Certainly $SIG{__DIE__} = sub {warn @_} makes the difference.
> Even you helped me already, if you could give me a clue to investigate  
> further the
> interference of $SIG{__DIE__} = ...

/usr/local/libdata/perl5/site_perl/IO/Socket/SSL.pm line 104
    and my $tls13 = eval { Net::SSLeay::TLS1_3_VERSION() }

IO::Socket::SSL detects TLS 1.3 support.

Net::SSLeay::TLS1_3_VERSION() dies, but it is catched with an eval.
This does not work well together with $SIG{__DIE__}.

Either complain at IO::Socket::SSL maintainer or at whoever put the
die handler into your program.  Die and eval is a common Perl idiom,
so I would blame the handler for the failure.  You cannot use that
safely with generic modules.  Signal handlers are global so you
have to be careful that they do not interfere with anything you
use.

This is not an OpenBSD ports bug.

bluhm

db
Reply | Threaded
Open this post in threaded view
|

Re: p5-IO-Socket-SSL message

db
Thanks!!


Quoting Alexander Bluhm <[hidden email]>:

> On Wed, Dec 12, 2018 at 05:40:44PM +0100, [hidden email] wrote:
>> Thank you very much!
>> Certainly $SIG{__DIE__} = sub {warn @_} makes the difference.
>> Even you helped me already, if you could give me a clue to investigate
>> further the
>> interference of $SIG{__DIE__} = ...
>
> /usr/local/libdata/perl5/site_perl/IO/Socket/SSL.pm line 104
>     and my $tls13 = eval { Net::SSLeay::TLS1_3_VERSION() }
>
> IO::Socket::SSL detects TLS 1.3 support.
>
> Net::SSLeay::TLS1_3_VERSION() dies, but it is catched with an eval.
> This does not work well together with $SIG{__DIE__}.
>
> Either complain at IO::Socket::SSL maintainer or at whoever put the
> die handler into your program.  Die and eval is a common Perl idiom,
> so I would blame the handler for the failure.  You cannot use that
> safely with generic modules.  Signal handlers are global so you
> have to be careful that they do not interfere with anything you
> use.
>
> This is not an OpenBSD ports bug.
>
> bluhm