make runConnection take a certificate as a parameter
This commit is contained in:
parent
a15abeaa1f
commit
17f1eba583
|
@ -48,7 +48,7 @@ import qualified Data.ByteString as BS
|
||||||
import Data.ByteString.Builder (charUtf8, stringUtf8, toLazyByteString)
|
import Data.ByteString.Builder (charUtf8, stringUtf8, toLazyByteString)
|
||||||
import qualified Data.ByteString.Lazy as BSL
|
import qualified Data.ByteString.Lazy as BSL
|
||||||
import Data.Char (chr, ord, toLower)
|
import Data.Char (chr, ord, toLower)
|
||||||
import Data.IORef (IORef, newIORef, writeIORef)
|
import Data.IORef (IORef, newIORef, readIORef, writeIORef)
|
||||||
import Data.List (find, intercalate)
|
import Data.List (find, intercalate)
|
||||||
import Data.Maybe (fromJust)
|
import Data.Maybe (fromJust)
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
|
@ -183,7 +183,8 @@ listenLoop sock params handler = do
|
||||||
let params' = adjustServerParams certRef params
|
let params' = adjustServerParams certRef params
|
||||||
try (accept params' sock) >>= \case
|
try (accept params' sock) >>= \case
|
||||||
Left (_ :: IOException) -> return ()
|
Left (_ :: IOException) -> return ()
|
||||||
Right conn -> void $ forkIO $ runConnection conn handler
|
Right conn -> void $ forkIO $
|
||||||
|
readIORef certRef >>= runConnection conn handler
|
||||||
listenLoop sock params handler
|
listenLoop sock params handler
|
||||||
|
|
||||||
adjustServerParams
|
adjustServerParams
|
||||||
|
|
|
@ -34,6 +34,7 @@ module Network.GemServ.Internal (
|
||||||
runConnection
|
runConnection
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Data.X509 (Certificate)
|
||||||
import System.IO.Streams.TLS (TLSConnection)
|
import System.IO.Streams.TLS (TLSConnection)
|
||||||
|
|
||||||
import Network.GemServ.Types
|
import Network.GemServ.Types
|
||||||
|
@ -45,6 +46,8 @@ runConnection
|
||||||
-- ^ The connection
|
-- ^ The connection
|
||||||
-> GemHandler
|
-> GemHandler
|
||||||
-- ^ The handler that produces the response
|
-- ^ The handler that produces the response
|
||||||
|
-> Maybe Certificate
|
||||||
|
-- ^ The client certificate (if available)
|
||||||
-> IO ()
|
-> IO ()
|
||||||
runConnection = undefined
|
runConnection = undefined
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user