Hello community,
here is the log from the commit of package ghc-http-client for openSUSE:Factory
checked in at 2019-01-25 22:43:21
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-http-client (Old)
and /work/SRC/openSUSE:Factory/.ghc-http-client.new.28833 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-http-client"
Fri Jan 25 22:43:21 2019 rev:29 rq:667138 version:0.6.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-http-client/ghc-http-client.changes
2018-12-06 12:16:27.469575156 +0100
+++
/work/SRC/openSUSE:Factory/.ghc-http-client.new.28833/ghc-http-client.changes
2019-01-25 22:43:23.187226637 +0100
@@ -1,0 +2,18 @@
+Tue Jan 15 03:03:10 UTC 2019 - [email protected]
+
+- Update http-client to version 0.6.1.
+ ## 0.6.1
+
+ * Add `setUriEither` to `Network.HTTP.Client.Internal`
+
+-------------------------------------------------------------------
+Thu Jan 10 15:43:32 UTC 2019 - [email protected]
+
+- Update http-client to version 0.6.0.
+ ## 0.6.0
+
+ * Generalize `renderParts` over arbitrary applicative functors. One
particular
+ use case that is enabled by this change is that now `renderParts` can be
used
+ in pure code by using it in combination with `runIdentity`.
+
+-------------------------------------------------------------------
Old:
----
http-client-0.5.14.tar.gz
New:
----
http-client-0.6.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-http-client.spec ++++++
--- /var/tmp/diff_new_pack.m5IVHo/_old 2019-01-25 22:43:23.815225863 +0100
+++ /var/tmp/diff_new_pack.m5IVHo/_new 2019-01-25 22:43:23.819225859 +0100
@@ -1,7 +1,7 @@
#
# spec file for package ghc-http-client
#
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -19,7 +19,7 @@
%global pkg_name http-client
%bcond_with tests
Name: ghc-%{pkg_name}
-Version: 0.5.14
+Version: 0.6.1
Release: 0
Summary: An HTTP client engine
License: MIT
++++++ http-client-0.5.14.tar.gz -> http-client-0.6.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/http-client-0.5.14/ChangeLog.md
new/http-client-0.6.1/ChangeLog.md
--- old/http-client-0.5.14/ChangeLog.md 2018-11-19 08:40:08.000000000 +0100
+++ new/http-client-0.6.1/ChangeLog.md 2019-01-14 09:10:16.000000000 +0100
@@ -1,5 +1,15 @@
# Changelog for http-client
+## 0.6.1
+
+* Add `setUriEither` to `Network.HTTP.Client.Internal`
+
+## 0.6.0
+
+* Generalize `renderParts` over arbitrary applicative functors. One particular
+ use case that is enabled by this change is that now `renderParts` can be used
+ in pure code by using it in combination with `runIdentity`.
+
## 0.5.14
* Omit port for `getUri` when protocol is `http` and port is `80`, or when
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/http-client-0.5.14/Network/HTTP/Client/MultipartFormData.hs
new/http-client-0.6.1/Network/HTTP/Client/MultipartFormData.hs
--- old/http-client-0.5.14/Network/HTTP/Client/MultipartFormData.hs
2018-04-09 15:40:11.000000000 +0200
+++ new/http-client-0.6.1/Network/HTTP/Client/MultipartFormData.hs
2019-01-09 07:58:41.000000000 +0100
@@ -24,6 +24,7 @@
(
-- * Part type
Part
+ ,PartM
,partName
,partFilename
,partContentType
@@ -77,17 +78,19 @@
import Control.Monad
import Data.ByteString.Lazy.Internal (defaultChunkSize)
+type Part = PartM IO
+
-- | A single part of a multipart message.
-data Part = Part
+data PartM m = Part
{ partName :: Text -- ^ Name of the corresponding \<input\>
, partFilename :: Maybe String -- ^ A file name, if this is an attached
file
, partContentType :: Maybe MimeType -- ^ Content type
, partHeaders :: [Header] -- ^ List of additional headers
- , partGetBody :: IO RequestBody -- ^ Action in m which returns the body
+ , partGetBody :: m RequestBody -- ^ Action in m which returns the body
-- of a message.
}
-instance Show Part where
+instance Show (PartM m) where
showsPrec d (Part n f c h _) =
showParen (d>=11) $ showString "Part "
. showsPrec 11 n
@@ -104,19 +107,21 @@
--
-- The 'Part' does not have a file name or content type associated
-- with it.
-partBS :: Text -- ^ Name of the corresponding \<input\>.
+partBS :: Applicative m
+ => Text -- ^ Name of the corresponding \<input\>.
-> BS.ByteString -- ^ The body for this 'Part'.
- -> Part
-partBS n b = Part n Data.Monoid.mempty mempty mempty $ return $ RequestBodyBS b
+ -> PartM m
+partBS n b = Part n Data.Monoid.mempty mempty mempty $ pure $ RequestBodyBS b
-- | Make a 'Part' whose content is a lazy 'BL.ByteString'.
--
-- The 'Part' does not have a file name or content type associated
-- with it.
-partLBS :: Text -- ^ Name of the corresponding \<input\>.
+partLBS :: Applicative m
+ => Text -- ^ Name of the corresponding \<input\>.
-> BL.ByteString -- ^ The body for this 'Part'.
- -> Part
-partLBS n b = Part n mempty mempty mempty $ return $ RequestBodyLBS b
+ -> PartM m
+partLBS n b = Part n mempty mempty mempty $ pure $ RequestBodyLBS b
-- | Make a 'Part' from a file.
--
@@ -179,12 +184,13 @@
-- > partFileRequestBody "file" mempty mempty
--
-- The 'Part' does not have a content type associated with it.
-partFileRequestBody :: Text -- ^ Name of the corresponding \<input\>.
+partFileRequestBody :: Applicative m
+ => Text -- ^ Name of the corresponding \<input\>.
-> FilePath -- ^ File name to supply to the server.
-> RequestBody -- ^ Data to upload.
- -> Part
+ -> PartM m
partFileRequestBody n f rqb =
- partFileRequestBodyM n f $ return rqb
+ partFileRequestBodyM n f $ pure rqb
-- | Construct a 'Part' from action returning the 'RequestBody'
--
@@ -195,8 +201,8 @@
-- The 'Part' does not have a content type associated with it.
partFileRequestBodyM :: Text -- ^ Name of the corresponding \<input\>.
-> FilePath -- ^ File name to supply to the server.
- -> IO RequestBody -- ^ Action that will supply data to
upload.
- -> Part
+ -> m RequestBody -- ^ Action that will supply data to
upload.
+ -> PartM m
partFileRequestBodyM n f rqb =
Part n (Just f) (Just $ defaultMimeLookup $ pack f) mempty rqb
@@ -205,12 +211,13 @@
cp bs = RequestBodyBuilder (fromIntegral $ BS.length bs) $ copyByteString bs
-- | Add a list of additional headers to this 'Part'.
-addPartHeaders :: Part -> [Header] -> Part
+addPartHeaders :: PartM m -> [Header] -> PartM m
addPartHeaders p hs = p { partHeaders = partHeaders p <> hs }
-renderPart :: BS.ByteString -- ^ Boundary between parts.
- -> Part -> IO RequestBody
-renderPart boundary (Part name mfilename mcontenttype hdrs get) = liftM render
get
+renderPart :: Functor m
+ => BS.ByteString -- ^ Boundary between parts.
+ -> PartM m -> m RequestBody
+renderPart boundary (Part name mfilename mcontenttype hdrs get) = render <$>
get
where render renderBody =
cp "--" <> cp boundary <> cp "\r\n"
<> cp "Content-Disposition: form-data; name=\""
@@ -234,9 +241,10 @@
<> renderBody <> cp "\r\n"
-- | Combine the 'Part's to form multipart/form-data body
-renderParts :: BS.ByteString -- ^ Boundary between parts.
- -> [Part] -> IO RequestBody
-renderParts boundary parts = (fin . mconcat) `liftM` mapM (renderPart
boundary) parts
+renderParts :: Applicative m
+ => BS.ByteString -- ^ Boundary between parts.
+ -> [PartM m] -> m RequestBody
+renderParts boundary parts = (fin . mconcat) <$> traverse (renderPart
boundary) parts
where fin = (<> cp "--" <> cp boundary <> cp "--\r\n")
-- | Generate a boundary simillar to those generated by WebKit-based browsers.
@@ -273,13 +281,12 @@
formDataBodyWithBoundary boundary a b
-- | Add form data with supplied boundary
-formDataBodyWithBoundary :: BS.ByteString -> [Part] -> Request -> IO Request
+formDataBodyWithBoundary :: Applicative m => BS.ByteString -> [PartM m] ->
Request -> m Request
formDataBodyWithBoundary boundary parts req = do
- body <- renderParts boundary parts
- return $ req
+ (\ body -> req
{ method = methodPost
, requestHeaders =
(hContentType, "multipart/form-data; boundary=" <> boundary)
: Prelude.filter (\(x, _) -> x /= hContentType) (requestHeaders req)
, requestBody = body
- }
+ }) <$> renderParts boundary parts
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/http-client-0.5.14/Network/HTTP/Client/Request.hs
new/http-client-0.6.1/Network/HTTP/Client/Request.hs
--- old/http-client-0.5.14/Network/HTTP/Client/Request.hs 2018-11-19
06:27:06.000000000 +0100
+++ new/http-client-0.6.1/Network/HTTP/Client/Request.hs 2019-01-14
09:10:16.000000000 +0100
@@ -17,6 +17,7 @@
, setUriRelative
, getUri
, setUri
+ , setUriEither
, browserDecompress
, alwaysDecompress
, addProxy
@@ -226,9 +227,18 @@
-- | Validate a 'URI', then add it to the request.
setUri :: MonadThrow m => Request -> URI -> m Request
-setUri req uri = do
+setUri req uri = either throwInvalidUrlException return (setUriEither req uri)
+ where
+ throwInvalidUrlException = throwM . InvalidUrlException (show uri)
+
+-- | A variant of `setUri` that returns an error message on validation errors,
+-- instead of propagating them with `throwM`.
+--
+-- @since 0.6.1
+setUriEither :: Request -> URI -> Either String Request
+setUriEither req uri = do
sec <- parseScheme uri
- auth <- maybe (failUri "URL must be absolute") return $ uriAuthority uri
+ auth <- maybe (Left "URL must be absolute") return $ uriAuthority uri
port' <- parsePort sec auth
return $ applyAnyUriBasedAuth uri req
{ host = S8.pack $ uriRegName auth
@@ -241,20 +251,17 @@
, queryString = S8.pack $ uriQuery uri
}
where
- failUri :: MonadThrow m => String -> m a
- failUri = throwM . InvalidUrlException (show uri)
-
parseScheme URI{uriScheme = scheme} =
case map toLower scheme of
"http:" -> return False
"https:" -> return True
- _ -> failUri "Invalid scheme"
+ _ -> Left "Invalid scheme"
parsePort sec URIAuth{uriPort = portStr} =
case portStr of
-- If the user specifies a port, then use it
':':rest -> maybe
- (failUri "Invalid port")
+ (Left "Invalid port")
return
(readDec rest)
-- Otherwise, use the default port
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/http-client-0.5.14/http-client.cabal
new/http-client-0.6.1/http-client.cabal
--- old/http-client-0.5.14/http-client.cabal 2018-11-19 06:27:06.000000000
+0100
+++ new/http-client-0.6.1/http-client.cabal 2019-01-14 09:10:16.000000000
+0100
@@ -1,5 +1,5 @@
name: http-client
-version: 0.5.14
+version: 0.6.1
synopsis: An HTTP client engine
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