on master help sign in
Support for non-files in multipart requests.
bf69aaaMichael Snoyman
Network/Wai/Parse.hs+4−3
@@ -244,6 +244,7 @@ parsePieces sink bound src = do
244 res <- takeLine src
244 res <- takeLine src
245 src' <- case res of
245 src' <- case res of
246 Nothing -> return (S.empty, Nothing)
246 Nothing -> return (S.empty, Nothing)
247+ -- The _bs here should only contain boundary information
247 Just (_bs, src') -> return src'
248 Just (_bs, src') -> return src'
248 res' <- takeLines src'
249 res' <- takeLines src'
249 case res' of
250 case res' of
@@ -252,14 +253,14 @@ parsePieces sink bound src = do
252 let ls' = map parsePair ls
253 let ls' = map parsePair ls
253 let x = do
254 let x = do
254 cd <- lookup contDisp ls'
255 cd <- lookup contDisp ls'
255− ct <- lookup contType ls'
256+ let ct = lookup contType ls'
256 let attrs = parseAttrs cd
257 let attrs = parseAttrs cd
257 let nameBS = S8.pack "name"
258 let nameBS = S8.pack "name"
258 name <- lookup nameBS attrs
259 name <- lookup nameBS attrs
259 let fnBS = S8.pack "filename"
260 let fnBS = S8.pack "filename"
260 return (ct, name, lookup fnBS attrs)
261 return (ct, name, lookup fnBS attrs)
261 case x of
262 case x of
262− Just (ct, name, Just filename) -> do
263+ Just (Just ct, name, Just filename) -> do
263 seed <- sinkInit sink
264 seed <- sinkInit sink
264 (seed', wasFound, msrc''') <-
265 (seed', wasFound, msrc''') <-
265 sinkTillBound bound src'' (sinkAppend sink) seed
266 sinkTillBound bound src'' (sinkAppend sink) seed
@@ -283,7 +284,7 @@ parsePieces sink bound src = do
283 then parsePieces sink bound msrc'''
284 then parsePieces sink bound msrc'''
284 else return ([], [])
285 else return ([], [])
285 return (x' : xs, ys)
286 return (x' : xs, ys)
286− Nothing -> do
287+ _ -> do
287 -- ignore this part
288 -- ignore this part
288 let seed = ()
289 let seed = ()
289 iter () _ = return ()
290 iter () _ = return ()
wai-extra.cabal+1−1
@@ -1,5 +1,5 @@
1Name: wai-extra
1Name: wai-extra
2−Version: 0.1.3
2+Version: 0.1.3.1
3Synopsis: Provides some basic WAI handlers and middleware.
3Synopsis: Provides some basic WAI handlers and middleware.
4Description: The goal here is to provide common features without many dependencies.
4Description: The goal here is to provide common features without many dependencies.
5License: BSD3
5License: BSD3