]> gitweb @ CieloNegro.org - Lucu.git/blobdiff - Network/HTTP/Lucu/HttpVersion.hs
SSL Support
[Lucu.git] / Network / HTTP / Lucu / HttpVersion.hs
index c988aab3dcd99776547f61cf8a09471c09918957..0f83bab46962919b2e7f5c183648813fd62ebdf5 100644 (file)
@@ -9,9 +9,9 @@ module Network.HTTP.Lucu.HttpVersion
     where
 
 import qualified Data.ByteString.Char8 as C8
+import           Network.HTTP.Lucu.HandleLike
 import           Network.HTTP.Lucu.Parser
 import           Prelude hiding (min)
-import           System.IO
 
 -- |@'HttpVersion' major minor@ represents \"HTTP\/major.minor\".
 data HttpVersion = HttpVersion !Int !Int
@@ -45,15 +45,15 @@ httpVersionP = string "HTTP/"
                       ]
 
 
-hPutHttpVersion :: Handle -> HttpVersion -> IO ()
+hPutHttpVersion :: HandleLike h => h -> HttpVersion -> IO ()
 hPutHttpVersion !h !v
     = case v of
         -- 頻出するので高速化
-        HttpVersion 1 0 -> C8.hPut h (C8.pack "HTTP/1.0")
-        HttpVersion 1 1 -> C8.hPut h (C8.pack "HTTP/1.1")
+        HttpVersion 1 0 -> hPutBS h (C8.pack "HTTP/1.0")
+        HttpVersion 1 1 -> hPutBS h (C8.pack "HTTP/1.1")
         -- 一般の場合
         HttpVersion !maj !min
-            -> do C8.hPut  h (C8.pack "HTTP/")
+            -> do hPutBS   h (C8.pack "HTTP/")
                   hPutStr  h (show maj)
                   hPutChar h '.'
                   hPutStr  h (show min)