http://qs321.pair.com?node_id=179945


in reply to HTTP::Daemon and SSL

Okay, while I may not be able to give you a complete solution with tested code, I should be able to help you out, having worked on a similar project previously.

The CONNECT method which you are receiving from HTTP clients is documented in RFC2616, as the means by which SSL connections are tunneled through HTTP connections. This method is sent by a HTTP client to a proxy server, followed by the destination host and destination port number - For example:

CONNECT ssl.webserver.com:443 HTTP/1.0

At this point, the HTTP proxy should initiate a connection to the designated port on the destination host and, if successful, return a 200 HTTP success code. The secure communication can then take place over the established connection.

With regard to making all this happen in your code, there is a patch available for the HTTP::Daemon module within the IO::Socket::SSL module which changes the inheritance of HTTP::Daemon to make use of IO::Socket::SSL in place of IO::Socket. Also too, if you have no luck with this, there are a couple of other patches for HTTP::Daemon which I can seen that are designed to achieve your goal and can also post these if required.

From IO-Socket-SSL-0.81\diffs\libwww-perl\HTTP_Daemon.pm.diff ...

*** /usr/local/perl5.005_03/lib/site_perl/5.005/HTTP/Daemon.pm.orig + Wed Jun 9 19:41:53 1999 --- /usr/local/perl5.005_03/lib/site_perl/5.005/HTTP/Daemon.pm Wed +Jun 9 19:42:43 1999 *************** *** 63,69 **** $VERSION = sprintf("%d.%02d", q$Revision: 1.21 $ =~ /(\d+)\.(\d+)/); use IO::Socket (); ! @ISA=qw(IO::Socket::INET); $PROTO = "HTTP/1.1"; --- 63,71 ---- $VERSION = sprintf("%d.%02d", q$Revision: 1.21 $ =~ /(\d+)\.(\d+)/); use IO::Socket (); ! use IO::Socket::SSL; ! #@ISA=qw(IO::Socket::INET); ! @ISA=qw(IO::Socket::SSL); $PROTO = "HTTP/1.1"; *************** *** 156,162 **** use vars qw(@ISA $DEBUG); use IO::Socket (); ! @ISA=qw(IO::Socket::INET); *DEBUG = \$HTTP::Daemon::DEBUG; use HTTP::Request (); --- 158,165 ---- use vars qw(@ISA $DEBUG); use IO::Socket (); ! #@ISA=qw(IO::Socket::INET); ! @ISA=qw(IO::Socket::SSL); *DEBUG = \$HTTP::Daemon::DEBUG; use HTTP::Request ();

Also see the demo file from the IO::Socket::SSL distribution, IO-Socket-SSL-0.81\demo\daemon.pl, which makes use of HTTP::Daemon in this fashion.

Good luck!