Bad file number

Jacinta Richardson jarich at perltraining.com.au
Tue Jul 22 20:49:32 CDT 2003


G'day folks,

I was hoping I could ask for some advice.

I'm using LWP::UserAgent (with Crypt::SSLeay) to connect to a HTTPS
service.

With one set of certificates it works like a charm and there are no
problems at all.

With a recently renewed set of certificates I'm having problems.  It
doesn't even appear that the connection to being attempted, instead my
result object is coming out as follows:

res: $VAR1 = bless( {
                 '_request' => bless( {
                                        '_method' => 'POST',
                                        '_headers' => bless( {

	'user-agent' => 'libwww-perl/5.65',
	'content-type' => 'application/x-www-form-urlencoded'
                                                             },
	'HTTP::Headers' ),

                                        '_uri' => bless( do{\(my $o =
	'http://some.site.here')},
	'URI::https' ),
                                        '_content' => 'dummy_input=1'
                                      }, 'HTTP::Request' ),

                 '_headers' => bless( {
                                        'client-date' => 'Tue, 22 Jul 2003
08:49:30 GMT'
                                      }, 'HTTP::Headers' ),
                 '_msg' => 'configure certs failed: failed to load
/path/to/devel-client.key: ',
                 '_rc' => 500,
                 '_content' => ''
               }, 'HTTP::Response' );


from the code:


    # Create a user agent object
    my $ua = new LWP::UserAgent;

print STDERR "cert: [$cert]\n";
print STDERR "key: [$key]\n";
print STDERR "url: [$url], content: [$input_params]\n";
    # Create a request
    my $req = new HTTP::Request("POST", "$url");

    # This is an HTML form
    $req->content_type('application/x-www-form-urlencoded');

    # Give the request object the POSTed input
    $req->content($input_params);

print STDERR "req: " . Dumper( $req ) . "\n";
    my $res = $ua->request($req);

print STDERR "res: " . Dumper( $res ) . "\n";

    print STDERR "call forte response: " .$res->code."\n";
    print STDERR "[", $res->content(), "]", "\n";
    return $res->content();



I'm sure there must be a problem with my certificate-key pair, as I have
another certificate-key pair used by the same code that works perfectly.
What is more, if I import this certificate and key into my browser it
also works fine when connecting to the site.  This has only happened
since we've renewed the certificate.

$!, $^E are both being set to "Bad file number".
$!{EBADF} is set to "9"
$@ is not being set, although the _msg above is expecting it to have
been.

Any theories on where I start to fix this? 

	Jacinta


--
   ("`-''-/").___..--''"`-._          |  Jacinta Richardson         |
    `6_ 6  )   `-.  (     ).`-.__.`)  |  Perl Training Australia    |
    (_Y_.)'  ._   )  `._ `. ``-..-'   |      +613 9354 6001         |  
  _..`--'_..-_/  /--'_.' ,'           | contact at perltraining.com.au |
(il),-''  (li),'  ((!.-'              |   www.perltraining.com.au   |




More information about the Melbourne-pm mailing list