HTTP-Daemon-SSL-1.04/0000775000076500007650000000000010754172747013733 5ustar auffmarauffmarHTTP-Daemon-SSL-1.04/certs/0000775000076500007650000000000010754172745015051 5ustar auffmarauffmarHTTP-Daemon-SSL-1.04/certs/server-cert.pem0000664000076500007650000000445010754172745020020 0ustar auffmarauffmarCertificate: Data: Version: 1 (0x0) Serial Number: 2 (0x2) Signature Algorithm: md5WithRSAEncryption Issuer: C=US, ST=Some-State, O=Dummy IO::Socket::SSL Certificate Authority, CN=Dummy IO::Socket::SSL Certificate Authority Validity Not Before: Jul 20 16:06:37 2002 GMT Not After : Dec 5 16:06:37 2029 GMT Subject: C=US, ST=Some-State, O=IO::Socket::SSL Dummy Server Certificate, CN=IO::Socket::SSL Dummy Server Certificate Subject Public Key Info: Public Key Algorithm: rsaEncryption RSA Public Key: (512 bit) Modulus (512 bit): 00:9f:27:5f:4a:8a:35:4a:7f:3f:d1:80:25:96:26: 0a:da:af:9a:6d:bc:23:ba:71:91:5b:40:d1:2d:2b: c8:60:2a:ef:e9:54:e5:a2:64:0a:57:90:35:bf:cd: b6:36:f3:25:53:68:65:2c:d8:d0:f9:b7:f3:7f:2e: f8:e2:3d:e0:dd Exponent: 65537 (0x10001) Signature Algorithm: md5WithRSAEncryption 57:a7:2d:91:cc:e9:11:16:bb:c1:cd:b5:a5:e1:26:99:8f:ee: 8c:b0:2d:b6:54:f4:8a:8e:fd:8f:45:9a:68:d8:0e:ef:d6:a5: 38:6a:48:d0:08:da:a8:87:3c:70:05:18:69:a1:c8:ee:94:a7: 87:40:f5:4f:64:b4:b0:c6:d3:d2:ed:f9:cc:d1:fe:da:4d:99: 4d:22:02:f6:0e:9b:c0:cc:42:59:50:2f:5c:fc:5b:70:f9:0b: ec:6e:5b:eb:d7:6f:a1:b8:67:57:b1:4f:99:bd:ad:03:9d:b5: f3:44:5c:36:1c:fa:33:82:87:0b:99:aa:f5:39:5c:63:23:6b: 48:2d -----BEGIN CERTIFICATE----- MIICQzCCAawCAQIwDQYJKoZIhvcNAQEEBQAwgY4xCzAJBgNVBAYTAlVTMRMwEQYD VQQIEwpTb21lLVN0YXRlMTQwMgYDVQQKEytEdW1teSBJTzo6U29ja2V0OjpTU0wg Q2VydGlmaWNhdGUgQXV0aG9yaXR5MTQwMgYDVQQDEytEdW1teSBJTzo6U29ja2V0 OjpTU0wgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MB4XDTAyMDcyMDE2MDYzN1oXDTI5 MTIwNTE2MDYzN1owgYgxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRl MTEwLwYDVQQKEyhJTzo6U29ja2V0OjpTU0wgRHVtbXkgU2VydmVyIENlcnRpZmlj YXRlMTEwLwYDVQQDEyhJTzo6U29ja2V0OjpTU0wgRHVtbXkgU2VydmVyIENlcnRp ZmljYXRlMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJ8nX0qKNUp/P9GAJZYmCtqv mm28I7pxkVtA0S0ryGAq7+lU5aJkCleQNb/NtjbzJVNoZSzY0Pm3838u+OI94N0C AwEAATANBgkqhkiG9w0BAQQFAAOBgQBXpy2RzOkRFrvBzbWl4SaZj+6MsC22VPSK jv2PRZpo2A7v1qU4akjQCNqohzxwBRhpocjulKeHQPVPZLSwxtPS7fnM0f7aTZlN IgL2DpvAzEJZUC9c/Ftw+Qvsblvr12+huGdXsU+Zva0DnbXzRFw2HPozgocLmar1 OVxjI2tILQ== -----END CERTIFICATE----- HTTP-Daemon-SSL-1.04/certs/server-key.pem0000664000076500007650000000076110754172745017654 0ustar auffmarauffmar-----BEGIN RSA PRIVATE KEY----- MIIBPAIBAAJBAJ8nX0qKNUp/P9GAJZYmCtqvmm28I7pxkVtA0S0ryGAq7+lU5aJk CleQNb/NtjbzJVNoZSzY0Pm3838u+OI94N0CAwEAAQJAf/DavcVVCco5t2TY0ldK qno4Hrb70cmyHDWC8lkb/5HAGbCGxpsstXxVKczRO201vcFUKm6PX5moUnFCINpg UQIhAM+ooHbD0eLL0K6limEnW7GId/+DFI/6KFXk2Nzm//XXAiEAxDQbWQvZS8DO HJ5JV8flvMhH30KLeH+zpsvBjWJK4GsCIQCUF7woNsquJZBznNctJjZ8S8jYThES BONTLluCXrNYDQIhAJFnsHDQqCxM6jMpV193pJnAsAsUbPpTYZeWX43hL26bAiEA jNB3PPNvTNr5tICkO/lMZcN87eUn4ZAtrNzCVF5ilEo= -----END RSA PRIVATE KEY----- HTTP-Daemon-SSL-1.04/certs/.svn/0000775000076500007650000000000010754172745015735 5ustar auffmarauffmarHTTP-Daemon-SSL-1.04/certs/.svn/tmp/0000775000076500007650000000000010754172745016535 5ustar auffmarauffmarHTTP-Daemon-SSL-1.04/certs/.svn/tmp/props/0000775000076500007650000000000010754172745017700 5ustar auffmarauffmarHTTP-Daemon-SSL-1.04/certs/.svn/tmp/text-base/0000775000076500007650000000000010754172745020431 5ustar auffmarauffmarHTTP-Daemon-SSL-1.04/certs/.svn/tmp/prop-base/0000775000076500007650000000000010754172745020425 5ustar auffmarauffmarHTTP-Daemon-SSL-1.04/certs/.svn/all-wcprops0000444000076500007650000000073610754172745020125 0ustar auffmarauffmarK 25 svn:wc:ra_dav:version-url V 57 /repos/!svn/ver/354/tags/v1_04/perl/HTTP-Daemon-SSL/certs END test-ca.pem K 25 svn:wc:ra_dav:version-url V 69 /repos/!svn/ver/354/tags/v1_04/perl/HTTP-Daemon-SSL/certs/test-ca.pem END server-cert.pem K 25 svn:wc:ra_dav:version-url V 73 /repos/!svn/ver/354/tags/v1_04/perl/HTTP-Daemon-SSL/certs/server-cert.pem END server-key.pem K 25 svn:wc:ra_dav:version-url V 72 /repos/!svn/ver/354/tags/v1_04/perl/HTTP-Daemon-SSL/certs/server-key.pem END HTTP-Daemon-SSL-1.04/certs/.svn/props/0000775000076500007650000000000010754172745017100 5ustar auffmarauffmarHTTP-Daemon-SSL-1.04/certs/.svn/text-base/0000775000076500007650000000000010754172745017631 5ustar auffmarauffmarHTTP-Daemon-SSL-1.04/certs/.svn/text-base/server-cert.pem.svn-base0000444000076500007650000000445010754172745024311 0ustar auffmarauffmarCertificate: Data: Version: 1 (0x0) Serial Number: 2 (0x2) Signature Algorithm: md5WithRSAEncryption Issuer: C=US, ST=Some-State, O=Dummy IO::Socket::SSL Certificate Authority, CN=Dummy IO::Socket::SSL Certificate Authority Validity Not Before: Jul 20 16:06:37 2002 GMT Not After : Dec 5 16:06:37 2029 GMT Subject: C=US, ST=Some-State, O=IO::Socket::SSL Dummy Server Certificate, CN=IO::Socket::SSL Dummy Server Certificate Subject Public Key Info: Public Key Algorithm: rsaEncryption RSA Public Key: (512 bit) Modulus (512 bit): 00:9f:27:5f:4a:8a:35:4a:7f:3f:d1:80:25:96:26: 0a:da:af:9a:6d:bc:23:ba:71:91:5b:40:d1:2d:2b: c8:60:2a:ef:e9:54:e5:a2:64:0a:57:90:35:bf:cd: b6:36:f3:25:53:68:65:2c:d8:d0:f9:b7:f3:7f:2e: f8:e2:3d:e0:dd Exponent: 65537 (0x10001) Signature Algorithm: md5WithRSAEncryption 57:a7:2d:91:cc:e9:11:16:bb:c1:cd:b5:a5:e1:26:99:8f:ee: 8c:b0:2d:b6:54:f4:8a:8e:fd:8f:45:9a:68:d8:0e:ef:d6:a5: 38:6a:48:d0:08:da:a8:87:3c:70:05:18:69:a1:c8:ee:94:a7: 87:40:f5:4f:64:b4:b0:c6:d3:d2:ed:f9:cc:d1:fe:da:4d:99: 4d:22:02:f6:0e:9b:c0:cc:42:59:50:2f:5c:fc:5b:70:f9:0b: ec:6e:5b:eb:d7:6f:a1:b8:67:57:b1:4f:99:bd:ad:03:9d:b5: f3:44:5c:36:1c:fa:33:82:87:0b:99:aa:f5:39:5c:63:23:6b: 48:2d -----BEGIN CERTIFICATE----- MIICQzCCAawCAQIwDQYJKoZIhvcNAQEEBQAwgY4xCzAJBgNVBAYTAlVTMRMwEQYD VQQIEwpTb21lLVN0YXRlMTQwMgYDVQQKEytEdW1teSBJTzo6U29ja2V0OjpTU0wg Q2VydGlmaWNhdGUgQXV0aG9yaXR5MTQwMgYDVQQDEytEdW1teSBJTzo6U29ja2V0 OjpTU0wgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MB4XDTAyMDcyMDE2MDYzN1oXDTI5 MTIwNTE2MDYzN1owgYgxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRl MTEwLwYDVQQKEyhJTzo6U29ja2V0OjpTU0wgRHVtbXkgU2VydmVyIENlcnRpZmlj YXRlMTEwLwYDVQQDEyhJTzo6U29ja2V0OjpTU0wgRHVtbXkgU2VydmVyIENlcnRp ZmljYXRlMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJ8nX0qKNUp/P9GAJZYmCtqv mm28I7pxkVtA0S0ryGAq7+lU5aJkCleQNb/NtjbzJVNoZSzY0Pm3838u+OI94N0C AwEAATANBgkqhkiG9w0BAQQFAAOBgQBXpy2RzOkRFrvBzbWl4SaZj+6MsC22VPSK jv2PRZpo2A7v1qU4akjQCNqohzxwBRhpocjulKeHQPVPZLSwxtPS7fnM0f7aTZlN IgL2DpvAzEJZUC9c/Ftw+Qvsblvr12+huGdXsU+Zva0DnbXzRFw2HPozgocLmar1 OVxjI2tILQ== -----END CERTIFICATE----- HTTP-Daemon-SSL-1.04/certs/.svn/text-base/test-ca.pem.svn-base0000444000076500007650000000237510754172745023414 0ustar auffmarauffmar-----BEGIN CERTIFICATE----- MIIDgzCCAuygAwIBAgIBADANBgkqhkiG9w0BAQQFADCBjjELMAkGA1UEBhMCVVMx EzARBgNVBAgTClNvbWUtU3RhdGUxNDAyBgNVBAoTK0R1bW15IElPOjpTb2NrZXQ6 OlNTTCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxNDAyBgNVBAMTK0R1bW15IElPOjpT b2NrZXQ6OlNTTCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDIwNzIwMTYwNTU0 WhcNMjkxMjA1MTYwNTU0WjCBjjELMAkGA1UEBhMCVVMxEzARBgNVBAgTClNvbWUt U3RhdGUxNDAyBgNVBAoTK0R1bW15IElPOjpTb2NrZXQ6OlNTTCBDZXJ0aWZpY2F0 ZSBBdXRob3JpdHkxNDAyBgNVBAMTK0R1bW15IElPOjpTb2NrZXQ6OlNTTCBDZXJ0 aWZpY2F0ZSBBdXRob3JpdHkwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALQm bgkEUWImNkjWcO6qn5NZ7rCFbtrzqEYbqciy+1qlWuoBgU44n9ykD1c/BcmBPsDT bIOfLzjcdJj38taXu7kcRclchJ+/c6o/SmDv7UqcL6QgVSZRvRrK7TDypMqe3sW8 zCvTF8WtSsgFy5f9qlUdx4NowMzVV7OFl+6x4YlpAgMBAAGjge4wgeswHQYDVR0O BBYEFDU4SrHVMHDjd2kBgFM/qyC3DPxFMIG7BgNVHSMEgbMwgbCAFDU4SrHVMHDj d2kBgFM/qyC3DPxFoYGUpIGRMIGOMQswCQYDVQQGEwJVUzETMBEGA1UECBMKU29t ZS1TdGF0ZTE0MDIGA1UEChMrRHVtbXkgSU86OlNvY2tldDo6U1NMIENlcnRpZmlj YXRlIEF1dGhvcml0eTE0MDIGA1UEAxMrRHVtbXkgSU86OlNvY2tldDo6U1NMIENl cnRpZmljYXRlIEF1dGhvcml0eYIBADAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEB BAUAA4GBAIbCsK/qUXiIsRvg1ptaLNM6VsuR8ifNrmo9A4zk1h4OCixys6Hmoow6 3MndnLpD3rh3UCYh0M20+fiHcwSmHZvBo3dfSSvYnH0gFSBjKp/wgGcb3Cvl3dRX aeWZGrKQKLI6DrHqAiSu9rv+2kfzgmRLt0K+gdb2GkQqCBwT8Gjr -----END CERTIFICATE----- HTTP-Daemon-SSL-1.04/certs/.svn/text-base/server-key.pem.svn-base0000444000076500007650000000076110754172745024145 0ustar auffmarauffmar-----BEGIN RSA PRIVATE KEY----- MIIBPAIBAAJBAJ8nX0qKNUp/P9GAJZYmCtqvmm28I7pxkVtA0S0ryGAq7+lU5aJk CleQNb/NtjbzJVNoZSzY0Pm3838u+OI94N0CAwEAAQJAf/DavcVVCco5t2TY0ldK qno4Hrb70cmyHDWC8lkb/5HAGbCGxpsstXxVKczRO201vcFUKm6PX5moUnFCINpg UQIhAM+ooHbD0eLL0K6limEnW7GId/+DFI/6KFXk2Nzm//XXAiEAxDQbWQvZS8DO HJ5JV8flvMhH30KLeH+zpsvBjWJK4GsCIQCUF7woNsquJZBznNctJjZ8S8jYThES BONTLluCXrNYDQIhAJFnsHDQqCxM6jMpV193pJnAsAsUbPpTYZeWX43hL26bAiEA jNB3PPNvTNr5tICkO/lMZcN87eUn4ZAtrNzCVF5ilEo= -----END RSA PRIVATE KEY----- HTTP-Daemon-SSL-1.04/certs/.svn/entries0000444000076500007650000000122610754172745017326 0ustar auffmarauffmar8 dir 354 http://cvs.pumptheory.com/repos/tags/v1_04/perl/HTTP-Daemon-SSL/certs http://cvs.pumptheory.com/repos 2007-07-23T11:12:43.000000Z 340 aufflick svn:special svn:externals svn:needs-lock e61f1579-d936-0410-a464-d4d27b584de8 test-ca.pem file 2007-11-24T05:44:09.000000Z ca744c4bd7570d64a222725775e93a9d 2007-07-23T11:12:43.000000Z 340 aufflick has-props server-cert.pem file 2007-11-24T05:44:09.000000Z 8f9eedde3214037c20b4f61707025401 2007-07-23T11:12:43.000000Z 340 aufflick has-props server-key.pem file 2007-11-24T05:44:09.000000Z 2e567e702ef3ddf834f9f2b3d6b1226f 2007-07-23T11:12:43.000000Z 340 aufflick has-props HTTP-Daemon-SSL-1.04/certs/.svn/prop-base/0000775000076500007650000000000010754172745017625 5ustar auffmarauffmarHTTP-Daemon-SSL-1.04/certs/.svn/prop-base/server-cert.pem.svn-base0000444000076500007650000000012110754172745024274 0ustar auffmarauffmarK 13 svn:eol-style V 6 native K 12 svn:keywords V 23 Author Date Id Revision END HTTP-Daemon-SSL-1.04/certs/.svn/prop-base/test-ca.pem.svn-base0000444000076500007650000000012110754172745023373 0ustar auffmarauffmarK 13 svn:eol-style V 6 native K 12 svn:keywords V 23 Author Date Id Revision END HTTP-Daemon-SSL-1.04/certs/.svn/prop-base/server-key.pem.svn-base0000444000076500007650000000012110754172745024127 0ustar auffmarauffmarK 13 svn:eol-style V 6 native K 12 svn:keywords V 23 Author Date Id Revision END HTTP-Daemon-SSL-1.04/certs/.svn/format0000444000076500007650000000000210754172745017134 0ustar auffmarauffmar8 HTTP-Daemon-SSL-1.04/certs/test-ca.pem0000664000076500007650000000237510754172745017123 0ustar auffmarauffmar-----BEGIN CERTIFICATE----- MIIDgzCCAuygAwIBAgIBADANBgkqhkiG9w0BAQQFADCBjjELMAkGA1UEBhMCVVMx EzARBgNVBAgTClNvbWUtU3RhdGUxNDAyBgNVBAoTK0R1bW15IElPOjpTb2NrZXQ6 OlNTTCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxNDAyBgNVBAMTK0R1bW15IElPOjpT b2NrZXQ6OlNTTCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDIwNzIwMTYwNTU0 WhcNMjkxMjA1MTYwNTU0WjCBjjELMAkGA1UEBhMCVVMxEzARBgNVBAgTClNvbWUt U3RhdGUxNDAyBgNVBAoTK0R1bW15IElPOjpTb2NrZXQ6OlNTTCBDZXJ0aWZpY2F0 ZSBBdXRob3JpdHkxNDAyBgNVBAMTK0R1bW15IElPOjpTb2NrZXQ6OlNTTCBDZXJ0 aWZpY2F0ZSBBdXRob3JpdHkwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALQm bgkEUWImNkjWcO6qn5NZ7rCFbtrzqEYbqciy+1qlWuoBgU44n9ykD1c/BcmBPsDT bIOfLzjcdJj38taXu7kcRclchJ+/c6o/SmDv7UqcL6QgVSZRvRrK7TDypMqe3sW8 zCvTF8WtSsgFy5f9qlUdx4NowMzVV7OFl+6x4YlpAgMBAAGjge4wgeswHQYDVR0O BBYEFDU4SrHVMHDjd2kBgFM/qyC3DPxFMIG7BgNVHSMEgbMwgbCAFDU4SrHVMHDj d2kBgFM/qyC3DPxFoYGUpIGRMIGOMQswCQYDVQQGEwJVUzETMBEGA1UECBMKU29t ZS1TdGF0ZTE0MDIGA1UEChMrRHVtbXkgSU86OlNvY2tldDo6U1NMIENlcnRpZmlj YXRlIEF1dGhvcml0eTE0MDIGA1UEAxMrRHVtbXkgSU86OlNvY2tldDo6U1NMIENl cnRpZmljYXRlIEF1dGhvcml0eYIBADAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEB BAUAA4GBAIbCsK/qUXiIsRvg1ptaLNM6VsuR8ifNrmo9A4zk1h4OCixys6Hmoow6 3MndnLpD3rh3UCYh0M20+fiHcwSmHZvBo3dfSSvYnH0gFSBjKp/wgGcb3Cvl3dRX aeWZGrKQKLI6DrHqAiSu9rv+2kfzgmRLt0K+gdb2GkQqCBwT8Gjr -----END CERTIFICATE----- HTTP-Daemon-SSL-1.04/Makefile.PL0000664000076500007650000000065610754172747015714 0ustar auffmarauffmar# # A Makemaker script to build HTTP::Daemon::SSL # use ExtUtils::MakeMaker; # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. WriteMakefile( 'NAME' => 'HTTP::Daemon::SSL', 'VERSION_FROM' => 'SSL.pm', 'DISTNAME' => 'HTTP-Daemon-SSL', 'PREREQ_PM' => { 'HTTP::Daemon' => 1.0, 'IO::Socket::SSL' => 0.93 }, 'dist' => { COMPRESS => 'gzip', SUFFIX => 'gz', }, ); HTTP-Daemon-SSL-1.04/README0000664000076500007650000000214010754172747014610 0ustar auffmarauffmarQuick note: I have just taken over maintenance of HTTP::Daemon::SSL. This release fixes various bugs: * http://rt.cpan.org/Ticket/Display.html?id=28417 * http://rt.cpan.org/Ticket/Display.html?id=21395 * http://rt.cpan.org/Ticket/Display.html?id=15470 The todo list, in no particular order, is: * convert build system to Module::Build * change tests to use Test::More * improve test cases Latest versions are available on CPAN. My subversion repository is also available: http://cvs.pumptheory.com/ (browse) http://cvs.pumptheory.com/repos/ (repository) Mark Aufflick, ------- HTTP::Daemon::SSL is a descendant of HTTP::Daemon that uses SSL sockets (via IO::Socket::SSL) instead of cleartext sockets. It also handles SSL-specific problems, such as dealing with HTTP clients that attempt to connect to it without using SSL. In order to use HTTP::Daemon::SSL, you need to have IO::Socket::SSL v0.93 or newer installed as well as a recent version of libwww-perl. installation: perl Makefile.PL make make test make install -- (Peter Behroozi, behrooz at fas.harvard.edu (sic)) HTTP-Daemon-SSL-1.04/SSL.pm0000664000076500007650000001217010754172747014733 0ustar auffmarauffmar# # This package derived almost entirely from HTTP::Daemon, # owned by Gisle Aas. Changes include minor alterations in # the documentation to reflect the use of IO::Socket::SSL # and modified new(),accept() functions that use IO::Socket::SSL use strict; package HTTP::Daemon::SSL; =head1 NAME HTTP::Daemon::SSL - a simple http server class with SSL support =head1 SYNOPSIS use HTTP::Daemon::SSL; use HTTP::Status; # Make sure you have a certs/ directory with "server-cert.pem" # and "server-key.pem" in it before running this! my $d = HTTP::Daemon::SSL->new || die; print "Please contact me at: 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); } =head1 DESCRIPTION Instances of the I class are HTTP/1.1 servers that listen on a socket for incoming requests. The I is a sub-class of I, 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 I class which is another I subclass. In a list context a two-element array is returned containing the new I reference and the peer address; the list will be empty upon failure. (Note that version 1.02 erroneously did not honour list context). Calling the get_request() method on the I object will read data from the client and return an I object reference. This HTTPS daemon does not fork(2) for you. Your application, i.e. the user of the I 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 I class provides some methods that make this easier. =head1 METHODS The following methods are the only differences from the I base class: =over 4 =cut use vars qw($VERSION @ISA $PROTO $DEBUG); use IO::Socket::SSL; use HTTP::Daemon; $VERSION = "1.04"; @ISA = qw(IO::Socket::SSL HTTP::Daemon); =item $d = new HTTP::Daemon::SSL The constructor takes the same parameters as the I constructor. It can also be called without specifying any parameters, but you will have to make sure that you have an SSL certificate and key for the server in F and F. See the IO::Socket::SSL documentation for how to change these default locations and specify many other aspects of SSL behavior. 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; =cut sub new { my ($class, %args) = @_; $args{Listen} ||= 5; $args{Proto} ||= 'tcp'; $args{SSL_error_trap} ||= \&ssl_error; return $class->SUPER::new(%args); } sub accept { my $self = shift; my $pkg = shift || "HTTP::Daemon::ClientConn::SSL"; my ($sock, $peer) = IO::Socket::SSL::accept($self,$pkg); if ($sock) { ${*$sock}{'httpd_daemon'} = $self; return wantarray ? ($sock, $peer) : $sock; } else { return; } } sub _default_port { 443; } sub _default_scheme { "https"; } sub url { my $self = shift; my $url = $self->SUPER::url; return $url if ($self->can("HTTP::Daemon::_default_port")); # Workaround for old versions of HTTP::Daemon $url =~ s!^http:!https:!; $url =~ s!/$!:80/! unless ($url =~ m!:(?:\d+)/$!); $url =~ s!:443/$!/!; return $url; } package HTTP::Daemon::SSL::DummyDaemon; use vars qw(@ISA); @ISA = qw(HTTP::Daemon); sub new { bless [], shift; } package HTTP::Daemon::SSL; sub ssl_error { my ($self, $error) = @_; ${*$self}{'httpd_client_proto'} = 1000; ${*$self}{'httpd_daemon'} = new HTTP::Daemon::SSL::DummyDaemon; if ($error =~ /http/i and $self->opened) { $self->send_error(400, "Your browser attempted to make an unencrypted\n ". "request to this server, which is not allowed. Try using\n ". "HTTPS instead.\n"); } $self->kill_socket; } # we're not overriding any methods here, but we are inserting IO::Socket::SSL # into the message dispatch tree package HTTP::Daemon::ClientConn::SSL; use vars qw(@ISA $DEBUG); @ISA = qw(IO::Socket::SSL HTTP::Daemon::ClientConn); *DEBUG = \$HTTP::Daemon::DEBUG; =head1 SEE ALSO RFC 2068 L, L, L =head1 COPYRIGHT Code and documentation from HTTP::Daemon Copyright 1996-2001, Gisle Aas Changes Copyright 2003-2004, Peter Behroozi This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut 1; HTTP-Daemon-SSL-1.04/BUGS0000664000076500007650000000015510754172747014417 0ustar auffmarauffmarAuthoritative bug list is on rt.cpan.org: http://rt.cpan.org/Public/Dist/Display.html?Name=HTTP-Daemon-SSL HTTP-Daemon-SSL-1.04/Changes0000664000076500007650000000207510754172747015232 0ustar auffmarauffmarv1.04 - production release - only documentation and text file changes from 1.03_02 v1.03_02 - removes unnecessary _need_more - which, by side effect, fixes two outstanding bugs: http://rt.cpan.org/Ticket/Display.html?id=21395 http://rt.cpan.org/Ticket/Display.html?id=15470 v1.03_01 - First release by Mark Aufflick - Fixes problem where accep() will never timeout http://rt.cpan.org/Ticket/Display.html?id=28417 v1.02 - Async updates - Documentation update to mention SSL certificates. (requested by Cedric Bouvier ) - Update to URL function to return 'https' instead of 'http' as protocol (Patch from Kees Cook ). --- Old Versions -------------------------------------------------- v1.01 2003.7.27 - Patch from Evgeniy Pirogov to fix read issues when a client and server have different timeouts. - Fixed the README to actually deal with HTTP::Daemon::SSL instead of IO::Socket::SSL. v1.00 2003.7.24 - Initial public release. HTTP-Daemon-SSL-1.04/MANIFEST0000664000076500007650000000035510754172747015067 0ustar auffmarauffmarBUGS certs/server-cert.pem certs/server-key.pem certs/test-ca.pem Changes Makefile.PL MANIFEST README SSL.pm t/loadmodule.t t/testmodule.t t/ssl_settings.req META.yml Module meta-data (added by MakeMaker) HTTP-Daemon-SSL-1.04/META.yml0000664000076500007650000000050210754172747015201 0ustar auffmarauffmar# http://module-build.sourceforge.net/META-spec.html name: HTTP-Daemon-SSL version: 1.04 version_from: SSL.pm installdirs: site license: perl requires: HTTP::Daemon: 1 IO::Socket::SSL: 0.93 distribution_type: module generated_by: ExtUtils::MakeMaker version 6.17 HTTP-Daemon-SSL-1.04/t/0000775000076500007650000000000010754172745014174 5ustar auffmarauffmarHTTP-Daemon-SSL-1.04/t/ssl_settings.req0000664000076500007650000000023510754172745017426 0ustar auffmarauffmar#Change the following to a port and address that you can create a listening socket on: $SSL_SERVER_PORT = 2000; $SSL_SERVER_ADDR = '127.0.0.1'; 'True Value';HTTP-Daemon-SSL-1.04/t/testmodule.t0000664000076500007650000000456310754172745016556 0ustar auffmarauffmar#!perl -w # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl t/testmodule.t' use HTTP::Daemon::SSL; use HTTP::Status; eval {require "t/ssl_settings.req";} || eval {require "ssl_settings.req";}; $numtests = 9; $|=1; $SIG{PIPE}='IGNORE'; foreach ($^O) { if (/MacOS/ or /VOS/ or /vmesa/ or /riscos/ or /amigaos/) { print "1..0 # Skipped: fork not implemented on this platform\n"; exit; } } print "1..$numtests\n"; $test = 0; unless (fork) { sleep 1; my $client = new IO::Socket::INET(PeerAddr => $SSL_SERVER_ADDR, PeerPort => $SSL_SERVER_PORT); print $client "GET / HTTP/1.0\r\n\r\n"; (<$client> eq "HTTP/1.1 400 Bad Request\r\n") || print "not "; &ok("client bad connection test"); my @ary = <$client>; close $client; $client = new IO::Socket::SSL(PeerAddr => $SSL_SERVER_ADDR, PeerPort => $SSL_SERVER_PORT, SSL_verify_mode => 0x01, SSL_ca_file => "certs/test-ca.pem"); $client || (print("not ok #client failure\n") && exit); &ok("client good connection test"); print $client "GET /foo HTTP/1.0\r\n\r\n"; (<$client> eq "HTTP/1.1 403 Forbidden\r\n") || print "not "; &ok("client permission test"); @ary = <$client>; exit(0); } my $server = new HTTP::Daemon::SSL(LocalPort => $SSL_SERVER_PORT, LocalAddr => $SSL_SERVER_ADDR, Listen => 5, Timeout => 30, ReuseAddr => 1, SSL_verify_mode => 0x00, SSL_ca_file => "certs/test-ca.pem", SSL_cert_file => "certs/server-cert.pem"); if (!$server) { print "not ok $test\n"; exit; } &ok("server init"); print "not " if (!defined fileno($server)); &ok("server fileno"); print "not " unless ($server->url =~ m!^https:!); &ok("server url test"); my $conn; if (!($conn = $server->accept)) { # first client request is a bad request &ok("bad request handled"); } else { print "not ok $test # bad request returned a socket\n"; } if ($conn = $server->accept) { &ok("valid request handled"); } else { print "not ok $test # valid request did not return a socket\n"; } my $r = $conn->get_request(); unless ($r->method eq 'GET' and $r->url->path eq '/foo') { print "not "; } &ok("server method processing"); $conn->send_error(RC_FORBIDDEN); close $conn; wait; sub ok { print "ok #$_[0] ", ++$test, "\n"; } HTTP-Daemon-SSL-1.04/t/loadmodule.t0000664000076500007650000000112510754172745016505 0ustar auffmarauffmar# Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl t/01loadmodule.t' ######################### We start with some black magic to print on failure. BEGIN { $| = 1; print "1..3\n"; } END {print "Load failed ... not ok 1\n" unless $loaded;} use IO::Socket::SSL qw(:debug1); $loaded = 1; $test=1; print "ok $test\n"; $test++; if ($IO::Socket::SSL::DEBUG == 1) { print "ok $test\n"; } else { print "not ok $test\n"; } $test++; if ($Net::SSLeay::trace == 1) { print "ok $test\n"; } else { print "not ok $test\n"; } HTTP-Daemon-SSL-1.04/t/.svn/0000775000076500007650000000000010754172745015060 5ustar auffmarauffmarHTTP-Daemon-SSL-1.04/t/.svn/tmp/0000775000076500007650000000000010754172745015660 5ustar auffmarauffmarHTTP-Daemon-SSL-1.04/t/.svn/tmp/props/0000775000076500007650000000000010754172745017023 5ustar auffmarauffmarHTTP-Daemon-SSL-1.04/t/.svn/tmp/text-base/0000775000076500007650000000000010754172745017554 5ustar auffmarauffmarHTTP-Daemon-SSL-1.04/t/.svn/tmp/prop-base/0000775000076500007650000000000010754172745017550 5ustar auffmarauffmarHTTP-Daemon-SSL-1.04/t/.svn/all-wcprops0000444000076500007650000000071610754172745017246 0ustar auffmarauffmarK 25 svn:wc:ra_dav:version-url V 53 /repos/!svn/ver/354/tags/v1_04/perl/HTTP-Daemon-SSL/t END testmodule.t K 25 svn:wc:ra_dav:version-url V 66 /repos/!svn/ver/354/tags/v1_04/perl/HTTP-Daemon-SSL/t/testmodule.t END ssl_settings.req K 25 svn:wc:ra_dav:version-url V 70 /repos/!svn/ver/354/tags/v1_04/perl/HTTP-Daemon-SSL/t/ssl_settings.req END loadmodule.t K 25 svn:wc:ra_dav:version-url V 66 /repos/!svn/ver/354/tags/v1_04/perl/HTTP-Daemon-SSL/t/loadmodule.t END HTTP-Daemon-SSL-1.04/t/.svn/props/0000775000076500007650000000000010754172745016223 5ustar auffmarauffmarHTTP-Daemon-SSL-1.04/t/.svn/text-base/0000775000076500007650000000000010754172745016754 5ustar auffmarauffmarHTTP-Daemon-SSL-1.04/t/.svn/text-base/testmodule.t.svn-base0000444000076500007650000000456310754172745023047 0ustar auffmarauffmar#!perl -w # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl t/testmodule.t' use HTTP::Daemon::SSL; use HTTP::Status; eval {require "t/ssl_settings.req";} || eval {require "ssl_settings.req";}; $numtests = 9; $|=1; $SIG{PIPE}='IGNORE'; foreach ($^O) { if (/MacOS/ or /VOS/ or /vmesa/ or /riscos/ or /amigaos/) { print "1..0 # Skipped: fork not implemented on this platform\n"; exit; } } print "1..$numtests\n"; $test = 0; unless (fork) { sleep 1; my $client = new IO::Socket::INET(PeerAddr => $SSL_SERVER_ADDR, PeerPort => $SSL_SERVER_PORT); print $client "GET / HTTP/1.0\r\n\r\n"; (<$client> eq "HTTP/1.1 400 Bad Request\r\n") || print "not "; &ok("client bad connection test"); my @ary = <$client>; close $client; $client = new IO::Socket::SSL(PeerAddr => $SSL_SERVER_ADDR, PeerPort => $SSL_SERVER_PORT, SSL_verify_mode => 0x01, SSL_ca_file => "certs/test-ca.pem"); $client || (print("not ok #client failure\n") && exit); &ok("client good connection test"); print $client "GET /foo HTTP/1.0\r\n\r\n"; (<$client> eq "HTTP/1.1 403 Forbidden\r\n") || print "not "; &ok("client permission test"); @ary = <$client>; exit(0); } my $server = new HTTP::Daemon::SSL(LocalPort => $SSL_SERVER_PORT, LocalAddr => $SSL_SERVER_ADDR, Listen => 5, Timeout => 30, ReuseAddr => 1, SSL_verify_mode => 0x00, SSL_ca_file => "certs/test-ca.pem", SSL_cert_file => "certs/server-cert.pem"); if (!$server) { print "not ok $test\n"; exit; } &ok("server init"); print "not " if (!defined fileno($server)); &ok("server fileno"); print "not " unless ($server->url =~ m!^https:!); &ok("server url test"); my $conn; if (!($conn = $server->accept)) { # first client request is a bad request &ok("bad request handled"); } else { print "not ok $test # bad request returned a socket\n"; } if ($conn = $server->accept) { &ok("valid request handled"); } else { print "not ok $test # valid request did not return a socket\n"; } my $r = $conn->get_request(); unless ($r->method eq 'GET' and $r->url->path eq '/foo') { print "not "; } &ok("server method processing"); $conn->send_error(RC_FORBIDDEN); close $conn; wait; sub ok { print "ok #$_[0] ", ++$test, "\n"; } HTTP-Daemon-SSL-1.04/t/.svn/text-base/loadmodule.t.svn-base0000444000076500007650000000112510754172745022776 0ustar auffmarauffmar# Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl t/01loadmodule.t' ######################### We start with some black magic to print on failure. BEGIN { $| = 1; print "1..3\n"; } END {print "Load failed ... not ok 1\n" unless $loaded;} use IO::Socket::SSL qw(:debug1); $loaded = 1; $test=1; print "ok $test\n"; $test++; if ($IO::Socket::SSL::DEBUG == 1) { print "ok $test\n"; } else { print "not ok $test\n"; } $test++; if ($Net::SSLeay::trace == 1) { print "ok $test\n"; } else { print "not ok $test\n"; } HTTP-Daemon-SSL-1.04/t/.svn/text-base/ssl_settings.req.svn-base0000444000076500007650000000023510754172745023717 0ustar auffmarauffmar#Change the following to a port and address that you can create a listening socket on: $SSL_SERVER_PORT = 2000; $SSL_SERVER_ADDR = '127.0.0.1'; 'True Value';HTTP-Daemon-SSL-1.04/t/.svn/entries0000444000076500007650000000120210754172745016443 0ustar auffmarauffmar8 dir 354 http://cvs.pumptheory.com/repos/tags/v1_04/perl/HTTP-Daemon-SSL/t http://cvs.pumptheory.com/repos 2007-07-24T09:29:29.000000Z 351 svn:special svn:externals svn:needs-lock e61f1579-d936-0410-a464-d4d27b584de8 testmodule.t file 2007-11-24T05:44:09.000000Z ece02320b08f6a34d84c026d9d7e39af 2007-07-24T09:29:29.000000Z 351 has-props ssl_settings.req file 2007-11-24T05:44:09.000000Z 5a883bb6bc49c1a583b70309d8ab3e77 2007-07-23T11:12:43.000000Z 340 aufflick has-props loadmodule.t file 2007-11-24T05:44:09.000000Z 145d03f467d2c60d0c0f7793835e68d5 2007-07-23T11:12:43.000000Z 340 aufflick has-props HTTP-Daemon-SSL-1.04/t/.svn/prop-base/0000775000076500007650000000000010754172745016750 5ustar auffmarauffmarHTTP-Daemon-SSL-1.04/t/.svn/prop-base/testmodule.t.svn-base0000444000076500007650000000012110754172745023025 0ustar auffmarauffmarK 13 svn:eol-style V 6 native K 12 svn:keywords V 23 Author Date Id Revision END HTTP-Daemon-SSL-1.04/t/.svn/prop-base/loadmodule.t.svn-base0000444000076500007650000000012110754172745022765 0ustar auffmarauffmarK 13 svn:eol-style V 6 native K 12 svn:keywords V 23 Author Date Id Revision END HTTP-Daemon-SSL-1.04/t/.svn/prop-base/ssl_settings.req.svn-base0000444000076500007650000000012110754172745023705 0ustar auffmarauffmarK 13 svn:eol-style V 6 native K 12 svn:keywords V 23 Author Date Id Revision END HTTP-Daemon-SSL-1.04/t/.svn/format0000444000076500007650000000000210754172745016257 0ustar auffmarauffmar8