]> gitweb @ CieloNegro.org - Lucu.git/blobdiff - Network/HTTP/Lucu/Resource/Internal.hs
Added a configuration flag -fssl to enable SSL support. (default: off)
[Lucu.git] / Network / HTTP / Lucu / Resource / Internal.hs
index 0a1f89f0c270288321ab9472b6ba4ce13872bb11..e34512dd449614562ec9783d362a62182284aa95 100644 (file)
@@ -1,5 +1,6 @@
 {-# LANGUAGE
-    DoAndIfThenElse
+    CPP
+  , DoAndIfThenElse
   , GeneralizedNewtypeDeriving
   , OverloadedStrings
   , RecordWildCards
@@ -13,7 +14,9 @@ module Network.HTTP.Lucu.Resource.Internal
 
     , getConfig
     , getRemoteAddr
+#if defined(HAVE_SSL)
     , getRemoteCertificate
+#endif
     , getRequest
     , getResourcePath
 
@@ -54,7 +57,9 @@ import Network.HTTP.Lucu.Postprocess
 import Network.HTTP.Lucu.Request
 import Network.HTTP.Lucu.Response
 import Network.Socket
+#if defined(HAVE_SSL)
 import OpenSSL.X509
+#endif
 import Prelude hiding (catch)
 import Prelude.Unicode
 import System.IO
@@ -230,6 +235,7 @@ getConfig = niConfig <$> getInteraction
 getRemoteAddr ∷ Resource SockAddr
 getRemoteAddr = niRemoteAddr <$> getInteraction
 
+#if defined(HAVE_SSL)
 -- | Return the X.509 certificate of the client, or 'Nothing' if:
 --
 --   * This request didn't came through an SSL stream.
@@ -241,6 +247,7 @@ getRemoteAddr = niRemoteAddr <$> getInteraction
 --   'OpenSSL.Session.VerifyPeer'.
 getRemoteCertificate ∷ Resource (Maybe X509)
 getRemoteCertificate = niRemoteCert <$> getInteraction
+#endif
 
 -- |Return the 'Request' value representing the request header. You
 -- usually don't need to call this function directly.
@@ -304,7 +311,7 @@ getChunk' n
 
 -- |Declare the response status code. If you don't call this function,
 -- the status code will be defaulted to \"200 OK\".
-setStatus ∷ StatusCode → Resource ()
+setStatus ∷ StatusCode sc ⇒ sc → Resource ()
 setStatus sc
     = do ni ← getInteraction
          liftIO $ atomically
@@ -361,8 +368,8 @@ deleteHeader name = liftIO ∘ atomically ∘ go =≪ getInteraction
 -- infinitely long stream of octets.
 --
 -- Note that you must first declare the response header
--- \"Content-Type\" before applying this function. See
--- 'setContentType'.
+-- \"Content-Type\" before applying this function. See:
+-- 'setContentType'
 putBuilder ∷ Builder → Resource ()
 putBuilder b = liftIO ∘ atomically ∘ go =≪ getInteraction
     where