uri-bytestring 0.1.9.1 → 0.1.9.2
raw patch · 4 files changed
+20/−6 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- changelog.md +3/−0
- src/URI/ByteString/Internal.hs +9/−5
- test/URI/ByteStringTests.hs +7/−0
- uri-bytestring.cabal +1/−1
changelog.md view
@@ -1,3 +1,6 @@+0.1.9.2+* Fix bug wher trailing ampersand in the query section would not parse.+ 0.1.9 * Fix type bug in serializeRelativeRef'
src/URI/ByteString/Internal.hs view
@@ -407,7 +407,8 @@ | otherwise -> fail' MalformedPath _ -> pure mempty where- itemsParser = Query <$> A.sepBy' (queryItemParser opts) (word8' ampersand)+ itemsParser = Query . filter neQuery <$> A.sepBy' (queryItemParser opts) (word8' ampersand)+ neQuery (k, _) = not (BS.null k) -------------------------------------------------------------------------------@@ -416,10 +417,13 @@ -- optional. & separators need to be handled further up. queryItemParser :: URIParserOptions -> URIParser (ByteString, ByteString) queryItemParser opts = do- s <- A.takeWhile1 (upoValidQueryChar opts) `orFailWith` MalformedQuery- let (k, vWithEquals) = BS.break (== equals) s- let v = BS.drop 1 vWithEquals- return (urlDecodeQuery k, urlDecodeQuery v)+ s <- A.takeWhile (upoValidQueryChar opts) `orFailWith` MalformedQuery+ if BS.null s+ then return (mempty, mempty)+ else do+ let (k, vWithEquals) = BS.break (== equals) s+ let v = BS.drop 1 vWithEquals+ return (urlDecodeQuery k, urlDecodeQuery v) -------------------------------------------------------------------------------
test/URI/ByteStringTests.hs view
@@ -57,6 +57,13 @@ "" (Query [("foo", "bar"), ("foo", "baz quux")]) (Just "frag")+ -- trailing &+ , testParses "http://www.example.org?foo=bar&" $+ URI (Scheme "http")+ (Just (Authority Nothing (Host "www.example.org") Nothing))+ ""+ (Query [("foo", "bar")])+ Nothing , testParses "http://www.google.com:80/aclk?sa=l&ai=CChPOVvnoU8fMDI_QsQeE4oGwDf664-EF7sq01HqV1MMFCAAQAigDUO3VhpcDYMnGqYvApNgPoAGq3vbiA8gBAaoEKE_QQwekDUoMeW9IQghV4HRuzL_l-7vVjlML559kix6XOcC1c4Tb9xeAB76hiR2QBwGoB6a-Gw&sig=AOD64_3Ulyu0DcDsc1AamOIxq63RF9u4zQ&rct=j&q=&ved=0CCUQ0Qw&adurl=http://www.aruba.com/where-to-stay/hotels-and-resorts%3Ftid%3D122" URI { uriScheme = Scheme {schemeBS = "http"} , uriAuthority = Just Authority {authorityUserInfo = Nothing, authorityHost = Host {hostBS = "www.google.com"}, authorityPort = Just (Port 80)}
uri-bytestring.cabal view
@@ -1,5 +1,5 @@ name: uri-bytestring-version: 0.1.9.1+version: 0.1.9.2 synopsis: Haskell URI parsing as ByteStrings description: uri-bytestring aims to be an RFC3986 compliant URI parser that uses efficient ByteStrings for parsing and representing the URI data. license: BSD3