{ "id": "151960", "key": "TIMOB-19817", "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": "14826", "description": "Release 5.1.0-remaining iOS9 features, Android M features", "name": "Release 5.1.0", "archived": false, "released": true, "releaseDate": "2015-11-20" }, { "id": "16996", "name": "Release 5.0.3", "archived": false, "released": true, "releaseDate": "2017-02-06" }, { "id": "16997", "name": "Release 5.2.0", "archived": false, "released": true, "releaseDate": "2016-02-23" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2015-10-28T21:28:00.000+0000", "created": "2015-10-12T13:19:24.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "android" ], "versions": [ { "id": "16904", "description": "Release 5.0.2", "name": "Release 5.0.2", "archived": true, "released": true, "releaseDate": "2015-10-01" } ], "issuelinks": [ { "id": "49508", "type": { "id": "10122", "name": "Gantt: start-finish", "inward": "is triggered by", "outward": "is triggering" }, "inwardIssue": { "id": "151673", "key": "TIMOB-19661", "fields": { "summary": "Android: 5.0.0 GA SDK HTTPClient Fails to POST Form Data with File Correctly", "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": "Medium", "id": "3" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "updated": "2015-10-29T22:26:23.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": "10202", "name": "Android", "description": "Android Platform" } ], "description": "The following code (upload a blob to the server), creates malformed http header:\r\n{noformat}\r\nvar xhr = Titanium.Network.createHTTPClient();\r\nxhr.onload = function() {...};\r\nxhr.open('POST',serverUrl');\r\nxhr.send({file:aBlob,name:'something'});\r\n{noformat}\r\nThis creates the request:\r\n{noformat}\r\nPOST /api/1/upload/ HTTP/1.1\r\nAccept-Encoding: identity\r\nX-Titanium-Id: 12345678-2222-4444-8888-111111111111\r\nContent-Type: multipart/form-data; boundary=j7D5qBH3i-pbXOzjDHVJNdQRhPBvF-Q0PUmVjZe\r\n...\r\nContent-Length: 56789\r\n\r\n--j7D5qBH3i-pbXOzjDHVJNdQRhPBvF-Q0PUmVjZe\r\nContent-Disposition: form-data; name=\"file\"\"; filename=\"tixhr1851009574.png\"\r\nContent-Type: image/png\r\nContent-Transfer-Encoding: binary\r\n...\r\n{noformat}\r\nNote the double quotes for the name part:\r\nContent-Disposition: form-data; name=*\"file\"\"*; filename=\"tixhr1851009574.png\"\r\n\r\nI've traced the bug to {{TiHTTPClient.java}} at {{addFilePart(String name, ContentBody contentBody)}}. The extra \" comes when appending the filename argument.", "attachment": [], "flagged": false, "summary": "Android: HTTPClient multipart header error", "creator": { "name": "buddyguards", "key": "buddyguards", "displayName": "grebulon", "active": true, "timeZone": "Asia/Jerusalem" }, "subtasks": [], "reporter": { "name": "buddyguards", "key": "buddyguards", "displayName": "grebulon", "active": true, "timeZone": "Asia/Jerusalem" }, "environment": "Titanium 5.1.0 (from the master branch)", "closedSprints": [ { "id": 517, "state": "closed", "name": "2015 Sprint 22 SDK", "startDate": "2015-10-24T00:30:42.059Z", "endDate": "2015-11-07T01:30:00.000Z", "completeDate": "2015-11-09T02:37:29.441Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "368102", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "Master PR: https://github.com/appcelerator/titanium_mobile/pull/7358\r\n5_1_X PR: https://github.com/appcelerator/titanium_mobile/pull/7360\r\n5_0_X PR: https://github.com/appcelerator/titanium_mobile/pull/7361", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-10-28T09:10:02.000+0000", "updated": "2015-10-28T09:10:02.000+0000" }, { "id": "368103", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "Testing steps to ensure all is okay:-\r\n{code}\r\nTitanium.UI.setBackgroundColor('#000');\r\n \r\nvar win = Titanium.UI.createWindow({ \r\n title:'TIMOB',\r\n backgroundColor:'#fff'\r\n});\r\n \r\n \r\nvar button = Ti.UI.createButton({title: \"Press Button\",\r\n\t\t\t\t\t\t\t\ttop: 200});\r\n \r\nbutton.addEventListener(\"click\", function(e) {\r\n\tvar xhr = Ti.Network.createHTTPClient({\r\n onload: function(e) {\r\n alert(\"Received: Status = \" + this.status + \", Value = \" + this.responseText);\r\n Ti.API.info(\"Received: Status = \" + this.status + \", Value = \" + this.responseText);\r\n },\r\n onerror: function(e) {\r\n alert(\"Error: Status = \" + this.status + \", Value = \" + this.responseText, \" error:\" + e.error);\r\n }\r\n });\r\n \r\n \tvar args = {\r\n \t\tname: 'testName',\r\n \t\tfile: Ti.Filesystem.getFile(\"mytestfile.txt\")\r\n \t};\r\n \r\n xhr.open(\"POST\", \"http://httpbin.org/post\");\r\n xhr.send(args);\r\n});\r\n \r\nwin.add(button);\r\n \r\nwin.open();\r\n{code}", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-10-28T09:11:47.000+0000", "updated": "2015-10-28T09:11:47.000+0000" }, { "id": "368105", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "Thanks [~buddyguards] for tracing this.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-10-28T09:17:53.000+0000", "updated": "2015-10-28T09:17:53.000+0000" }, { "id": "368357", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified the fix.\r\nNo HTTP multipart header error seen.\r\n\r\nClosing.\r\n\r\n\r\nEnvironment:\r\nAppc Studio : 4.4.0.201510290507\r\nTi SDK : 5.1.0.v20151028190028 , 5.2.0.v20151029134437, 5.0.3.v20151028143139\r\nTi CLI : 5.0.5\r\nAlloy : 1.7.18\r\nMAC Yosemite : 10.10.5\r\nAppc NPM : 4.2.1-6\r\nAppc CLI : 5.1.0-38\r\nNode: v0.10.37\r\nsamsung Galaxy S4 - Android 4.4.4", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-10-29T22:26:16.000+0000", "updated": "2015-10-29T22:26:16.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }