{ "id": "127190", "key": "TIMOB-16554", "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-07T21:49:32.000+0000", "created": "2014-03-05T18:58:26.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "network", "qe-closed-3.3.0", "qe-testadded" ], "versions": [], "issuelinks": [ { "id": "35583", "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:42:49.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": "The new HTTPClient implementation is missing the response details on the ondatastream, onreadystatechange, and onsendstream callbacks.\r\n\r\nRun this code to verify the fix. Compare with the old HTTPClient by renaming the Network.createNewHTTPClient() to just Network.createHTTPClient() in the code here.\r\nSample code:\r\n{code}\r\nvar win = Titanium.UI.createWindow({\r\n\tbackgroundColor: '#CCC'\r\n});\r\n\r\n\r\nvar output = Ti.UI.createView({\r\n\tlayout: 'vertical',\r\n\twidth: Ti.UI.SIZE,\r\n\theight: Ti.UI.SIZE,\r\n\tleft: 20\r\n});\r\n\r\nvar labelStatus = Ti.UI.createLabel({\r\n\ttop: 5,\r\n\tcolor: 'red',\r\n\tleft: 0,\r\n\ttext: ''\r\n})\r\nvar labelConnected = Ti.UI.createLabel({\r\n\ttop: 5,\r\n\tcolor: 'yellow',\r\n\tleft: 0,\r\n\ttext: ''\r\n})\r\nvar labelReadyState = Ti.UI.createLabel({\r\n\ttop: 5,\r\n\tcolor: 'green',\r\n\tleft: 0,\r\n\ttext: ''\r\n})\r\nvar labelResponseData = Ti.UI.createLabel({\r\n\ttop: 5,\r\n\tcolor: 'blue',\r\n\tleft: 0,\r\n\ttext: ''\r\n})\r\nvar labelConnectionType = Ti.UI.createLabel({\r\n\ttop: 5,\r\n\tcolor: 'purple',\r\n\tleft: 0,\r\n\ttext: ''\r\n})\r\nvar labelLocation = Ti.UI.createLabel({\r\n\ttop: 5,\r\n\tcolor: 'orange',\r\n\tleft: 0,\r\n\ttext: ''\r\n})\r\nvar labelContentLength = Ti.UI.createLabel({\r\n\ttop: 5,\r\n\tcolor: 'brown',\r\n\tleft: 0,\r\n\ttext: ''\r\n});\r\nvar labelProgress = Ti.UI.createLabel({\r\n\ttop: 5,\r\n\tcolor: 'black',\r\n\tleft: 0,\r\n\ttext: ''\r\n})\r\noutput.add(labelStatus);\r\noutput.add(labelConnected);\r\noutput.add(labelReadyState);\r\noutput.add(labelResponseData);\r\noutput.add(labelConnectionType);\r\noutput.add(labelLocation);\r\noutput.add(labelContentLength);\r\noutput.add(labelProgress);\r\n\r\nwin.add(output);\r\n\r\nvar startButton = Ti.UI.createButton({\r\n\ttitle: 'Start Test',\r\n\tbottom: 20\r\n});\r\n\r\nwin.add(startButton);\r\n\r\nupdateLabels({\r\n\tstatus:'',\r\n\tconnected:'',\r\n\treadyState:'',\r\n\tresponseData:'',\r\n\tconnectionType:'',\r\n\tlocation:'',\r\n\tgetResponseHeader:function(){return ''; },\r\n\tprogress: 0\r\n});\r\n\r\n\r\nfunction updateLabels(xhr) {\r\n\tlabelStatus.text \t\t= 'status: ' + xhr.status + '\\n';\r\n\tlabelConnected.text \t= 'connected: ' + xhr.connected + '\\n';\r\n\tlabelReadyState.text \t= 'readyState: ' + xhr.readyState + '\\n';\r\n\tlabelResponseData.text \t= 'responseData: ' + xhr.responseData + '\\n';\r\n\tlabelConnectionType.text = 'connectionType: ' + xhr.connectionType + '\\n';\r\n\tlabelLocation.text \t\t= 'location: ' + xhr.location + '\\n';\r\n\tlabelContentLength.text = 'content-length: ' + xhr.getResponseHeader('Content-Length');\r\n\tlabelProgress.text \t\t= 'progress: ' + xhr.progress;\r\n}\r\nstartButton.addEventListener('click', function(){\r\n\r\n\tvar xhr = Titanium.Network.createNewHTTPClient();\r\n\tupdateLabels(xhr);\r\n\tvar readyState = -1;\r\n\txhr.onload = function()\r\n\t{\r\n\t\tupdateLabels(xhr);\r\n\t};\r\n\txhr.ondatastream = function(e)\r\n\t{\r\n\t\tif (xhr.readyState > readyState)\r\n\t\t{\r\n\t\t\txhr.progress = e.progress;\r\n\t\t\tupdateLabels(xhr);\r\n\t\t}\r\n\r\n\t};\r\n\t// open the client\r\n\txhr.open('GET','http://www.appcelerator.com/assets/The_iPad_App_Wave.pdf');\r\n\r\n\t// send the data\r\n\txhr.send();\r\n});\r\n\t\r\nwin.open();\r\n{code}", "attachment": [], "flagged": false, "summary": "iOS: NewHTTPClient missing response from ondatastream callback", "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": "295786", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Pending PR: https://github.com/appcelerator/titanium_mobile/pull/5429", "updateAuthor": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-03-05T19:11:25.000+0000", "updated": "2014-03-05T19:11:25.000+0000" }, { "id": "302084", "author": { "name": "oromero", "key": "oromero", "displayName": "Olga Romero", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested the above code, changed var xhr as suggested by [~penrique] and verified the expected behavior with:\r\nMac osx 10.9.2 Mavericks\r\nAppcelerator Studio, build: 3.2.3.201404162038\r\nTitanium SDK, build 3.3.0.v20140418162516\r\nNode.JS Version: v0.10.13\r\nNPM Version: 1.3.2\r\n├── acs@1.0.14\r\n├── alloy@1.3.1\r\n├── node-appc@0.2.0\r\n├── npm@1.3.2\r\n├── titanium@3.3.0-dev\r\n└── titanium-code-processor@1.1.1-beta1\r\nnpm -g ls titanium: /usr/local/lib\r\n└── titanium@3.3.0-dev (git://github.com/appcelerator/titanium.git#93414d143051df4578b7aa42670008e5ef02c422)\r\nXCode Version: 5.1.1\r\nDevice:\r\niPhone 5S iOS version 7.0", "updateAuthor": { "name": "oromero", "key": "oromero", "displayName": "Olga Romero", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-04-22T21:23:02.000+0000", "updated": "2014-04-22T21:23:02.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }