[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Omaha.pm] IO::Multiplex + IO::Socket::SSL ?
Hi Rob, Steffen --
I am wondering if anyone has had success using IO::Socket::SSL and
IO::Multiplex together?
I use the heck out of IO::Multiplex with IO::Socket::INET, and it works
great.
In IO::Socket::SSL, I got example/ssl_server.pl working great.
But I can't seem to get IO::Socket::SSL to work correctly inside the
IO::Multiplex listen() framework.
I'm running the current versions of everything (err... except perl
itself), per the bottom of this email. But it seems no matter what
combination of options I do or don't pass into IO::Socket::SSL->new() I
never get a functional $$input. mux_input() is firing, so that's good, so
I'm wondering if I'm just missing something really simple?
IO::Multiplex /Changes mentions IO::Socket::SSL... so it does work?
Thanks for your help!!
j
# --------------------------------------------
# The source code of my program...
# --------------------------------------------
$ cat j.pl
use IO::Socket::INET;
use IO::Socket::SSL qw( debug4 );
use IO::Multiplex;
use FileHandle;
STDOUT->autoflush();
my $mux = new IO::Multiplex;
my $sock = IO::Socket::INET->new(
Listen => 100,
LocalAddr => '10.0.33.98',
LocalPort => 9000,
Proto => 'tcp',
);
my $sock_ssl = IO::Socket::SSL->new(
Listen => 100,
LocalAddr => '10.0.33.98',
LocalPort => 9001,
Proto => 'tcp',
Reuse => 1,
SSL_verify_mode => 0x01,
SSL_passwd_cb => sub {return "bluebell"},
SSL_use_cert => 1,
# core.pm has both the private key and the cert file in it...
SSL_ca_file => '/home/jhannah/src/Omni/MVC/Control/Multiplex/Buffer/TCP/ca.pem',
SSL_key_file => '/home/jhannah/src/Omni/MVC/Control/Multiplex/Buffer/TCP/core.pem',
SSL_cert_file => '/home/jhannah/src/Omni/MVC/Control/Multiplex/Buffer/TCP/core.pem',
);
$mux->listen($sock);
$mux->listen($sock_ssl);
$mux->set_callback_object(__PACKAGE__);
$mux->loop;
sub mux_input {
my ($self, $mux, $fh, $input) = @_;
print "mux_input:\n-------------------------\n$$input\n---------------------\n";
print $fh "Hello, Firefox!\n";
#$$input = ''; # Explodes when using IO::Socket::SSL
close $fh;
}
# --------------------------------------------
When the program is running and I hit
http://10.0.33.98:9000/ (IO::Socket::INET)
it works fine (with warnings). I see all the client headers in mux_input. But when I hit
https://10.0.33.98:9001/ (IO::Socket::SSL)
all I get in mux_input is a bunch of binary garbledy gook, below.
(If I don't try to use IO::Socket::SSL at all there are no warnings.)
$ perl j.pl
Undefined SSL object
at /usr/lib/perl5/site_perl/5.8.7/IO/Multiplex.pm line 577
Undefined SSL object
at /usr/lib/perl5/site_perl/5.8.7/IO/Multiplex.pm line 577
mux_input:
-------------------------
GET / HTTP/1.1
Host: razorbill.omnihotels.com:9000
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.5) Gecko/20070713 Firefox/2.0.0.5
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
---------------------
Undefined SSL object
at /usr/lib/perl5/site_perl/5.8.7/IO/Multiplex.pm line 577
Undefined SSL object
at /usr/lib/perl5/site_perl/5.8.7/IO/Multiplex.pm line 577
Undefined SSL object
at /usr/lib/perl5/site_perl/5.8.7/IO/Multiplex.pm line 577
Undefined SSL object
at /usr/lib/perl5/site_perl/5.8.7/IO/Multiplex.pm line 577
mux_input:
-------------------------
?V????h9?1G??!? *C]Wl5I]??H ?N?0?T???k6??mc??
????`??ޗo?牃?]??=?͗6???t=?6?U?|i?ݘ?}?\1k%?<?????P???D????7W?O?d????r???(?#??e⛅??aQU????+&̀b?5Q?}???i????7?E?&??v[ƞ??????V??ū*,?B?E????N>ȫ?C???=s??5??:??^??S????8????;?$ˋ288Z?u??-r{r??YV??(?4??j???)?r
???7%?v ???r?M ?8bl???X??&S???(d){4.8b???B???|xYv?R
Q???f"?r$ ga???K['!???=s??I|/??%????k??q4)???
?
---------------------
Undefined SSL object
at /usr/lib/perl5/site_perl/5.8.7/IO/Multiplex.pm line 577
Undefined SSL object
at /usr/lib/perl5/site_perl/5.8.7/IO/Multiplex.pm line 577
Undefined SSL object
at /usr/lib/perl5/site_perl/5.8.7/IO/Multiplex.pm line 577
$ perl -MIO::Socket::SSL -e 'print $IO::Socket::SSL::VERSION'
0.97
$ perl -MIO::Multiplex -e 'print $IO::Multiplex::VERSION'
1.09
$ perl -MNet::SSLeay -e 'print $Net::SSLeay::VERSION'
1.30
$ perl -v
This is perl, v5.8.7 built for i686-linux
I re-built Net::SSLeay to make sure it's using the very latest OpenSSL:
$ perl Makefile.PL
Checking for OpenSSL-0.9.6j or 0.9.7b or newer...
You have OpenSSL-0.9.8e installed in /usr/local/ssl
That's is newer than what this module was tested with (0.9.6j
or 0.9.7b). You should
consider checking if there is a newer release of this module
available. Everything will probably work OK, though.