{ "id": "174002", "key": "TIMOB-27327", "fields": { "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "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": null, "resolutiondate": null, "created": "2019-08-09T21:55:23.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2019-09-26T12:22:59.000+0000", "status": { "description": "This issue is being actively worked on at the moment by the assignee.", "name": "In Progress", "id": "3", "statusCategory": { "id": 4, "key": "indeterminate", "colorName": "yellow", "name": "In Progress" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" }, { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "Using a {{Ti.Network.Socket.TCP}} socket for connections protected with TLS currently doesn't work. No TLS handshake will be started although the underlying socket implementations support this.\r\n\r\nSupport for TLS protected socket connections should be added.\r\n\r\n- Introduce new option {{useTls}} when creating a new TCP socket to manually enable TLS.\r\n\r\n*Steps to reproduce the behavior*\r\n{code:javascript}\r\nlet httpHeader = `GET /html HTTP/1.1\\r\\n`;\r\nhttpHeader += `Host: httpbin.org\\r\\n`;\r\nhttpHeader += '\\r\\n';\r\nconst data = Ti.createBuffer({\r\n value: httpHeader\r\n});\r\nconst socket = Ti.Network.Socket.createTCP({\r\n host: 'httpbin.org',\r\n port: 443,\r\n connected: e => {\r\n Ti.Stream.pump(socket, (e) => {\r\n if (e.bytesProcessed === -1 || e.bytesProcessed === \"-1\") {\r\n throw new Error('Socket EOF / Error')\r\n }\r\n\r\n const response = e.buffer.toString();\r\n console.log(response);\r\n }, 64 * 1024, true);\r\n socket.write(data, () => {});\r\n },\r\n error: e => {\r\n console.error(e.error);\r\n }\r\n});\r\nsocket.connect();\r\n{code}\r\n\r\n*Actual behavior*\r\nThe connection cannot be established and a socket error is thrown.\r\n\r\n*Epected behavior*\r\nThe connection via TLS works without issues and the response is printed to the console.", "attachment": [], "flagged": false, "summary": "Add support for SSL/TLS in Ti.Network.Socket.TCP", "creator": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "comment": { "comments": [], "maxResults": 0, "total": 0, "startAt": 0 } } }