Skip to content

Commit

Permalink
IO::Socket::SSL prototype added
Browse files Browse the repository at this point in the history
  • Loading branch information
sergot committed Jul 8, 2014
1 parent e01655a commit 574b58a
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions lib/IO/Socket/SSL.pm6
Expand Up @@ -27,8 +27,12 @@ has Str $.input-line-separator is rw = "\n";
has Int $.ins = 0;

has int32 $.fd;
has OpenSSL::SSL_CTX $.ctx;
has OpenSSL::SSL $.ssl;

method new() { ... }
method new() {
...
}

method !initialize {
if $.host && $.port {
Expand All @@ -37,10 +41,22 @@ method !initialize {

if $.fd > 0 {
# do some SSL here
OpenSSL::SSL_library_init();
OpenSSL::SSL_load_error_strings();
$.ctx = OpenSSL::SSL_CTX_new( OpenSSL::SSLv23_client_method() );
$.ssl = OpenSSL::SSL_new($.ctx);
OpenSSL::SSL_set_connect_state($.ssl);
OpenSSL::SSL_set_fd($.ssl, $.fd);
OpenSSL::SSL_connect($.ssl);
}
}
self;
}

method recv() { ... }
method send() { ... }
method recv() {
...
}

method send() {
...
}

0 comments on commit 574b58a

Please sign in to comment.