]> gitweb @ CieloNegro.org - Lucu.git/blobdiff - Network/HTTP/Lucu/HandleLike.hs
Added a configuration flag -fssl to enable SSL support. (default: off)
[Lucu.git] / Network / HTTP / Lucu / HandleLike.hs
index a45ce6cbf066f3d0a6bac21335b4b16dbef6cca1..cc90cd6746ed7a74e8a1ed979e4f343423585863 100644 (file)
@@ -1,5 +1,6 @@
 {-# LANGUAGE
-    DoAndIfThenElse
+    CPP
+  , DoAndIfThenElse
   , UnicodeSyntax
   #-}
 -- |Type class for things behaves like a 'I.Handle'.
@@ -12,8 +13,10 @@ import Blaze.ByteString.Builder (Builder)
 import qualified Blaze.ByteString.Builder as BB
 import qualified Data.ByteString as B
 import qualified Data.ByteString.Lazy.Char8 as L
+#if defined(HAVE_SSL)
 import qualified OpenSSL.Session as SSL
 import OpenSSL.X509
+#endif
 import Prelude.Unicode
 import qualified System.IO as I
 
@@ -23,8 +26,10 @@ class HandleLike h where
     hGetBS  ∷ h → Int → IO B.ByteString
     hPutBS  ∷ h → B.ByteString → IO ()
 
+#if defined(HAVE_SSL)
     hGetPeerCert ∷ h → IO (Maybe X509)
     hGetPeerCert = const $ return Nothing
+#endif
 
     hFlush  ∷ h → IO ()
     hClose  ∷ h → IO ()
@@ -38,6 +43,7 @@ instance HandleLike I.Handle where
     hFlush  = I.hFlush
     hClose  = I.hClose
 
+#if defined(HAVE_SSL)
 instance HandleLike SSL.SSL where
     hGetLBS = SSL.lazyRead
 
@@ -53,6 +59,7 @@ instance HandleLike SSL.SSL where
 
     hFlush _ = return () -- No need to do anything.
     hClose s = SSL.shutdown s SSL.Bidirectional
+#endif
 
 hPutBuilder ∷ HandleLike h ⇒ h → Builder → IO ()
 {-# INLINE hPutBuilder #-}