snoyberg/conduit — pull request #129 by flo-dhalluin (2014-01-10 20:35:06+00:00)
Title: Network starttls

I worked on adding startTLS callbacks to conduit-network-tls

This would be required for some protocols (xmpp, imap ... )
The API passes an Application Object and a StartTLS call back to trigger the handshake.
It would look something like :

```haskell
runTCPServerStartTLS serverConfig serve
where
serve (ad, startTls) = do
-- this one is clear
yield "proceed" $$ appSink ad
-- handshake
startTls $ \app ->
-- we are now on a secure channel
(forever $ yield "crypted") $$ appSink app
```
API is the exact same for the client side (passing in a tuple with clear application and starttls callback)
I also added some basic tests, and add to refactor a bit to introduce the ability to provide keys with in memory bytestrings, and refactor a bit to share some code with network-conduit.

This is my first pull request for haskell, so please let me know how to make this one better ...