[web-devel] Problem with multipart request on yesod/wai

Nubis nubis at woobiz.com.ar
Fri Feb 25 03:34:25 CET 2011

Hi guys,
I'm developing a webservice in Yesod that needs to accept multipart POST's
with image data in them. This webservice will be used mainly by mobile
My handler that takes care of receiving the image works correctly when
receiveng a POST crafted by google chrome (from a multipart/form-data
encoded form), but when receiving a multipart post from a mobile device it
fails to parse the multipart request arguments.
I've setup a ruby on rails application with a similar handler, and both
request from my mobile device and from a browser work, so I'm leaning
towards thinking this is a yesod/wai issue.

This is an excerpt from my handler, that I use to debug this:
myHandler = do
  (params, files) <- runRequestBody
  liftIO $ putStrLn $ "params " ++ show params

When requesting from the mobile device it just shows an empty list.

I have dumps of both multipart requests, they seem pretty similar with the
main differences being:
* the multipart boundaries are longer in the browser request.
* the request from the mobile device adds a trailing semicolon to the
content-type of each part (except for the image)

I attached the request that's not parsing correctly

Any help will be greatly appreciated,
thanks in advance!

--nubis :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/web-devel/attachments/20110224/ed04a959/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dalvik-request.tar.gz
Type: application/x-gzip
Size: 11006 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/web-devel/attachments/20110224/ed04a959/attachment.bin>

More information about the web-devel mailing list