Skip to content

Commit

Permalink
Expose ssl socket upgrading [fixes #91]
Browse files Browse the repository at this point in the history
  • Loading branch information
tobias committed Jan 16, 2014
1 parent 6cd27b8 commit 2b74cfb
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions api/src/main/clojure/vertx/net.clj
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
passed the socket. Returns the server instance.
The server can only have at most one connect handler at any one
time. "
time."
[server handler]
(.connectHandler server (core/as-handler handler)))

Expand Down Expand Up @@ -132,5 +132,17 @@
This bypasses userspace altogether where supported by the
underlying operating system. This is a very efficient way to serve
files. Returns the socket."
[sock filename]
(.sendFile sock filename))
[socket filename]
(.sendFile socket filename))

(defn ssl
"Upgrade a socket to use SSL/TLS.
handler can either be a zero-arity fn or a Handler instance that
will be called when the upgrade completes. Returns the socket."
[socket handler]
(.ssl socket (core/as-void-handler handler)))

(defn ssl?
"Returns true if the socket is encrypted via SSL/TLS."
[socket]
(.isSsl socket))

0 comments on commit 2b74cfb

Please sign in to comment.