Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18341] iOS: HTTPClient - Content-Type header is malformed when making a multipart/form-data POST request

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2015-02-12T08:57:11.000+0000
Affected Version/sRelease 3.4.1, Release 3.5.0
Fix Version/sRelease 4.0.0
ComponentsiOS
Labelsqe-3.5.0
ReporterWilson Luu
AssigneeIngo Muschenetz
Created2015-01-07T23:02:51.000+0000
Updated2015-02-12T08:57:11.000+0000

Description

*Details:* Content-Type header is malformed when making a multipart/form-data POST request. *Note:* This is *not a regression* as this occurs in 3.4.1.GA. *Steps to reproduce:* 1. Create a Titanium app with the app.js attachment and include cricket.wav attachment in the Resources folder 2. In app.js, on line 13, replace <MACHINE_IP> with your machine's IP address; your device and machine should be on the same wifi network 3. Install app to device 4. Next, download local_server.js attachment and run it via terminal: node local_server.js 5. In the app, press the button *Actual:* In terminal, the boundary parameter is not immediately after Content-Type multipart/form-data:
$ node local_server.js 
headers: {
	"host": "172.16.3.225:1337",
	"x-titanium-id": "962dd664-7f04-4340-8273-1c0e7d4b4b51",
	"x-requested-with": "XMLHttpRequest",
	"accept": "*/*",
	"content-type": "multipart/form-data; charset=utf-8; boundary=0xTibOuNdArY_1420671499",
	"content-length": "81078",
	"accept-language": "en-us",
	"accept-encoding": "gzip, deflate",
	"connection": "keep-alive",
	"user-agent": "Appcelerator Titanium/3.4.1 (iPhone/8.1; iPhone OS; en_US;)"
}
*Expected:* The boundary parameter should be immediately after Content-Type multipart/form-data

Attachments

FileDateSize
app.js2015-01-07T23:02:51.000+0000826
cricket.wav2015-01-07T23:02:51.000+000080923
local_server.js2015-01-07T23:02:51.000+0000240

Comments

  1. Pedro Enrique 2015-02-05

    PR by community member https://github.com/appcelerator/APSHTTPClient/pull/19 Reviewing it...
  2. Khushbu Agrawal 2015-02-12

    Verified with below Test Environment: 1. Mac OSX Yosemite 10.10 2. Appcelerator Studio, build: 4.0.0.201502111458 3. Titanium SDK, build: 4.0.0.v20150211151855 4. Titanium CLI, build: 3.6.0-dev 5. Alloy: 1.5.1 6. iPhone 6+ with iOS 8.1 Content-Type header is not malformed as the boundary parameter is immediately after Content-Type multipart/form-data as shown in terminal.
       headers: {
       	"host": "192.168.0.109:1337",
       	"content-type": "multipart/form-data;boundary=0xTibOuNdArY_1423730453",
       	"accept-language": "en-us",
       	"accept-encoding": "gzip, deflate",
       	"connection": "keep-alive",
       	"accept": "*/*",
       	"user-agent": "Appcelerator Titanium/4.0.0 (iPhone/8.1; iPhone OS; en_SG;)",
       	"content-length": "81078",
       	"x-titanium-id": "61f383d9-0410-4b39-8127-92dce821040c",
       	"x-requested-with": "XMLHttpRequest"
       }
       
    Closing this ticket.
  3. Khushbu Agrawal 2015-02-12

    Reopened issue for changing the comment code.

JSON Source