]> gitweb @ CieloNegro.org - Lucu.git/blobdiff - Network/HTTP/Lucu/Response.hs
SSL Support
[Lucu.git] / Network / HTTP / Lucu / Response.hs
index 326054214915d1df157723308094bd867b3521bf..4954bc2654ffb273091dc1c2b5111308cd2a6c07 100644 (file)
@@ -19,9 +19,9 @@ import qualified Data.ByteString as Strict (ByteString)
 import qualified Data.ByteString.Char8 as C8 hiding (ByteString)
 import           Data.Dynamic
 import           Network.HTTP.Lucu.Format
+import           Network.HTTP.Lucu.HandleLike
 import           Network.HTTP.Lucu.Headers
 import           Network.HTTP.Lucu.HttpVersion
-import           System.IO
 
 -- |This is the definition of HTTP status code.
 -- 'Network.HTTP.Lucu.Resource.setStatus' accepts these named statuses
@@ -97,23 +97,23 @@ instance HasHeaders Response where
     setHeaders res hdr = res { resHeaders = hdr }
 
 
-hPutResponse :: Handle -> Response -> IO ()
+hPutResponse :: HandleLike h => h -> Response -> IO ()
 hPutResponse h res
     = h `seq` res `seq`
       do hPutHttpVersion h (resVersion res)
          hPutChar        h ' '
          hPutStatus      h (resStatus  res)
-         C8.hPut         h (C8.pack "\r\n")
+         hPutBS          h (C8.pack "\r\n")
          hPutHeaders     h (resHeaders res)
 
-hPutStatus :: Handle -> StatusCode -> IO ()
+hPutStatus :: HandleLike h => h -> StatusCode -> IO ()
 hPutStatus h sc
     = h `seq` sc `seq`
       case statusCode sc of
         (# num, msg #)
             -> do hPutStr  h (fmtDec 3 num)
                   hPutChar h ' '
-                  C8.hPut  h msg
+                  hPutBS   h msg
 
 
 -- |@'isInformational' sc@ is 'Prelude.True' iff @sc < 200@.