[Bps-public-commit] r11021 - in HTTP-Server-Simple: .

jesse at bestpractical.com jesse at bestpractical.com
Thu Mar 6 16:45:50 EST 2008


Author: jesse
Date: Thu Mar  6 16:45:49 2008
New Revision: 11021

Modified:
   HTTP-Server-Simple/   (props changed)
   HTTP-Server-Simple/lib/HTTP/Server/Simple.pm

Log:
 r28159 at 118:  jesse | 2008-03-06 16:45:37 -0500
 * Patch to describe how to add SSL support from Paul Miller


Modified: HTTP-Server-Simple/lib/HTTP/Server/Simple.pm
==============================================================================
--- HTTP-Server-Simple/lib/HTTP/Server/Simple.pm	(original)
+++ HTTP-Server-Simple/lib/HTTP/Server/Simple.pm	Thu Mar  6 16:45:49 2008
@@ -541,7 +541,23 @@
 =head2 accept_hook
 
 If defined by a sub-class, this method is called directly after an
-accept happens.
+accept happens.  An accept_hook to add SSL support might look like this:
+
+    sub accept_hook {
+        my $this = shift;
+        my $fh   = $this->stdio_handle;
+
+        my $newfh =
+        IO::Socket::SSL->start_SSL( $fh, 
+            SSL_server    => 1,
+            SSL_use_cert  => 1,
+            SSL_cert_file => 'myserver.crt',
+            SSL_key_file  => 'myserver.key',
+        )
+        or warn "problem setting up SSL socket: " . IO::Socket::SSL::errstr();
+
+        $this->stdio_handle($newfh) if $newfh;
+    }
 
 =head2 post_setup_hook
 



More information about the Bps-public-commit mailing list