iphone - Unable to assemble multipart/form-data request -
I'm trying to implement the file upload functionality in the iPhone app. The server code is tested and when the file is uploaded from the desktop browser, I went to implement the objective-c client code. I'm manually requesting HTTP requests together, and despite this it looks correct, it is rejected by the server (the server handler is unable to extract parts of multilevel content). In frustration I have simplified the form only one parameter, but it still does not work.
I have captured network traffic and I can see that Wireshark could not parse my multilevel content (there is a look on the screenshot :,) I'm sticking it down below in hope That is, you can see the errors I can not see.
Thanks in advance.
Firefox:
Post / Cuegent / Action / Gallery / Post HTTP / 1.1 Host: [...] User-agent: Mozilla / 5.0 (Macintosh; U; Intel Mac OS X10.5; N-GB; RV: 1.9.1.3) Gecho / 200 9 824 Firefox / 3.5.3 Accept: Text / html, App / XHTML + XML, Application / XML; Q = 0.9, * / *; Q = 0.8 Accept Language: N-GB, N; Q = 0.5 accept-encoding: accept gizip-charset: ISO-8859-1, UTF-8; Q = 0.7, *; Keep q = 0.7- Alive: 300 Connections: Keep-alive Authorization: Origin [...] Content-Type: Multipart / Form-Information; Range = ----------------------- 20072377098235644401115438165 Content-Length: 180 --------------- ---- ---------- 20072377098235644401115438165 Content-presentation: Form-data; Name = "Device ID" 12345 ----------------------------- 20072377098235644401115438165-- HTTP / 1.1 200 OK Date: Saturn, October 17 2009 22:09:21 GMT Server: Apache / 2.2.3 (Debian) DAV / 2 SVN / 1.4.2 Mode_Pithon / 3.2.10 Python / 2.4.4 mod_ssl / 2.2.3 OpenSSL / 0.9.8C Elive: Timeout = 15, Max = 100 Connection: Alive Transfer-Encoding: Selected Content-Type: Text / html; Charset = UTF-8
iPhone:
posted / cuben / actions / gallery / post hosted HTTP / 1.1: [...] User-agent : Copenhagen / 1.0 CFNetwork / 459 Darwin / 9.8.0 Content-Type: Multipart / Form-Data; Limit = ---------- 0E7B16E6- CD-3D-4213- 949424 DA 30822 C 74 Acceptance: * / * Accepted-language: N-A Approved-Encoding: jizip, Defrite Authority: Basic [...] Content-Length: 187 Connection: Keep-Live ---------- 0E7B16E6-CD3D-4213-9B42-07DA30822C74 Content-Presentation: Form-Data; Name = "Device ID" 00000000-0000-1000-8000-0016CBCC0B61 ---------- 0E7B16E6-CD3D-4213-94242DA30822C74-- HTTP / 1.1 200 OK Date: Saturn, 17 October 2009 22:04: 07 GMT server: Apache / 2.2.3 (Debian) DAV / 2 SVN / 1.4.2 mode_pathon / 3.2.10 Python / 2.4.4 mod_sl / 2.2.3 OpenSSL / 0.9.8C Keep alive: timeout = 15, maximum = 100 Connection: Elite Transfer-Encoding: Selected Content-Type: Text / html; Charset = UTF-8
Your iPhone version indicates that live but specified Not a length
Besides, is it possible that your server is checking the user-agent string that recognizes it (say, backward compatibility mode)?
D also compares two in a text editor that shows CR / LF characters that you are meeting at the end of the appropriate line.
One more thing you can try is to create a simple web page that posts a multipart and check it headers after running the iPhone Browser (instead of Mac) Or you can stop a toolkit like ASHTTPRCEEst and see what kind of product it produces for multi-part post (or just use the toolkit instead of trying to write your own ).
Good luck
Comments
Post a Comment