Hello community, here is the log from the commit of package ghc-http-client for openSUSE:Factory checked in at 2016-07-05 09:52:28 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-http-client (Old) and /work/SRC/openSUSE:Factory/.ghc-http-client.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-http-client" Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-http-client/ghc-http-client.changes 2016-06-25 02:21:50.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-http-client.new/ghc-http-client.changes 2016-07-05 09:52:49.000000000 +0200 @@ -1,0 +2,7 @@ +Sun Jul 3 12:10:09 UTC 2016 - [email protected] + +- update to 0.4.30 +* Deprecate parseUrl +* Add parseUrlThrow, parseRequest, and parseRequest_ + +------------------------------------------------------------------- Old: ---- http-client-0.4.29.tar.gz New: ---- http-client-0.4.30.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-http-client.spec ++++++ --- /var/tmp/diff_new_pack.vtoMiY/_old 2016-07-05 09:52:50.000000000 +0200 +++ /var/tmp/diff_new_pack.vtoMiY/_new 2016-07-05 09:52:50.000000000 +0200 @@ -21,7 +21,7 @@ %bcond_with tests Name: ghc-http-client -Version: 0.4.29 +Version: 0.4.30 Release: 0 Summary: HTTP client engine, intended as a base layer License: MIT ++++++ http-client-0.4.29.tar.gz -> http-client-0.4.30.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-client-0.4.29/ChangeLog.md new/http-client-0.4.30/ChangeLog.md --- old/http-client-0.4.29/ChangeLog.md 2016-06-16 14:06:36.000000000 +0200 +++ new/http-client-0.4.30/ChangeLog.md 2016-06-30 11:33:51.000000000 +0200 @@ -1,3 +1,9 @@ +## 0.4.30 + +* Initial implementation of [#193](https://github.com/snoyberg/http-client/issues/193) + * Deprecate `parseUrl` + * Add `parseUrlThrow`, `parseRequest`, and `parseRequest_` + ## 0.4.29 * Changed the order of connecting a socket and tweaking a socket, such that the socket tweaking callback now happen before connecting. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-client-0.4.29/Network/HTTP/Client/MultipartFormData.hs new/http-client-0.4.30/Network/HTTP/Client/MultipartFormData.hs --- old/http-client-0.4.29/Network/HTTP/Client/MultipartFormData.hs 2016-06-16 14:06:36.000000000 +0200 +++ new/http-client-0.4.30/Network/HTTP/Client/MultipartFormData.hs 2016-06-30 11:33:51.000000000 +0200 @@ -11,9 +11,9 @@ -- > import Control.Monad -- > -- > main = withSocketsDo $ void $ withManager defaultManagerSettings $ \m -> do --- > req1 <- parseUrl "http://random-cat-photo.net/cat.jpg" +-- > req1 <- parseRequest "http://random-cat-photo.net/cat.jpg" -- > res <- httpLbs req1 m --- > req2 <- parseUrl "http://example.org/~friedrich/blog/addPost.hs" +-- > req2 <- parseRequest "http://example.org/~friedrich/blog/addPost.hs" -- > flip httpLbs m =<< -- > (formDataBody [partBS "title" "Bleaurgh" -- > ,partBS "text" $ TE.encodeUtf8 "矢田矢田矢田矢田矢田" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-client-0.4.29/Network/HTTP/Client/Request.hs new/http-client-0.4.30/Network/HTTP/Client/Request.hs --- old/http-client-0.4.29/Network/HTTP/Client/Request.hs 2016-06-16 14:06:36.000000000 +0200 +++ new/http-client-0.4.30/Network/HTTP/Client/Request.hs 2016-06-30 11:33:51.000000000 +0200 @@ -8,6 +8,10 @@ module Network.HTTP.Client.Request ( parseUrl + , parseUrlThrow + , parseRequest + , parseRequest_ + , defaultRequest , setUriRelative , getUri , setUri @@ -67,6 +71,36 @@ import System.IO (withBinaryFile, hTell, hFileSize, Handle, IOMode (ReadMode)) import Control.Monad (liftM) +-- | Deprecated synonym for 'parseUrlThrow'. You probably want +-- 'parseRequest' or 'parseRequest_' instead. +-- +-- @since 0.1.0 +parseUrl :: MonadThrow m => String -> m Request +parseUrl = parseUrlThrow +{-# DEPRECATED parseUrl "Please use parseUrlThrow, parseRequest, or parseRequest_ instead" #-} + +-- | Same as 'parseRequest', except will throw an 'HttpException' in +-- the event of a non-2XX response. +-- +-- @since 0.4.30 +parseUrlThrow :: MonadThrow m => String -> m Request +parseUrlThrow s' = + case parseURI (encode s) of + Just uri -> liftM setMethod (setUri def uri) + Nothing -> throwM $ InvalidUrlException s "Invalid URL" + where + encode = escapeURIString isAllowedInURI + (mmethod, s) = + case break (== ' ') s' of + (x, ' ':y) | all (\c -> 'A' <= c && c <= 'Z') x -> (Just x, y) + _ -> (Nothing, s') + + setMethod req = + case mmethod of + Nothing -> req + Just m -> req { method = S8.pack m } + + -- | Convert a URL into a 'Request'. -- -- This defaults some of the values in 'Request', such as setting 'method' to @@ -79,28 +113,23 @@ -- space, e.g.: -- -- @@@ --- parseUrl "POST http://httpbin.org/post" +-- parseRequeset "POST http://httpbin.org/post" -- @@@ -- -- Note that the request method must be provided as all capital letters. -- --- Since 0.1.0 -parseUrl :: MonadThrow m => String -> m Request -parseUrl s' = - case parseURI (encode s) of - Just uri -> liftM setMethod (setUri def uri) - Nothing -> throwM $ InvalidUrlException s "Invalid URL" +-- @since 0.4.30 +parseRequest :: MonadThrow m => String -> m Request +parseRequest = + liftM noThrow . parseUrlThrow where - encode = escapeURIString isAllowedInURI - (mmethod, s) = - case break (== ' ') s' of - (x, ' ':y) | all (\c -> 'A' <= c && c <= 'Z') x -> (Just x, y) - _ -> (Nothing, s') + noThrow req = req { checkStatus = \_ _ _ -> Nothing } - setMethod req = - case mmethod of - Nothing -> req - Just m -> req { method = S8.pack m } +-- | Same as 'parseRequest', but in the cases of a parse error +-- generates an impure exception. Mostly useful for static strings which +-- are known to be correctly formatted. +parseRequest_ :: String -> Request +parseRequest_ = either throw id . parseRequest -- | Add a 'URI' to the request. If it is absolute (includes a host name), add -- it as per 'setUri'; if it is relative, merge it with the existing request. @@ -219,6 +248,12 @@ useDefaultTimeout :: Maybe Int useDefaultTimeout = Just (-3425) +-- | A default request value +-- +-- @since 0.4.30 +defaultRequest :: Request +defaultRequest = def { checkStatus = \_ _ _ -> Nothing } + instance Default Request where def = Request { host = "localhost" @@ -280,7 +315,7 @@ -- | Add a Basic Auth header (with the specified user name and password) to the -- given Request. Ignore error handling: -- --- > applyBasicAuth "user" "pass" $ fromJust $ parseUrl url +-- > applyBasicAuth "user" "pass" $ parseRequest_ url -- -- Since 0.1.0 applyBasicAuth :: S.ByteString -> S.ByteString -> Request -> Request @@ -301,7 +336,7 @@ -- | Add a Proxy-Authorization header (with the specified username and -- password) to the given 'Request'. Ignore error handling: -- --- > applyBasicProxyAuth "user" "pass" <$> parseUrl "http://example.org" +-- > applyBasicProxyAuth "user" "pass" <$> parseRequest "http://example.org" -- -- Since 0.3.4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-client-0.4.29/Network/HTTP/Client/Response.hs new/http-client-0.4.30/Network/HTTP/Client/Response.hs --- old/http-client-0.4.29/Network/HTTP/Client/Response.hs 2016-06-16 14:06:36.000000000 +0200 +++ new/http-client-0.4.30/Network/HTTP/Client/Response.hs 2016-06-30 11:33:51.000000000 +0200 @@ -33,7 +33,7 @@ -- a new request from the old request, the server headers returned with the -- redirection, and the redirection code itself. This function returns 'Nothing' -- if the code is not a 3xx, there is no 'location' header included, or if the --- redirected response couldn't be parsed with 'parseUrl'. +-- redirected response couldn't be parsed with 'parseRequest'. -- -- If a user of this library wants to know the url chain that results from a -- specific request, that user has to re-implement the redirect-following logic diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-client-0.4.29/Network/HTTP/Client/Types.hs new/http-client-0.4.30/Network/HTTP/Client/Types.hs --- old/http-client-0.4.29/Network/HTTP/Client/Types.hs 2016-06-16 14:06:36.000000000 +0200 +++ new/http-client-0.4.30/Network/HTTP/Client/Types.hs 2016-06-30 11:33:51.000000000 +0200 @@ -307,17 +307,17 @@ -- | All information on how to connect to a host and what should be sent in the -- HTTP request. -- --- If you simply wish to download from a URL, see 'parseUrl'. +-- If you simply wish to download from a URL, see 'parseRequest'. -- -- The constructor for this data type is not exposed. Instead, you should use --- either the 'def' method to retrieve a default instance, or 'parseUrl' to +-- either the 'defaultRequest' value, or 'parseRequest' to -- construct from a URL, and then use the records below to make modifications. -- This approach allows http-client to add configuration options without -- breaking backwards compatibility. -- -- For example, to construct a POST request, you could do something like: -- --- > initReq <- parseUrl "http://www.example.com/path" +-- > initReq <- parseRequest "http://www.example.com/path" -- > let req = initReq -- > { method = "POST" -- > } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-client-0.4.29/Network/HTTP/Client.hs new/http-client-0.4.30/Network/HTTP/Client.hs --- old/http-client-0.4.29/Network/HTTP/Client.hs 2016-06-16 14:06:36.000000000 +0200 +++ new/http-client-0.4.30/Network/HTTP/Client.hs 2016-06-30 11:33:51.000000000 +0200 @@ -49,7 +49,7 @@ -- The next core component is a 'Request', which represents a single HTTP -- request to be sent to a specific server. 'Request's allow for many settings -- to control exact how they function, but usually the simplest approach for --- creating a 'Request' is to use 'parseUrl'. +-- creating a 'Request' is to use 'parseRequest'. -- -- Finally, a 'Response' is the result of sending a single 'Request' to a -- server, over a connection which was acquired from a 'Manager'. Note that you @@ -70,7 +70,7 @@ -- 'applyBasicAuth' are guaranteed to be total (or there\'s a bug in the -- library). -- --- One thing to be cautioned about: the type of 'parseUrl' allows it to work in +-- One thing to be cautioned about: the type of 'parseRequest' allows it to work in -- different monads. If used in the 'IO' monad, it will throw an exception in -- the case of an invalid URI. In addition, if you leverage the @IsString@ -- instance of the 'Request' value via @OverloadedStrings@, an invalid URI will @@ -129,6 +129,11 @@ , rawConnectionModifySocket -- * Request , parseUrl + , parseUrlThrow + , parseRequest + , parseRequest_ + , defaultRequest + , applyBasicAuth , urlEncodedBody , getUri @@ -296,7 +301,7 @@ -- > main = do -- > manager <- newManager defaultManagerSettings -- > --- > request <- parseUrl "http://httpbin.org/post" +-- > request <- parseRequest "http://httpbin.org/post" -- > response <- httpLbs request manager -- > -- > putStrLn $ "The status code was: " ++ (show $ statusCode $ responseStatus response) @@ -316,7 +321,7 @@ -- > -- > -- Create the request -- > let requestObject = object ["name" .= "Michael", "age" .= 30] --- > initialRequest <- parseUrl "http://httpbin.org/post" +-- > initialRequest <- parseRequest "http://httpbin.org/post" -- > let request = initialRequest { method = "POST", requestBody = RequestBodyLBS $ encode requestObject } -- > -- > response <- httpLbs request manager diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-client-0.4.29/http-client.cabal new/http-client-0.4.30/http-client.cabal --- old/http-client-0.4.29/http-client.cabal 2016-06-16 14:06:36.000000000 +0200 +++ new/http-client-0.4.30/http-client.cabal 2016-06-30 11:33:51.000000000 +0200 @@ -1,5 +1,5 @@ name: http-client -version: 0.4.29 +version: 0.4.30 synopsis: An HTTP client engine, intended as a base layer for more user-friendly packages. description: Hackage documentation generation is not reliable. For up to date documentation, please see: <http://www.stackage.org/package/http-client>. homepage: https://github.com/snoyberg/http-client
