packages feed

haskoin-store-data 0.50.1 → 0.51.0

raw patch · 5 files changed

+34/−44 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Haskoin.Store.Data: instance Data.Binary.Class.Binary Haskoin.Store.Data.Except
- Haskoin.Store.Data: instance Data.Bytes.Serial.Serial Haskoin.Store.Data.Except
- Haskoin.Store.Data: instance Data.Serialize.Serialize Haskoin.Store.Data.Except
+ Haskoin.Store.Data: RequestTooLarge :: Except

Files

CHANGELOG.md view
@@ -4,6 +4,28 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html) +## 0.51.0+### Fixed+- Data type for RequestTooLarge was missing.++## 0.50.3+### Added+- Log HTTP request bodies.++### Removed+- Remove web request timeout.++### Fixed+- Do not ignore unknown start tx anchors in conduits.+- Use fast transaction counting in cache.++### Changed+- Use WAI middlewares to manage stats.++## 0.50.2+### Fixed+- Do not use lazy parsers for incoming data that may throw exceptions.+ ## 0.50.1 ### Fixed - Do not allow incoming POST requests of unlimited body size.
haskoin-store-data.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 13f8f0ba579a236b57f68a26931aa6432e0f8764138f16dba038e157f3c01c76+-- hash: 0b8de92bdb68810249bfd7cce65a70ac0f0d175350afcb656d80ed2d7576b6fd  name:           haskoin-store-data-version:        0.50.1+version:        0.51.0 synopsis:       Data for Haskoin Store description:    Please see the README on GitHub at <https://github.com/haskoin/haskoin-store#readme> category:       Bitcoin, Finance, Network
src/Haskoin/Store/Data.hs view
@@ -2101,46 +2101,9 @@     | StringError !String     | TxIndexConflict ![TxHash]     | ServerTimeout+    | RequestTooLarge     deriving (Show, Eq, Ord, Generic, NFData) -instance Serial Except where-    serialize ThingNotFound =-        putWord8 0x00-    serialize ServerError =-        putWord8 0x01-    serialize BadRequest =-        putWord8 0x02-    serialize (UserError s) = do-        putWord8 0x03-        putLengthBytes (TE.encodeUtf8 (T.pack s))-    serialize (StringError s) = do-        putWord8 0x04-        putLengthBytes (TE.encodeUtf8 (T.pack s))-    serialize (TxIndexConflict ts) = do-        putWord8 0x05-        putList serialize ts-    serialize ServerTimeout = do-        putWord8 0x06--    deserialize =-        getWord8 >>= \case-        0x00 -> return ThingNotFound-        0x01 -> return ServerError-        0x02 -> return BadRequest-        0x03 -> UserError . T.unpack . TE.decodeUtf8 <$> getLengthBytes-        0x04 -> StringError . T.unpack . TE.decodeUtf8 <$> getLengthBytes-        0x05 -> TxIndexConflict <$> getList deserialize-        0x06 -> return ServerTimeout-        _    -> fail "Cannot recognize exception"--instance Serialize Except where-    put = serialize-    get = deserialize--instance Binary Except where-    put = serialize-    get = deserialize- instance Exception Except  instance ScottyError Except where@@ -2174,6 +2137,9 @@             ServerTimeout ->                 [ "error" .= String "server-timeout"                 , "message" .= String "Request is taking too long" ]+            RequestTooLarge ->+                [ "error" .= String "request-too-large"+                , "message" .= String "Request body too large" ]  instance FromJSON Except where     parseJSON =@@ -2196,6 +2162,8 @@                     return $ TxIndexConflict txids                 String "server-timeout" ->                     return ServerTimeout+                String "request-too-large" ->+                    return RequestTooLarge                 _ -> mzero  toIntTxId :: TxHash -> Word64
src/Haskoin/Store/WebClient.hs view
@@ -66,6 +66,7 @@ import           Control.Exception import           Control.Lens              ((.~), (?~), (^.)) import           Control.Monad.Except+import qualified Data.Aeson                as A import           Data.Bytes.Get import           Data.Bytes.Put import           Data.Bytes.Serial@@ -237,11 +238,11 @@     | statusIsSuccessful status = return ()     | isHealthPath && code == 503 = return () -- Ignore health checks     | otherwise = do-        e <- runGetS deserialize <$> res ^. HTTP.responseBody+        e <- A.decodeStrict <$> res ^. HTTP.responseBody         throwIO $             case e of-                Right except -> except :: Store.Except-                _            -> Store.StringError err+                Just except -> except :: Store.Except+                Nothing     -> Store.StringError "could not decode error"   where     code = res ^. HTTP.responseStatus . HTTP.statusCode     message = res ^. HTTP.responseStatus . HTTP.statusMessage
test/Haskoin/Store/DataSpec.hs view
@@ -47,7 +47,6 @@     , SerialBox (arbitrary :: Gen (GenericResult BlockData))     , SerialBox (arbitrary :: Gen (RawResult BlockData))     , SerialBox (arbitrary :: Gen (RawResultList BlockData))-    , SerialBox (arbitrary :: Gen Except)     ]  jsonVals :: [JsonBox]