Subject: | HTTP::Daemon should support HTTPS |
As per title.
See attached diff.
cd ~/.cpan/build/libwww-perl-5.69/
diff -u /home/mah/.cpan/build/libwww-perl-5.69/lib/HTTP/Daemon.pm\~ /home/mah/.cpan/build/libwww-perl-5.69/lib/HTTP/Daemon.pm
--- /home/mah/.cpan/build/libwww-perl-5.69/lib/HTTP/Daemon.pm~ 2002-08-17 22:23:43.000000000 -0500
+++ /home/mah/.cpan/build/libwww-perl-5.69/lib/HTTP/Daemon.pm 2003-03-06 13:54:35.000000000 -0600
@@ -86,14 +86,26 @@
=cut
+{ my $do_ssl = undef;
+
+sub is_ssl { $do_ssl };
+
sub new
{
my($class, %args) = @_;
$args{Listen} ||= 5;
$args{Proto} ||= 'tcp';
+
+ if($args{SSL}) {
+ $do_ssl = 1;
+ eval "use IO::Socket::SSL";
+ @ISA = qw(IO::Socket::SSL);
+ delete $args{SSL};
+ }
+
return $class->SUPER::new(%args);
}
-
+}
=item $c = $d->accept([$pkg])
@@ -132,7 +144,7 @@
sub url
{
my $self = shift;
- my $url = "http://";
+ my $url = $self->is_ssl ? "https://" : "http://";
my $addr = $self->sockaddr;
if (!$addr || $addr eq INADDR_ANY) {
require Sys::Hostname;
Diff finished at Thu Mar 6 13:55:08