{ "id": "127329", "key": "TIMOB-16565", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "15931", "description": "2014 Sprint 05", "name": "2014 Sprint 05", "archived": true, "released": true, "releaseDate": "2014-03-14" }, { "id": "15932", "description": "2014 Sprint 05 API", "name": "2014 Sprint 05 API", "archived": true, "released": true, "releaseDate": "2014-03-14" }, { "id": "15422", "description": "Release 3.3.0", "name": "Release 3.3.0", "archived": false, "released": true, "releaseDate": "2014-07-16" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2014-03-10T22:07:19.000+0000", "created": "2014-03-06T18:38:43.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "module_network", "qe-testadded" ], "versions": [], "issuelinks": [ { "id": "35674", "type": { "id": "10011", "name": "Includes", "inward": "is included by", "outward": "includes" }, "inwardIssue": { "id": "123687", "key": "TIMOB-15980", "fields": { "summary": "iOS: Replace ASIHttp with NSURLConnection", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false } } } } ], "assignee": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2014-06-19T12:43:50.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "When POSTing files, the filename in Content-Disposition and the Content-Type are not being set properly. See the requests for the old and new below (full requests follow)\r\n\r\nOld ASIHttpRequest httpClient:\r\n{code}\r\nContent-Disposition: form-data; name=\"files\"; filename=\"somefile.pdf\"\r\nContent-Type: application/pdf\r\n{code}\r\nNew NSUrlConnection httpClient:\r\n{code}\r\nContent-Disposition: form-data; name=\"files\"; filename=\"file0\"\r\nContent-Type: application/octet-stream\r\n{code}\r\n\r\nTest code:\r\n{code}\r\nvar win = Titanium.UI.createWindow({\r\n\tbackgroundColor: '#CCC'\r\n});\r\n\r\nvar startButton = Ti.UI.createButton({\r\n\ttitle: 'Start Test',\r\n});\r\n\r\nwin.add(startButton);\r\n\r\nstartButton.addEventListener('click', function(){\r\n\r\n\tvar xhr = Ti.Network.createNewHTTPClient({\r\n\t\tonload: function(e) {\r\n\t\t\tvar obj = JSON.parse(this.responseText);\r\n\t\t\tTi.API.info(obj);\r\n\t\t},\r\n\t\tonerror: function(e) {\r\n\t\t\tTi.API.error(e.error);\r\n\t\t}\r\n\t});\r\n\txhr.open('POST', 'http://httpbin.org/post');\r\n\t// xhr.send(Ti.Filesystem.getFile('cricket.wav').read());\r\n\t// xhr.send({files:Ti.Filesystem.getFile('cricket.wav').read()});\r\n\t// xhr.send(Ti.Filesystem.getFile('cricket.wav'));\r\n\txhr.send({files:Ti.Filesystem.getFile('cricket.wav')});\r\n});\r\n\t\r\nwin.open();\r\n{code}", "attachment": [], "flagged": false, "summary": "iOS: NewHTTPClient Content-Disposition and the Content-Type not set correctly on POST files", "creator": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "296168", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Added to PR https://github.com/appcelerator/titanium_mobile/pull/5433", "updateAuthor": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-03-07T19:46:01.000+0000", "updated": "2014-03-07T19:46:01.000+0000" }, { "id": "296197", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Test Case\r\n{code}\r\nvar win = Titanium.UI.createWindow({\r\n backgroundColor: '#CCC',\r\n layout:'vertical'\r\n});\r\n \r\n \r\nvar container1 = Ti.UI.createView({height:Ti.UI.SIZE,top:10})\r\n \r\nvar b1a = Ti.UI.createButton({\r\n title: 'Start Test NSURL',\r\n left:10,\r\n id:1\r\n});\r\n \r\nvar b1b = Ti.UI.createButton({\r\n title: 'Start Test ASI',\r\n right:10,\r\n id:1\r\n});\r\n \r\ncontainer1.add(b1a);\r\ncontainer1.add(b1b);\r\nwin.add(container1); \r\n \r\nvar container2 = Ti.UI.createView({height:Ti.UI.SIZE,top:10})\r\n \r\nvar b2a = Ti.UI.createButton({\r\n title: 'Start Test2 NSURL',\r\n left:10,\r\n id:2\r\n});\r\n \r\nvar b2b = Ti.UI.createButton({\r\n title: 'Start Test2 ASI',\r\n right:10,\r\n id:2\r\n});\r\n \r\ncontainer2.add(b2a);\r\ncontainer2.add(b2b);\r\nwin.add(container2); \r\n \r\n \r\nvar container3 = Ti.UI.createView({height:Ti.UI.SIZE,top:10})\r\n \r\nvar b3a = Ti.UI.createButton({\r\n title: 'Start Test3 NSURL',\r\n left:10,\r\n id:3\r\n});\r\n \r\nvar b3b = Ti.UI.createButton({\r\n title: 'Start Test3 ASI',\r\n right:10,\r\n id:3\r\n});\r\n \r\ncontainer3.add(b3a);\r\ncontainer3.add(b3b);\r\nwin.add(container3); \r\n \r\n \r\nvar container4 = Ti.UI.createView({height:Ti.UI.SIZE,top:10})\r\n \r\nvar b4a = Ti.UI.createButton({\r\n title: 'Start Test4 NSURL',\r\n left:10,id:4\r\n});\r\n \r\nvar b4b = Ti.UI.createButton({\r\n title: 'Start Test4 ASI',\r\n right:10,\r\n id:4\r\n});\r\n \r\ncontainer4.add(b4a);\r\ncontainer4.add(b4b);\r\nwin.add(container4);\r\n \r\nvar nstest = function(e){\r\n var xhr = Ti.Network.createNewHTTPClient({\r\n onload: function(e) {\r\n var obj = JSON.parse(this.responseText);\r\n Ti.API.info(obj);\r\n },\r\n onerror: function(e) {\r\n Ti.API.error(e.error);\r\n }\r\n });\r\n xhr.open('POST', 'http://httpbin.org/post');\r\n if(e.source.id == 1) {\r\n Ti.API.info('\\n**********NSURL TEST 1*************\\n');\r\n xhr.send(Ti.Filesystem.getFile('cricket.wav').read());\r\n } else if (e.source.id == 2) {\r\n Ti.API.info('\\n**********NSURL TEST 2*************\\n');\r\n xhr.send({files:Ti.Filesystem.getFile('cricket.wav').read()});\r\n } else if (e.source.id == 3) {\r\n Ti.API.info('\\n**********NSURL TEST 3*************\\n');\r\n xhr.send(Ti.Filesystem.getFile('cricket.wav'));\r\n } else {\r\n Ti.API.info('\\n**********NSURL TEST 4*************\\n');\r\n xhr.send({files:Ti.Filesystem.getFile('cricket.wav')});\r\n }\r\n} \r\n \r\nvar asitest = function(e){\r\n var xhr = Ti.Network.createHTTPClient({\r\n onload: function(e) {\r\n var obj = JSON.parse(this.responseText);\r\n Ti.API.info(obj);\r\n },\r\n onerror: function(e) {\r\n Ti.API.error(e.error);\r\n }\r\n });\r\n xhr.open('POST', 'http://httpbin.org/post');\r\n if(e.source.id == 1) {\r\n Ti.API.info('\\n**********ASI TEST 1*************\\n');\r\n xhr.send(Ti.Filesystem.getFile('cricket.wav').read());\r\n } else if (e.source.id == 2) {\r\n Ti.API.info('\\n**********ASI TEST 2*************\\n');\r\n xhr.send({files:Ti.Filesystem.getFile('cricket.wav').read()});\r\n } else if (e.source.id == 3) {\r\n Ti.API.info('\\n**********ASI TEST 3*************\\n');\r\n xhr.send(Ti.Filesystem.getFile('cricket.wav'));\r\n } else {\r\n Ti.API.info('\\n**********ASI TEST 4*************\\n');\r\n xhr.send({files:Ti.Filesystem.getFile('cricket.wav')});\r\n }\r\n} \r\n \r\nb1a.addEventListener('click',nstest);\r\nb2a.addEventListener('click',nstest);\r\nb3a.addEventListener('click',nstest);\r\nb4a.addEventListener('click',nstest);\r\n \r\n \r\nb1b.addEventListener('click',asitest);\r\nb2b.addEventListener('click',asitest);\r\nb3b.addEventListener('click',asitest);\r\nb4b.addEventListener('click',asitest);\r\nwin.open();\r\n{code}", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-03-07T22:42:42.000+0000", "updated": "2014-03-10T21:00:50.000+0000" }, { "id": "296401", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Updated PR: https://github.com/appcelerator/titanium_mobile/pull/5433", "updateAuthor": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-03-10T20:37:18.000+0000", "updated": "2014-03-10T20:37:18.000+0000" }, { "id": "302059", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Here's the updated code.\r\nNote:\r\nYou need a file called \"cricket.wav\" in your Resources dir\r\n{code}\r\nvar win = Titanium.UI.createWindow({\r\n backgroundColor: '#CCC',\r\n layout:'vertical'\r\n});\r\n \r\nvar b1 = Ti.UI.createButton({\r\n title: 'Start Test 1',\r\n top:10, id: 1\r\n});\r\n \r\nvar b2 = Ti.UI.createButton({\r\n title: 'Start Test 2',\r\n top:10, id: 2\r\n});\r\n \r\nvar b3 = Ti.UI.createButton({\r\n title: 'Start Test 3',\r\n top:10, id: 3\r\n});\r\n \r\nvar b4 = Ti.UI.createButton({\r\n title: 'Start Test 4',\r\n top:10, id: 4\r\n});\r\n\r\n \r\nvar httpTest = function(e){\r\n var xhr = Ti.Network.createHTTPClient({\r\n onload: function(e) {\r\n var obj = JSON.parse(this.responseText);\r\n Ti.API.info(obj);\r\n },\r\n onerror: function(e) {\r\n Ti.API.error(e.error);\r\n }\r\n });\r\n xhr.open('POST', 'http://httpbin.org/post');\r\n if(e.source.id == 1) {\r\n Ti.API.info('\\n**********TEST 1*************\\n');\r\n xhr.send(Ti.Filesystem.getFile('cricket.wav').read());\r\n } else if (e.source.id == 2) {\r\n Ti.API.info('\\n**********TEST 2*************\\n');\r\n xhr.send({files:Ti.Filesystem.getFile('cricket.wav').read()});\r\n } else if (e.source.id == 3) {\r\n Ti.API.info('\\n**********TEST 3*************\\n');\r\n xhr.send(Ti.Filesystem.getFile('cricket.wav'));\r\n } else {\r\n Ti.API.info('\\n**********TEST 4*************\\n');\r\n xhr.send({files:Ti.Filesystem.getFile('cricket.wav')});\r\n }\r\n};\r\n \r\nb1.addEventListener('click',httpTest);\r\nb2.addEventListener('click',httpTest);\r\nb3.addEventListener('click',httpTest);\r\nb4.addEventListener('click',httpTest);\r\n \r\nwin.add(b1);\r\nwin.add(b2);\r\nwin.add(b3);\r\nwin.add(b4);\r\n\r\nwin.open();\r\n{code}", "updateAuthor": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-04-22T17:47:49.000+0000", "updated": "2014-04-22T17:48:17.000+0000" }, { "id": "305297", "author": { "name": "sdowse", "key": "sdowse", "displayName": "Samuel Dowse", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified fixed on:\r\nMac OSX 10.9.3\r\nAppcelerator Studio, build: 3.3.0.201405121247\r\nTitanium SDK, build: 3.3.0.v20140515133312\r\nTitanium CLI, build: 3.3.0-dev\r\nAlloy: 1.4.0-alpha\r\n\r\nUsed test code provided by Pedro.\r\nContent-type correctly showing \"Content-Type\" = \"audio/wav\";\r\nClosing.\r\n", "updateAuthor": { "name": "sdowse", "key": "sdowse", "displayName": "Samuel Dowse", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-05-16T16:53:34.000+0000", "updated": "2014-05-16T16:53:34.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }