leefp has asked for the wisdom of the Perl Monks concerning the following question:

Having an issue talking to an IPv6 addr. What is the equivalent in LWP::UserAgent of globoff (-g)?

I have a curl command which works fine; but the equivalent LWP calls hangs for a while, and then returns a http 500. The only difference I can see if the '-g' argument. I'm using an insecure connection on both.

curl --user root:root -H "Content-Type: application/json" -k -g -X GET + https://[2620:0:170:8daf::18]:443/api/rest/foobar/ linx4:/root *)$ curl --help | grep glob -g, --globoff Disable URL sequences and ranges using {} and [] linux4:/root *)$

Replies are listed 'Best First'.
Re: LWP::Useragent and globbing?
by Anonymous Monk on Feb 01, 2019 at 04:21 UTC

    LWP::UserAgen depends on Net::HTTP. From the doc of the latter ...

    Net::HTTP is a sub-class of one of IO::Socket::IP (IPv6+IPv4), IO::Socket::INET6 (IPv6+IPv4), or IO::Socket::INET (IPv4 only).

    Do you have IO::Socket::IP or IO::Socket::INET6 installed to handle IPv6 addresses?

      I'm using these two...and I can talk to some IPv6 systems perfectly fine (like vCenters).
      use IO::Socket::SSL qw( SSL_VERIFY_NONE ); use IO::Socket::INET;
      And later in the code...
      my $ua = LWP::UserAgent->new(); $ua->ssl_opts( SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE, SS +L_hostname => '', verify_hostname => 0 );
Re: LWP::Useragent and globbing?
by noxxi (Pilgrim) on Feb 02, 2019 at 17:54 UTC

    > What is the equivalent in LWP::UserAgent of globoff (-g)?

    There is no equivalent. LWP is not interpreting the URL in some special way like curl does so it does not need to have some way to switch this special interpretation off. Your problem must be something different.
    I rather suspect that the main difference is the use of -k in curl which disables the certificate validation. While you say that you are using an insecure connection with both you don't say how you are doing this with LWP so it might be done wrong there (verify_hostname => 0 might not be sufficient). Likely the certificate returned by the server does not match the URL (i.e. the IPv6 address in it) at all and using curl without -k will likely fail too.
    To get more information I recommend to run your program with SSL debugging, i.e. perl -MIO::Socket::SSL=debug4 program.pl.