X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=Lucu.git;a=blobdiff_plain;f=Network%2FHTTP%2FLucu%2FHandleLike.hs;h=f58264d9c6abd2b3fd5761c7fc0bd6cdfd5782e1;hp=aa4dacbee7c3e00983c2f61afda2931fe10edb57;hb=db4b612;hpb=054e36027618944ea45f85ae349e51b76a139270 diff --git a/Network/HTTP/Lucu/HandleLike.hs b/Network/HTTP/Lucu/HandleLike.hs index aa4dacb..f58264d 100644 --- a/Network/HTTP/Lucu/HandleLike.hs +++ b/Network/HTTP/Lucu/HandleLike.hs @@ -1,32 +1,28 @@ +{-# LANGUAGE + UnicodeSyntax + #-} module Network.HTTP.Lucu.HandleLike ( HandleLike(..) ) where - import qualified Data.ByteString as B import qualified Data.ByteString.Lazy.Char8 as L import qualified OpenSSL.Session as SSL -import OpenSSL.X509 +import OpenSSL.X509 import qualified System.IO as I - class HandleLike h where - hGetLBS :: h -> IO L.ByteString - hPutLBS :: h -> L.ByteString -> IO () - - hGetBS :: h -> Int -> IO B.ByteString - hPutBS :: h -> B.ByteString -> IO () - - hPutChar :: h -> Char -> IO () + hGetLBS ∷ h → IO L.ByteString + hPutLBS ∷ h → L.ByteString → IO () - hPutStr :: h -> String -> IO () - hPutStrLn :: h -> String -> IO () + hGetBS ∷ h → Int → IO B.ByteString + hPutBS ∷ h → B.ByteString → IO () - hGetPeerCert :: h -> IO (Maybe X509) + hGetPeerCert ∷ h → IO (Maybe X509) hGetPeerCert = const $ return Nothing - hFlush :: h -> IO () - hClose :: h -> IO () + hFlush ∷ h → IO () + hClose ∷ h → IO () instance HandleLike I.Handle where @@ -36,11 +32,6 @@ instance HandleLike I.Handle where hGetBS = B.hGet hPutBS = B.hPut - hPutChar = I.hPutChar - - hPutStr = I.hPutStr - hPutStrLn = I.hPutStrLn - hFlush = I.hFlush hClose = I.hClose @@ -52,11 +43,6 @@ instance HandleLike SSL.SSL where hGetBS = SSL.read hPutBS = SSL.write - hPutChar s = hPutLBS s . L.singleton - - hPutStr s = hPutLBS s . L.pack - hPutStrLn s = hPutLBS s . L.pack . (++ "\n") - hGetPeerCert s = do isValid <- SSL.getVerifyResult s if isValid then