I'd like to see this patch added so that HTTP::Daemon::SSL can more 
cleanly overload the "url" function without having to totally reimplement 
it.

Also, could HTTP::Daemon::SSL be made part of the libwww bundle?

Thanks!

-- 
Kees Cook
Open Source Development Lab
[EMAIL PROTECTED]
diff -buNr libwww-perl-5.802/lib/HTTP/Daemon.pm 
libwww-perl-5.802-kees/lib/HTTP/Daemon.pm
--- libwww-perl-5.802/lib/HTTP/Daemon.pm        2004-04-09 13:21:43.000000000 
-0700
+++ libwww-perl-5.802-kees/lib/HTTP/Daemon.pm   2004-12-10 10:13:30.000000000 
-0800
@@ -37,10 +37,22 @@
 }
 
 
+sub _default_port {
+    443;
+}
+
+
+sub _default_scheme {
+    "https";
+}
+
+
+# Implemented with calls to "_default_port" and "_default_scheme" so that
+# HTTP::Daemon::SSL can overload them and still use this function.
 sub url
 {
     my $self = shift;
-    my $url = "http://";;
+    my $url = $self->_default_scheme()."://";
     my $addr = $self->sockaddr;
     if (!$addr || $addr eq INADDR_ANY) {
        require Sys::Hostname;
@@ -50,7 +62,7 @@
        $url .= gethostbyaddr($addr, AF_INET) || inet_ntoa($addr);
     }
     my $port = $self->sockport;
-    $url .= ":$port" if $port != 80;
+    $url .= ":$port" if $port != $self->_default_port();
     $url .= "/";
     $url;
 }

Reply via email to