Skip to content

Instantly share code, notes, and snippets.

@tempire
Created February 5, 2012 20:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tempire/1747914 to your computer and use it in GitHub Desktop.
Save tempire/1747914 to your computer and use it in GitHub Desktop.
$app->helper(
ssl_auth => sub {
my $self = shift;
my $callback = shift;
my $id = $self->tx->connection;
my $handle = Mojo::IOLoop->singleton->stream($id)->handle;
# Not SSL connection
return if ref $handle ne 'IO::Socket::SSL';
return $callback->($handle);
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment