packages feed

hoauth 0.3.2.1 → 0.3.3

raw patch · 3 files changed

+15/−70 lines, 3 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Network.OAuth.Http.DebugHttpClient: DebugClient :: c -> (Request -> IO ()) -> (Response -> IO ()) -> (String -> IO ()) -> DebugClient c
- Network.OAuth.Http.DebugHttpClient: backend :: DebugClient c -> c
- Network.OAuth.Http.DebugHttpClient: data DebugClient c
- Network.OAuth.Http.DebugHttpClient: instance HttpClient c => HttpClient (DebugClient c)
- Network.OAuth.Http.DebugHttpClient: stdDebugClient :: HttpClient c => c -> DebugClient c
- Network.OAuth.Http.DebugHttpClient: traceErr :: DebugClient c -> String -> IO ()
- Network.OAuth.Http.DebugHttpClient: traceRp :: DebugClient c -> Response -> IO ()
- Network.OAuth.Http.DebugHttpClient: traceRq :: DebugClient c -> Request -> IO ()
+ Network.OAuth.Http.CurlHttpClient: OptionsCurlClient :: [CurlOption] -> CurlClient

Files

hoauth.cabal view
@@ -1,5 +1,5 @@ name: hoauth-version: 0.3.2.1+version: 0.3.3 category: Network,Protocol,OAuth license: BSD3 license-file: LICENSE@@ -33,7 +33,6 @@                  , Network.OAuth.Http.Response                  , Network.OAuth.Http.HttpClient                  , Network.OAuth.Http.CurlHttpClient-                 , Network.OAuth.Http.DebugHttpClient                  , Network.OAuth.Http.PercentEncoding                  , Network.OAuth.Http.Util                  , Network.OAuth.Consumer
src/main/haskell/Network/OAuth/Http/CurlHttpClient.hs view
@@ -39,17 +39,17 @@ import Data.Char (chr,ord) import qualified Data.ByteString.Lazy as B -data CurlClient = CurlClient+data CurlClient = CurlClient | OptionsCurlClient [CurlOption]  instance HttpClient CurlClient where-  runClient _ req = liftIO $ withCurlDo $ do { c <- initialize-                                             ; setopts c opts-                                             ; rsp <- perform_with_response_ c-                                             ; case (respCurlCode rsp)-                                               of errno-                                                    | errno `elem` successCodes -> return $ Right (fromResponse rsp)-                                                    | otherwise                 -> return $ Left (show errno)-                                             }+  runClient client req = liftIO $ withCurlDo $ do { c <- initialize+                                                  ; setopts c opts+                                                  ; rsp <- perform_with_response_ c+                                                  ; case (respCurlCode rsp)+                                                    of errno+                                                         | errno `elem` successCodes -> return $ Right (fromResponse rsp)+                                                         | otherwise                 -> return $ Left (show errno)+                                                  }     where httpVersion = case (version req)                         of Http10 -> HttpVersion10                            Http11 -> HttpVersion11@@ -83,5 +83,10 @@                  ] ++ curlHeaders                    ++ curlMethod                     ++ curlPostData+                   ++ clientOptions+          +          clientOptions = case client+                               of CurlClient -> []+                                  OptionsCurlClient o -> o                      fromResponse rsp = RspHttp (respStatus rsp) (respStatusLine rsp) (fromList.respHeaders $ rsp) (B.pack.map (fromIntegral.ord).respBody $ rsp)
− src/main/haskell/Network/OAuth/Http/DebugHttpClient.hs
@@ -1,59 +0,0 @@--- Copyright (c) 2009, Diego Souza--- All rights reserved.--- --- Redistribution and use in source and binary forms, with or without--- modification, are permitted provided that the following conditions are met:--- ---   * Redistributions of source code must retain the above copyright notice,---     this list of conditions and the following disclaimer.---   * Redistributions in binary form must reproduce the above copyright notice,---     this list of conditions and the following disclaimer in the documentation---     and/or other materials provided with the distribution.---   * Neither the name of the <ORGANIZATION> nor the names of its contributors---     may be used to endorse or promote products derived from this software---     without specific prior written permission.--- --- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND--- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED--- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE--- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE--- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL--- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR--- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER--- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,--- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE--- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.---- | Minimum definition of a user agent required to implement oauth--- service calls. This should suffice for most applications.-module Network.OAuth.Http.DebugHttpClient-       ( DebugClient(..)-       , stdDebugClient-       ) where--import Network.OAuth.Http.HttpClient-import Network.OAuth.Http.Request-import Network.OAuth.Http.Response-import Control.Monad.Trans---- | A client that is able to debug interaction with HTTP servers.-data DebugClient c = DebugClient { backend  :: c-                                 , traceRq  :: Request -> IO ()-                                 , traceRp  :: Response -> IO ()-                                 , traceErr :: String -> IO ()-                                 }---- | Creates the a instance which prints messages using putStrLn.-stdDebugClient :: (HttpClient c) => c -> DebugClient c-stdDebugClient c = DebugClient { backend  = c-                               , traceRq  = putStrLn . ("Request: " ++) . show-                               , traceRp  = putStrLn . ("Response: " ++) . show-                               , traceErr = putStrLn . ("Error: "++) . show-                               }--instance (HttpClient c) => HttpClient (DebugClient c) where-  runClient debug req = do { liftIO (traceRq debug $ req)-                           ; rsp <- runClient (backend debug) req-                           ; liftIO (either (traceErr debug) (traceRp debug) $ rsp)-                           ; return rsp-                           }