Here is a simple perl program using LWP::UserAgent and threads, that succeeds with http, but segfaults with https. Tried on RH9 and Fedora FC2, both with up to date patches. Can anyone tell me what's happening here?
Try running this code as
perl program.pl 'http://www.yahoo.com'
and it reports success. But, if you run
perl program.pl 'https://www.yahoo.com'
we get a segfault.
Here's the smallest program we could make that shows this problem. Thanks in advance...
use strict;
use threads;
use LWP;
my $uri;
if (@ARGV > 0) {
$uri = shift;
}
my $ua = LWP::UserAgent->new() or die "Can't create ua\n";
if (defined $uri) {
print "uri: $uri\n";
my $r = $ua->get($uri);
if (not $r->is_success()) {
print "GET error on <$uri>...\n" . $r->error_as_HTML() . "\n";
exit(1);
}
}
my $t = threads->new(\&threadedRequestThread)
or die "Can't create thread\n";
print "Joining thread\n";
my @ret = $t->join();
print "Thread returned (@ret)\n";
exit(0);
# Actual Thread function
sub threadedRequestThread {
print "Inside threadedRequestThread\n";
return "A list of words";
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.