{ "id": "121295", "key": "TIMOB-15509", "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": [], "resolution": { "id": "2", "description": "The problem described is an issue which will never be fixed.", "name": "Won't Fix" }, "resolutiondate": "2017-07-25T22:33:23.000+0000", "created": "2013-10-17T00:12:51.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [], "versions": [ { "id": "14982", "description": "Release 3.2.0", "name": "Release 3.2.0", "archived": false, "released": true, "releaseDate": "2013-12-19" } ], "issuelinks": [ { "id": "32586", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "121339", "key": "TIMOB-15514", "fields": { "summary": "HTTPClient: Disparity between All Platforms for Handling Content-Type Header", "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": "Low", "id": "4" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-07-25T22:33: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": "ENVIRONMENT:\r\nMac OS X 10.8.4\r\nAppcelerator Studio, build: 3.2.0.201310141852\r\nTiSDK 3.2.0.v20131015134843\r\nAndroid 4.2.2 / API Level 17\r\niOS 7.0 / Xcode 5\r\n\r\nREPRODUCTION:\r\n1. Add/run the server code on your machine with Apache and PHP enabled. I placed mine in my ~/Sites/ directory.\r\n2. Replace with your local IP (and \"/~username\" if needed).\r\n3. Run the code below in the Android emulator and press the Submit button.\r\n\r\nRESULTS:\r\nEmulator reports the following error:\r\n{noformat}\r\nE/TiExceptionHandler( 3692): (main) [239,3117] ----- Titanium Javascript Runtime Error -----\r\nE/TiExceptionHandler( 3692): (main) [2,3119] - In ti:/httpclient.js:28,9\r\nE/TiExceptionHandler( 3692): (main) [26,3145] - Message: Uncaught Error: size < 0\r\nE/TiExceptionHandler( 3692): (main) [2,3147] - Source: \t\t_send.call(this, options);\r\n{noformat}\r\n\r\nEXPECTED RESULTS:\r\nClient request should not fail. Server script should return the HTTP headers sent to it.\r\n\r\nOTHER INFO:\r\nWorks fine on iOS. Able to successfully send JSON object, Blob and String on Android.\r\n\r\n\r\nSERVER CODE (server.php):\r\n{code}\r\n apache_request_headers()));\r\n}\r\n?>\r\n\r\n{code}\r\n\r\nCLIENT CODE (app.js):\r\n\r\n{code}\r\n\r\n var form_url = 'http:///server.php';\r\n \r\n var win = Ti.UI.createWindow({\r\n layout : 'vertical',\r\n backgroundColor : '#fff'\r\n });\r\n var txtTitle = Ti.UI.createTextField({\r\n top : '80dp',\r\n value : 'My Photo Title'\r\n });\r\n win.add(txtTitle);\r\n \r\n var anImageView = Ti.UI.createImageView({\r\n image : 'images/flower.jpg',\r\n width : 50,\r\n height : 50,\r\n \r\n });\r\n anImageView.addEventListener('load', function() {\r\n Ti.API.info('Image loaded!');\r\n });\r\n \r\n win.add(anImageView);\r\n \r\n var btnSubmit = Ti.UI.createButton({\r\n title : 'Submit'\r\n });\r\n btnSubmit.addEventListener('click', function(e) {\r\n // Send with HTTPClient\r\n \r\n var c = Ti.Network.createHTTPClient({\r\n onload : function() {\r\n Ti.API.info(this.responseText);\r\n Ti.API.info(\"TEXT: \" + this.responseText);\r\n json = JSON.parse(this.responseText);\r\n Ti.API.info('json' + json);\r\n },\r\n onerror : function(e) {\r\n Ti.API.info(\"STATUS: \" + this.status);\r\n Ti.API.info(\"TEXT: \" + this.responseText);\r\n Ti.API.info(\"ERROR: \" + e.error);\r\n },\r\n timeout : 50000\r\n });\r\n c.enableKeepAlive = false;\r\n c.open('POST', form_url); \r\n\r\n c.send(Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, \"/images/flower.jpg\"));\r\n \r\n });\r\n win.add(btnSubmit);\r\n \r\n win.open();\r\n{code}\r\n\r\n", "attachment": [], "flagged": false, "summary": "Android: HTTPClient cannot send POST data as Ti.Filesystem.File", "creator": { "name": "bhatfield", "key": "bhatfield", "displayName": "Benjamin Hatfield", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "bhatfield", "key": "bhatfield", "displayName": "Benjamin Hatfield", "active": false, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "282387", "author": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "body": "Tried with the latest master build, couldn't reproduce the issue.\n\nHere is the sample I tried, make sure that the image path is updated\n\nvar form_url = 'http://www.w3schools.com/ajax/demo_post.asp';\n \nvar win = Ti.UI.createWindow({\n layout : 'vertical',\n backgroundColor : '#fff'\n});\n\nvar btnSubmit = Ti.UI.createButton({\n title : 'Submit'\n});\nbtnSubmit.addEventListener('click', function(e) {\n // Send with HTTPClient\n \n var c = Ti.Network.createHTTPClient();\n c.onload = function() {\n Ti.API.info(this.responseText);\n Ti.API.info(\"TEXT: \" + this.responseText);\n };\n c.onerror = function(e) {\n Ti.API.info(\"STATUS: \" + this.status);\n };\n c.enableKeepAlive = false;\n c.open('POST', form_url); \n \n c.send(Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, \"/goofy.png\"));\n \n});\nwin.add(btnSubmit);\n \nwin.open();", "updateAuthor": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2013-12-04T15:38:55.000+0000", "updated": "2013-12-04T15:38:55.000+0000" }, { "id": "424702", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing due to inactivity. If this issue still exists, please raise a new ticket.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-07-25T22:33:23.000+0000", "updated": "2017-07-25T22:33:23.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }