packages feed

servant-http2-client 0.1.0.1 → 0.1.0.2

raw patch · 3 files changed

+14/−8 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

ChangeLog.md view
@@ -2,6 +2,11 @@  ## Unreleased changes +## v0.1.0.2++- performance improvement to parsing statuses+- performance improvement to generating content-length headers+ ## v0.1.0.1 - compact transfers for requests with no body or when chunking has empty bytestrings (see https://github.com/lucasdicioccio/servant-http2-client/issues/1 and https://github.com/yesodweb/wai/issues/717) 
servant-http2-client.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: e352f7dda8407f7f694c6418b746407bfd6e634a996cd13a2dba4fdf7164dcc0+-- hash: 6b01395f8a2a1378dbcf88243a058468c5b3e6464cf2bd933080fb9ee96e9d77  name:           servant-http2-client-version:        0.1.0.1+version:        0.1.0.2 synopsis:       Generate HTTP2 clients from Servant API descriptions. description:    Please see the README on GitHub at <https://github.com/lucasdicioccio/servant-http2-client#readme> category:       Web
src/Network/HTTP2/Client/Servant.hs view
@@ -23,6 +23,7 @@ import           Control.Monad.Error.Class   (MonadError (..)) import           Control.Monad.Reader (MonadReader, ReaderT, ask, runReaderT) import           Data.Binary.Builder (toLazyByteString)+import           Data.ByteString.Builder (intDec, int64Dec) import           Data.ByteString.Char8 (ByteString) import qualified Data.ByteString.Char8 as ByteString import           Data.ByteString.Lazy (fromStrict, toStrict, toChunks)@@ -38,7 +39,6 @@ import           Network.HTTP.Types.Status (Status(..)) import           Network.HTTP.Types.Version (http20) import qualified Data.CaseInsensitive as CI-import           Text.Read (readMaybe)   import           Network.HTTP2.Client@@ -107,7 +107,7 @@             (RequestBodyBS bs)  -> pure $                 (Just $ onlySegment bs,                     [ ("Content-Type", renderHeader ct)-                    , ("Content-Length", ByteString.pack $ show $ ByteString.length bs)+                    , ("Content-Length", toStrict $ toLazyByteString $ intDec $ ByteString.length bs)                     ])             (RequestBodyLBS lbs) -> pure $                 (Just $ multiSegments $ toChunks lbs,@@ -117,12 +117,12 @@                 let lbs = toLazyByteString builder in pure $                 (Just $ multiSegments $ toChunks lbs,                     [ ("Content-Type", renderHeader ct)-                    , ("Content-Length", ByteString.pack $ show n)+                    , ("Content-Length", toStrict $ toLazyByteString $ int64Dec n)                     ])             (RequestBodyStream n act) -> pure $                 (Just act,                     [ ("Content-Type", renderHeader ct)-                    , ("Content-Length", ByteString.pack $ show n)+                    , ("Content-Length", toStrict $ toLazyByteString $ int64Dec n)                     ])             (RequestBodyStreamChunked act) -> pure $                 (Just act,@@ -143,7 +143,7 @@         , (":scheme", "https")         , (":path", toStrict $ toLazyByteString $ requestPath req)         , (":authority", authority)-        , ("Accept", ByteString.intercalate "," $ toList $ fmap renderHeader $ requestAccept req)+        , ("Accept", ByteString.intercalate "," $ fmap renderHeader $ toList $ requestAccept req)         , ("User-Agent", "servant-http2-client/dev")         ]     reqHeaders = [(CI.original h, hv) | (h,hv) <- toList (requestHeaders req)]@@ -192,8 +192,9 @@              http20              (fromStrict body) +{-# INLINEABLE lookupStatus #-} lookupStatus :: HeaderList -> Maybe Int-lookupStatus = lookup ":status" >=> readMaybe . ByteString.unpack+lookupStatus = lookup ":status" >=> fmap fst . ByteString.readInt  replenishFlowControls   :: IncomingFlowControl -> IncomingFlowControl -> Int -> IO ()