Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

How to debug failure in HTTP::Daemon::SSL->new()

by jonadab (Parson)
on Apr 25, 2014 at 20:55 UTC ( #1083858=perlquestion: print w/replies, xml ) Need Help??

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

$d = HTTP::Daemon::SSL->new( LocalPort => $bkportnum, LocalAddr => '', ) or carp("Unable to create new HTTP::Daemon::SSL object" . Dumper(+{ port => $bkportnum, strbang => $!, SSL_ERROR => $SSL_ERROR, retval => $d, strat => $@, }) . ".");

This used to work just fine. Then it stopped working, and there's no error message. $! and $@ are both empty strings, and $d and $SSL_ERROR are both undef.

Is there a good way to debug something like this, other than by ripping out HTTP::Daemon::SSL and replacing it with an entirely different module?

And if I did want to replace it with a different module (say, with one that produces error messages when appropriate), does anybody have a recommendation?

Update: I ended up throwing the whole thing out and using Net::OpenSSH instead, making the problem moot and also nicely circumventing the need to listen on an extra port into the bargain.

Replies are listed 'Best First'.
Re: How to debug failure in HTTP::Daemon::SSL->new()
by zentara (Archbishop) on Apr 26, 2014 at 14:48 UTC
    I have seen this old tip.
    #!/usr/bin/perl #The trick here is simply to dynamically change the #inheritance of HTTP::Daemon to make it an heir #of IO::Socket::SSL instead of IO::Socket::INET use HTTP::Daemon; use IO::Socket::SSL; @HTTP::Daemon::ISA = qw/ IO::Socket::SSL /; @HTTP::Daemon::ClientConn::ISA = qw/ IO::Socket::SSL /; my $server = new HTTP::Daemon SSL_cert_file => 'cert.pem', SSL_cert_file => '', LocalPort => 443, ReuseAddr => 1, ; while ( my $client = $server->accept() ) { # do stuff ... $client->close(SSL_no_shutdown => 1); } $server->close(SSL_no_shutdown => 1);

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh
Re: How to debug failure in HTTP::Daemon::SSL->new()
by Anonymous Monk on Apr 25, 2014 at 22:24 UTC

    Just some debugging ideas:

    Then it stopped working

    What changed? I guarantee you something changed. New version of Perl, update of the module or a related module, OS updates, ...?

    You can step through the code with the debugger.

      Since we live in a completely deterministic universe, something has surely changed.

      The OP doesn't mention whether the remote server was validated. Maybe it is no longer at Maybe the server has been updated due to some enormous flaw in a widely used library. Maybe the server has a new certificate and there are trust issues. When looking for what has changed, remember that it may not be something you did.

      NB: I find it handy to leave comments in my code on how to test external resources (usually needed during development anyway). I prefer commands I can use from a shell prompt as they tend to be more stable over time (IMO).

        The OP doesn't mention whether the remote server was validated. Maybe it is no longer at

        This is the server code. (The client just uses wget.) And yes, is correct.

      I guarantee you something changed.


      Unfortunately, it was several weeks before I noticed that it had stopped working, so tracking down exactly what had changed at that precise moment is not entirely straightforward.

        Oh. Any luck with the debugger?

        HTTP::Daemon::SSL inherits its new() method pretty much directly from IO::Socket::SSL, so the problem should be coming from there. That module had a release just a few days ago, perhaps you could try pulling the latest version of that and opening a socket with that, maybe that'll get you an improvement, or at least an error message?

Re: How to debug failure in HTTP::Daemon::SSL->new()
by karlgoethebier (Abbot) on Apr 26, 2014 at 10:26 UTC

    I just guess: Everything OK with IO::Socket::SSL and and HTTP::Daemon?

    Please note also that HTTP::Daemon::SSL seems to be unmaintained for about 4 years.

    Best regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1083858]
Approved by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2023-01-27 04:32 GMT
Find Nodes?
    Voting Booth?

    No recent polls found