openid 0.2.0.1 → 0.2.0.2
raw patch · 4 files changed
+51/−38 lines, 4 filesdep ~HTTPdep ~HsOpenSSLdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: HTTP, HsOpenSSL, base, bytestring, containers, monadLib, network, time, xml
API changes (from Hackage documentation)
Files
- openid.cabal +15/−11
- src/Codec/Encryption/DH.hsc +9/−2
- src/Data/Digest/OpenSSL/AlternativeHMAC.hsc +1/−1
- src/Network/OpenID/SSL.hs +26/−24
openid.cabal view
@@ -1,5 +1,5 @@ name: openid-version: 0.2.0.1+version: 0.2.0.2 cabal-version: >= 1.8 synopsis: An implementation of the OpenID-2.0 spec. description: An implementation of the OpenID-2.0 spec.@@ -26,15 +26,15 @@ location: git://github.com/elliottt/hsopenid.git library- build-depends: base >= 4.0.0.0 && < 5.0.0.0,- bytestring >= 0.9.1.0 && < 0.10.0.0,- containers >= 0.2.0.0 && < 0.4.1.0,- HTTP >= 4000.0.9 && < 4000.2,- monadLib >= 3.6.0.0 && < 3.7.0.0,- network >= 2.2.0.0 && < 2.4.0.0,- time >= 1.1.0.0 && < 1.3.0.0,- xml >= 1.3.0.0 && < 1.4.0.0,- HsOpenSSL >= 0.9.0.0 && < 0.11.0.0+ build-depends: base >= 4.0.0.0 && < 5,+ bytestring >= 0.9.1.0,+ containers >= 0.2.0.0,+ HTTP >= 4000.0.9,+ monadLib >= 3.6.0.0,+ network >= 2.2.0.0,+ time >= 1.1.0.0,+ xml >= 1.3.0.0,+ HsOpenSSL >= 0.9.0.0 hs-source-dirs: src exposed-modules: Codec.Binary.Base64, Codec.Encryption.DH,@@ -67,7 +67,11 @@ if flag(examples) buildable: True- build-depends: base, openid, monadLib, network, HsOpenSSL+ build-depends: base >= 4.0.0.0 && < 5,+ monadLib >= 3.6.0.0,+ network >= 2.2.0.0,+ HsOpenSSL >= 0.9.0.0,+ openid else buildable: False
src/Codec/Encryption/DH.hsc view
@@ -12,9 +12,16 @@ , computeKey ) where +import Data.Bits (shiftL,shiftR,(.|.),testBit) import Data.List-import Foreign-import Foreign.C+import Data.Word (Word8)+import Foreign.C (CInt(..),CUChar(..))+import Foreign.Marshal.Alloc (alloca)+import Foreign.Marshal.Array+ (peekArray,allocaArray,withArrayLen,mallocArray)+import Foreign.Ptr (Ptr,nullPtr)+import Foreign.Storable (Storable(..))+import System.IO.Unsafe (unsafePerformIO) #include <openssl/bn.h> #include <openssl/dh.h>
src/Data/Digest/OpenSSL/AlternativeHMAC.hsc view
@@ -59,7 +59,7 @@ showHMAC bs = concatMap draw $ BS.unpack bs where- draw :: (Integral a) => a -> String+ draw :: (Integral a, Show a) => a -> String draw w = case showHex w [] of [x] -> ['0', x] x -> x
src/Network/OpenID/SSL.hs view
@@ -16,7 +16,7 @@ ) where import OpenSSL.Session as Session-import Control.Exception as E+import qualified Control.Exception as E import Network.Socket import Network.Stream import qualified Data.ByteString as B@@ -27,18 +27,21 @@ data SSLHandle = SSLHandle SSLContext SSL -wrap m = Right `fmap` m `Prelude.catch` handler+wrap :: IO a -> IO (Either ConnError a)+wrap m = Right `fmap` m `E.catch` handler where+ handler :: E.SomeException -> IO (Either ConnError a) handler err = return $ Left $ ErrorMisc $ "write: " ++ show err -wrapRead m = Right `fmap` m `catches` handlers+wrapRead :: IO String -> IO (Either ConnError String)+wrapRead m = Right `fmap` m `E.catches` handlers where- handlers :: [Handler (Either ConnError String)]+ handlers :: [E.Handler (Either ConnError String)] handlers =- [ Handler ((\_ -> return $ Right "")+ [ E.Handler ((\_ -> return $ Right "") :: (ConnectionAbruptlyTerminated -> IO (Either ConnError String)))- , Handler ((\x -> return $ Left $ ErrorMisc $ "read: " ++ show x)- :: (SomeException -> IO (Either ConnError String)))+ , E.Handler ((\x -> return $ Left $ ErrorMisc $ "read: " ++ show x)+ :: (E.SomeException -> IO (Either ConnError String))) ] -- The problem is that the OpenSSL library doesn't know that in some@@ -65,12 +68,12 @@ wrapRead ((map w2c . B.unpack) <$> Session.read ssl n) writeBlock (SSLHandle _ ssl) bs- | not (null bs) = wrap $ Session.write ssl $ B.pack $ map c2w $ bs+ | not (null bs) = wrap $ Session.write ssl $ B.pack $ map c2w bs | otherwise = return $ Right () -- should this really ignore all exceptions? close (SSLHandle _ ssl) = Session.shutdown ssl Bidirectional- `E.catch` ((\_ -> return ()) :: SomeException -> IO ())+ `E.catch` ((\_ -> return ()) :: E.SomeException -> IO ()) closeOnEnd _ _ = return () @@ -83,22 +86,21 @@ Session.connect ssl return $ Just $ SSLHandle ctx ssl - handler :: SomeException -> IO (Maybe SSLHandle)+ handler :: E.SomeException -> IO (Maybe SSLHandle) handler _ = return Nothing sslReadWhile :: (Word8 -> Bool) -> SSLHandle -> IO [Word8]-sslReadWhile pred (SSLHandle _ ssl) = rw+sslReadWhile p (SSLHandle _ ssl) = loop where- rw = do- txt <- Session.read ssl 1- if B.null txt- then return []- else do- let c = B.head txt- if pred c- then do- cs <- rw- return (c:cs)- else- return []-+ loop = do+ txt <- Session.read ssl 1+ if B.null txt+ then return []+ else do+ let c = B.head txt+ if p c+ then do+ cs <- loop+ return (c:cs)+ else+ return []