[web-devel] Yesod/WAI and multipart/form-data encoded post requests

Max Cantor mxcantor at gmail.com
Mon Feb 14 10:57:29 CET 2011


Are there any issues with handling multi-part/form-data encoded POST request?

Here are my request headers:

headers: [("Host","192.168.0.187:6000"),("User-Agent","Consumer-iOS-Phonegap/1.0 CFNetwork/485.12.7 Darwin/10.4.0"),("Content-Length","618"),("Content-Type","multipart/form-data; boundary=BEGINBOUNDARYooooeflkscdlksjlkwrglk238sd723987sdiii"),("Accept","*/*"),("Accept-Language","en-us"),("Accept-Encoding","gzip, deflate"),("Cookie","_SESSION=TZsUfNyzruNnYeETdR/BB2Y/7ns5KRUVMgRkEkghOAo2lXbZ709DsPhclsOndiFmyEttOw5FHCfzW+MVM/eIfJQEruHeE3oFeSrrfdlmSEiZq3H7x+fPOyejZPq0Sd5x"),("Connection","keep-alive")]

And what WAI gives back as the params:
("geoLong","103.83032\r\nBEGINBOUNDARYooooeflkscdlksjlkwrglk238sd723987sdiii\r\nContent-Disposition: form-data; name=\"geoLat\"\r\nContent-Type: text/plain\r\n\r\n1.296149\r\nBEGINBOUNDARYooooeflkscdlksjlkwrglk238sd723987sdiii\r\nContent-Disposition: form-data; name=\"geoAccuracy\"\r\nContent-Type: text/plain\r\n\r\n65\r\nBEGINBOUNDARYooooeflkscdlksjlkwrglk238sd723987sdiii\r\nContent-Disposition: form-data; name=\"scannedTime\"\r\nContent-Type: text/plain\r\n\r\n1297677177.991\r\r\nBEGINBOUNDARYooooeflkscdlksjlkwrglk238sd723987sdiii--")

Note that the entire request body is treated as one value to the first param instead of being broken up into multiple params.  As an HTTP newbie, Its probable that I'm constructing the HTTP request wrong but I dont see what i'm doing wrong.

Any help would be greatly appreciated.

Max


More information about the web-devel mailing list