refactored adjustServerParams

This commit is contained in:
Jonathan Lamothe 2021-11-12 19:52:09 -05:00
parent 7814705dd9
commit 6247595145

View File

@ -197,12 +197,13 @@ adjustServerParams certRef params = let
hooks = serverHooks params hooks = serverHooks params
certHook = onClientCertificate hooks certHook = onClientCertificate hooks
certHook' chain = case chain of certHook' chain = do
CertificateChain [] -> certHook chain case chain of
CertificateChain (se:_) -> do CertificateChain [] -> return ()
let cert = signedObject $ getSigned se CertificateChain (se:_) -> do
writeIORef certRef (Just cert) let cert = signedObject $ getSigned se
certHook chain writeIORef certRef (Just cert)
certHook chain
hooks' = hooks { onClientCertificate = certHook' } hooks' = hooks { onClientCertificate = certHook' }
in params { serverHooks = hooks' } in params { serverHooks = hooks' }