X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=Lucu.git;a=blobdiff_plain;f=examples%2FSSL.hs;h=f78b6c229939c49825fb6ab612ddf783066b3abf;hp=624ed042647729a3003849c4106d7ef293fc63b1;hb=950640dd241222203778f8167943d30fa52f356a;hpb=251831f3e465eb77666193efcb9b4c02531faa6c diff --git a/examples/SSL.hs b/examples/SSL.hs index 624ed04..f78b6c2 100644 --- a/examples/SSL.hs +++ b/examples/SSL.hs @@ -17,6 +17,7 @@ import OpenSSL.EVP.PKey import OpenSSL.RSA import qualified OpenSSL.Session as SSL import OpenSSL.X509 +import Prelude.Unicode main ∷ IO () main = withOpenSSL $ @@ -38,21 +39,20 @@ main = withOpenSSL $ tree ∷ ResourceTree tree = C.fromList [ ([], nonGreedy helloWorld) ] putStrLn "Access https://localhost:9001/ with your browser." - withSocketsDo $ runHttpd config $ resourceMap tree + withSocketsDo ∘ runHttpd config $ resourceMap tree helloWorld ∷ Resource helloWorld - = C.fromList - [ ( GET - , do setContentType [mimeType| text/plain |] - putChunk "getRemoteCertificate = " - cert ← do cert ← getRemoteCertificate - case cert of - Just c → liftIO $ Lazy.pack <$> printX509 c - Nothing → return "Nothing" - putChunks cert - ) - ] + = C.singleton + ( GET + , do setContentType [mimeType| text/plain |] + putChunk "getRemoteCertificate = " + cert ← do cert ← getRemoteCertificate + case cert of + Just c → liftIO $ Lazy.pack <$> printX509 c + Nothing → return "Nothing" + putChunks cert + ) genCert ∷ KeyPair k ⇒ k → IO X509 genCert pkey