NAME
HTTP::Daemon::SSL - a simple http server class with SSL support
SYNOPSIS
use HTTP::Daemon::SSL;
use HTTP::Status;
my $d = HTTP::Daemon::SSL->new || die;
print "Please contact me at: <URL:", $d->url, ">\n";
while (my $c = $d->accept) {
while (my $r = $c->get_request) {
if ($r->method eq 'GET' and $r->url->path eq "/xyzzy") {
# remember, this is *not* recommened practice :-)
$c->send_file_response("/etc/passwd");
} else {
$c->send_error(RC_FORBIDDEN)
}
}
$c->close;
undef($c);
}
DESCRIPTION
Instances of the HTTP::Daemon::SSL class are HTTP/1.1 servers that listen on a socket for incoming requests. The HTTP::Daemon::SSL is a sub-class of IO::Socket::SSL, so you can perform socket operations directly on it too.
The accept() method will return when a connection from a client is available. In a scalar context the returned value will be a reference to a object of the HTTP::Daemon::ClientConn::SSL class which is another IO::Socket::SSL subclass. In a list context a two-element array is returned containing the new HTTP::Daemon::ClientConn::SSL reference and the peer address; the list will be empty upon failure. Calling the get_request() method on the HTTP::Daemon::ClientConn::SSL object will read data from the client and return an HTTP::Request object reference.
This HTTPS daemon does not fork(2) for you. Your application, i.e. the user of the HTTP::Daemon::SSL is reponsible for forking if that is desirable. Also note that the user is responsible for generating responses that conform to the HTTP/1.1 protocol. The HTTP::Daemon::ClientConn class provides some methods that make this easier.
METHODS
The following methods are the only differences from the HTTP::Daemon base class:
- $d = new HTTP::Daemon::SSL
-
The constructor takes the same parameters as the IO::Socket::SSL constructor. It can also be called without specifying any parameters. The daemon will then set up a listen queue of 5 connections and allocate some random port number. A server that wants to bind to some specific address on the standard HTTPS port will be constructed like this:
$d = new HTTP::Daemon::SSL LocalAddr => 'www.someplace.com', LocalPort => 443;
SEE ALSO
RFC 2068
IO::Socket::SSL, HTTP::Daemon, Apache
COPYRIGHT
Code and documentation from HTTP::Daemon Copyright 1996-2001, Gisle Aas Changes Copyright 2003, Peter Behroozi
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 134:
You forgot a '=back' before '=head1'