import OpenSSL.RSA
import qualified OpenSSL.Session as SSL
import OpenSSL.X509
+import Prelude.Unicode
main ∷ IO ()
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