1SSL(3)                User Contributed Perl Documentation               SSL(3)
2
3
4

NAME

6       HTTP::Daemon::SSL - a simple http server class with SSL support
7

SYNOPSIS

9         use HTTP::Daemon::SSL;
10         use HTTP::Status;
11
12         # Make sure you have a certs/ directory with "server-cert.pem"
13         # and "server-key.pem" in it before running this!
14         my $d = HTTP::Daemon::SSL->new || die;
15         print "Please contact me at: <URL:", $d->url, ">\n";
16         while (my $c = $d->accept) {
17             while (my $r = $c->get_request) {
18                 if ($r->method eq 'GET' and $r->url->path eq "/xyzzy") {
19                     # remember, this is *not* recommened practice :-)
20                     $c->send_file_response("/etc/passwd");
21                 } else {
22                     $c->send_error(RC_FORBIDDEN)
23                 }
24             }
25             $c->close;
26             undef($c);
27         }
28

DESCRIPTION

30       Instances of the HTTP::Daemon::SSL class are HTTP/1.1 servers that
31       listen on a socket for incoming requests. The HTTP::Daemon::SSL is a
32       sub-class of IO::Socket::SSL, so you can perform socket operations
33       directly on it too.
34
35       The accept() method will return when a connection from a client is
36       available.  In a scalar context the returned value will be a reference
37       to a object of the HTTP::Daemon::ClientConn::SSL class which is another
38       IO::Socket::SSL subclass.  In a list context a two-element array is
39       returned containing the new HTTP::Daemon::ClientConn::SSL reference and
40       the peer address; the list will be empty upon failure. (Note that
41       version
42        1.02 erroneously did not honour list context). Calling the
43       get_request() method on the HTTP::Daemon::ClientConn::SSL object will
44       read data from the client and return an HTTP::Request object reference.
45
46       This HTTPS daemon does not fork(2) for you.  Your application, i.e. the
47       user of the HTTP::Daemon::SSL is reponsible for forking if that is
48       desirable.  Also note that the user is responsible for generating
49       responses that conform to the HTTP/1.1 protocol.  The
50       HTTP::Daemon::ClientConn class provides some methods that make this
51       easier.
52

METHODS

54       The following methods are the only differences from the HTTP::Daemon
55       base class:
56
57       $d = new HTTP::Daemon::SSL
58           The constructor takes the same parameters as the IO::Socket::SSL
59           constructor.  It can also be called without specifying any
60           parameters, but you will have to make sure that you have an SSL
61           certificate and key for the server in certs/server-cert.pem and
62           certs/server-key.pem.  See the IO::Socket::SSL documentation for
63           how to change these default locations and specify many other
64           aspects of SSL behavior. The daemon will then set up a listen queue
65           of 5 connections and allocate some random port number.  A server
66           that wants to bind to some specific address on the standard HTTPS
67           port will be constructed like this:
68
69             $d = new HTTP::Daemon::SSL
70                   LocalAddr => 'www.someplace.com',
71                   LocalPort => 443;
72

SEE ALSO

74       RFC 2068
75
76       IO::Socket::SSL, HTTP::Daemon, Apache
77
79       Code and documentation from HTTP::Daemon Copyright 1996-2001, Gisle Aas
80       Changes Copyright 2003-2004, Peter Behroozi
81
82       This library is free software; you can redistribute it and/or modify it
83       under the same terms as Perl itself.
84

POD ERRORS

86       Hey! The above document had some coding errors, which are explained
87       below:
88
89       Around line 164:
90           You forgot a '=back' before '=head1'
91
92
93
94perl v5.28.1                      2008-02-12                            SSL(3)
Impressum