{ "id": "149884", "key": "TIMOB-20181", "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": "16980", "description": "New V8", "name": "Release 6.0.0", "archived": false, "released": true, "releaseDate": "2016-11-15" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-09-26T03:29:16.000+0000", "created": "2015-07-24T17:55:44.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "ios" ], "versions": [ { "id": "17532", "name": "Release 5.1.1", "archived": false, "released": true, "releaseDate": "2015-11-24" } ], "issuelinks": [ { "id": "52471", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "147782", "key": "TIMOB-18902", "fields": { "summary": "HTTPClient: unable set content-type as json for multipart post request using Httpclient", "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": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2016-11-11T22:11:54.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": "Appcelerator Command-Line Interface, version 4.1.2\r\nAppcelerator Studio, build: 4.1.1.201507141126\r\nMac OS X 10.10.4 IDE\r\niOS issue only. I'm using iOS SDK 8.4.\r\nXcode Version 6.4 (6E35b)\r\nAndroid works differently and the web service calls sends out headers that our server understands.\r\n\r\nTitanium SDK 4.1.0.GA HTTPClient breaks my calls to multipart/form-data web services on my server by adding a \"Content-Type\" to text parameters that it did not add in SDK 3.5.1.GA.\r\n\r\nHere is the code that I use. Please note that you will need to create your own \"requestb.in\" to test this\r\n\r\n{code:javascript}\r\nfunction getLoader(cbfn, fn)\r\n{\r\n\tvar loader = Titanium.Network.createHTTPClient();\r\n var response = { success: false, data: null, errors: [] };\r\n if (fn != null && fn != \"\")\r\n \tloader.setFile(fn);\r\n\tloader.onload = function()\r\n\t{\r\n\t\tloaderResponseInfo(this);\r\n\t Titanium.API.info('Data request succeeded');\r\n\t \r\n\t response.data = this.responseData;\r\n\r\n\t cbfn(this, response);\r\n\t};\r\n\tloader.onerror = function()\r\n\t{\r\n\t\tloaderResponseInfo(this);\r\n\t Titanium.API.info('Data request failed');\r\n\r\n \tresponse.success = false;\r\n \tif (!('errors' in response))\r\n \t\tresponse.errors = [];\r\n\t response.errors.push(\"Error calling webservice\");\r\n\r\n\t cbfn(this, response);\r\n\t};\r\n\treturn loader;\r\n}\r\n\r\nfunction multipartdata(url, cbfn, params, httpmethod, fn)\r\n{\r\n\tvar loader = getLoader(cbfn, fn);\r\n\r\n\tloader.open(httpmethod, url);\r\n\tloader.onreadystatechange = function()\r\n\t{\r\n if (loader.readyState === 4)\r\n {\r\n Ti.API.info(\"onreadystatechange(\" + loader.responseText + \")\");\r\n }\r\n };\r\n\tloader.send(params);\r\n}\r\n\r\nfunction setProfileImage( paramsobj, cbfn )\r\n{\r\n\tparamsobj.imageType = 'profile-image';\r\n\tparamsobj.ticket = _qtp.ticket(); // temporary ticket created at login\r\n\tvar url;\r\n\t// debug sent to a requestbin\r\n\turl = \"http://requestb.in/11w0o7p1\";\r\n\tmultipartdata(url, cbfn, paramsobj, 'POST', \"\");\r\n\t// Actual web service call\r\n\t// url = 'https://app.qbos.com/ws/QTP/cs/de9r/v2/imgUpload.cfm';\r\n\t// multipartdata(url, cbfn, paramsobj, 'POST', \"\");\r\n}\r\n{code}\r\n\r\n*This is the requestb.in output from Titanium SDK 4.1.0.GA*:\r\n{code}\r\nhttp://requestb.in\r\nPOST /11w0o7p1 multipart/form-data; boundary=0xTibOuNdArY_1437747270\r\n 414.37 kB 13m ago \r\nFrom 173.57.154.232\r\nFORM/POST PARAMETERS\r\n\r\nticket: 8423D076MA0D1MECA5MF8C9D5A5F043C66B\r\nimageType: profile-image\r\nHEADERS\r\n\r\nConnect-Time: 1\r\nX-Request-Id: be4c0ddb-a4d6-4b7f-b291-4bf38719a98b\r\nAccept: */*\r\nX-Titanium-Id: a2feff7e-fa06-4eb9-9555-81a1dbfd5849\r\nContent-Type: multipart/form-data; boundary=0xTibOuNdArY_1437747270\r\nHost: requestb.in\r\nUser-Agent: Appcelerator Titanium/4.1.0 (iPhone Simulator/8.4; iPhone OS; en_US;)\r\nAccept-Language: en-us\r\nAccept-Encoding: gzip, deflate\r\nVia: 1.1 vegur\r\nConnection: close\r\nX-Requested-With: XMLHttpRequest\r\nContent-Length: 424315\r\nTotal-Route-Time: 0\r\nRAW BODY\r\n\r\n--0xTibOuNdArY_1437747270\r\nContent-Disposition: form-data; name=\"ticket\"\r\nContent-Type:text/plain;charset=\"utf-8\"\r\n\r\n8423D076MA0D1MECA5MF8C9D5A5F043C66B\r\n--0xTibOuNdArY_1437747270\r\nContent-Disposition: form-data; name=\"imageType\"\r\nContent-Type:text/plain;charset=\"utf-8\"\r\n\r\nprofile-image\r\n--0xTibOuNdArY_1437747270\r\nContent-Disposition: form-data; name=\"imageFile\"; filename=\"01437747270.jpeg\"\r\nContent-Type: image/jpeg\r\n{code}\r\n\r\n*Here is the requestb.in output for Titanium SDK 3.5.1.GA*:\r\n{code}\r\nhttp://requestb.in\r\nPOST /11w0o7p1 multipart/form-data; charset=utf-8; boundary=0xTibOuNdArY_1437748068\r\n 414.29 kB 32s ago \r\nFrom 173.57.154.232\r\nFORM/POST PARAMETERS\r\n\r\nticket: 849D5625MA0D1MECA5MF8BB1805CBA271F6\r\nimageType: profile-image\r\nHEADERS\r\n\r\nConnect-Time: 1\r\nX-Request-Id: 9ea9915b-0ca1-4a0b-8c91-baa39b1e777c\r\nAccept: */*\r\nVia: 1.1 vegur\r\nContent-Type: multipart/form-data; charset=utf-8; boundary=0xTibOuNdArY_1437748068\r\nHost: requestb.in\r\nUser-Agent: Appcelerator Titanium/3.5.1 (iPhone Simulator/8.4; iPhone OS; en_US;)\r\nAccept-Language: en-us\r\nAccept-Encoding: gzip, deflate\r\nX-Titanium-Id: a2feff7e-fa06-4eb9-9555-81a1dbfd5849\r\nConnection: close\r\nX-Requested-With: XMLHttpRequest\r\nContent-Length: 424233\r\nTotal-Route-Time: 0\r\nRAW BODY\r\n\r\n--0xTibOuNdArY_1437748068\r\nContent-Disposition: form-data; name=\"ticket\"\r\n\r\n849D5625MA0D1MECA5MF8BB1805CBA271F6\r\n--0xTibOuNdArY_1437748068\r\nContent-Disposition: form-data; name=\"imageType\"\r\n\r\nprofile-image\r\n--0xTibOuNdArY_1437748068\r\nContent-Disposition: form-data; name=\"imageFile\"; filename=\"01437748068.jpeg\"\r\nContent-Type: image/jpeg\r\n{code}\r\n\r\nIs there a way to control the individual content-types on a multipart/form-data post? Specifically can I change the text parameters to have \"no Content-Type\" like it did in 3.5.1?\r\n", "attachment": [], "flagged": false, "summary": "iOS: HTTPClient multipart/form-data produces bad content-type headers for individual parts", "creator": { "name": "dspells", "key": "dspells", "displayName": "Henry David Spells III", "active": true, "timeZone": "America/Chicago" }, "subtasks": [], "reporter": { "name": "dspells", "key": "dspells", "displayName": "Henry David Spells III", "active": true, "timeZone": "America/Chicago" }, "environment": null, "closedSprints": [ { "id": 707, "state": "closed", "name": "2016 Sprint 19 SDK", "startDate": "2016-09-10T00:17:15.164Z", "endDate": "2016-09-24T00:17:00.000Z", "completeDate": "2016-09-26T05:17:04.253Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "364150", "author": { "name": "dspells", "key": "dspells", "displayName": "Henry David Spells III", "active": true, "timeZone": "America/Chicago" }, "body": "This is now a blocking / critical issue. I can't ship the \"Profile\" page on iOS 9 because of this issue. Can anybody at least give me some feedback on this?", "updateAuthor": { "name": "dspells", "key": "dspells", "displayName": "Henry David Spells III", "active": true, "timeZone": "America/Chicago" }, "created": "2015-09-17T05:29:10.000+0000", "updated": "2015-09-17T05:29:10.000+0000" }, { "id": "364212", "author": { "name": "dspells", "key": "dspells", "displayName": "Henry David Spells III", "active": true, "timeZone": "America/Chicago" }, "body": "Here is a console dump of what our server is returning if this is helpful.\r\n\r\n[INFO] onreadystatechange(Apache Tomcat/7.0.54 - Error report

HTTP Status 500 - Content type corrupt: Content-Type:text/plain;charset="utf-8"


type Exception report

message Content type corrupt: Content-Type:text/plain;charset="utf-8"

description The server encountered an internal error that prevented it from fulfilling this request.

exception

java.io.IOException: Content type corrupt: Content-Type:text/plain;charset="utf-8"\r\n\tcom.oreilly.servlet.multipart.MultipartParser.extractContentType(MultipartParser.java:425)\r\n\tcom.oreilly.servlet.multipart.MultipartParser.readNextPart(MultipartParser.java:285)\r\n\tcoldfusion.filter.FormScope.fillForm(FormScope.java:314)\r\n\tcoldfusion.filter.FusionContext.SymTab_initForRequest(FusionContext.java:466)\r\n\tcoldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:33)\r\n\tcoldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)\r\n\tcoldfusion.filter.CachingFilter.invoke(CachingFilter.java:62)\r\n\tcoldfusion.filter.RequestThrottleFilter.invoke(RequestThrottleFilter.java:151)\r\n\tcoldfusion.CfmServlet.service(CfmServlet.java:219)\r\n\tcoldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)\r\n\tcoldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)\r\n\tcoldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)\r\n

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.54 logs.


Apache Tomcat/7.0.54

)\r\n[INFO] onreadystatechange(Apache Tomcat/7.0.54 - Error report

HTTP Status 500 - Content type corrupt: Content-Type:text/plain;charset="utf-8"


type Exception report

message Content type corrupt: Content-Type:text/plain;charset="utf-8"

description The server encountered an internal error that prevented it from fulfilling this request.

exception

java.io.IOException: Content type corrupt: Content-Type:text/plain;charset="utf-8"\r\n\tcom.oreilly.servlet.multipart.MultipartParser.extractContentType(MultipartParser.java:425)\r\n\tcom.oreilly.servlet.multipart.MultipartParser.readNextPart(MultipartParser.java:285)\r\n\tcoldfusion.filter.FormScope.fillForm(FormScope.java:314)\r\n\tcoldfusion.filter.FusionContext.SymTab_initForRequest(FusionContext.java:466)\r\n\tcoldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:33)\r\n\tcoldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)\r\n\tcoldfusion.filter.CachingFilter.invoke(CachingFilter.java:62)\r\n\tcoldfusion.filter.RequestThrottleFilter.invoke(RequestThrottleFilter.java:151)\r\n\tcoldfusion.CfmServlet.service(CfmServlet.java:219)\r\n\tcoldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)\r\n\tcoldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)\r\n\tcoldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)\r\n

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.54 logs.


Apache Tomcat/7.0.54

)\r\n[INFO] Status: 500\r\n[INFO] ResponseText: Apache Tomcat/7.0.54 - Error report

HTTP Status 500 - Content type corrupt: Content-Type:text/plain;charset="utf-8"


type Exception report

message Content type corrupt: Content-Type:text/plain;charset="utf-8"

description The server encountered an internal error that prevented it from fulfilling this request.

exception

java.io.IOException: Content type corrupt: Content-Type:text/plain;charset="utf-8"\r\n\tcom.oreilly.servlet.multipart.MultipartParser.extractContentType(MultipartParser.java:425)\r\n\tcom.oreilly.servlet.multipart.MultipartParser.readNextPart(MultipartParser.java:285)\r\n\tcoldfusion.filter.FormScope.fillForm(FormScope.java:314)\r\n\tcoldfusion.filter.FusionContext.SymTab_initForRequest(FusionContext.java:466)\r\n\tcoldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:33)\r\n\tcoldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)\r\n\tcoldfusion.filter.CachingFilter.invoke(CachingFilter.java:62)\r\n\tcoldfusion.filter.RequestThrottleFilter.invoke(RequestThrottleFilter.java:151)\r\n\tcoldfusion.CfmServlet.service(CfmServlet.java:219)\r\n\tcoldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)\r\n\tcoldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)\r\n\tcoldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)\r\n

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.54 logs.


Apache Tomcat/7.0.54

\r\n[INFO] connectionType: POST\r\n[INFO] location: https://app.qbos.com/ws/QTP/cs/de9r/v2/imgUpload.cfm\r\n[INFO] Data request failed\r\n[INFO] profileTab.js::uploadImage::http::{\"url\":\"https://app.qbos.com/ws/QTP/cs/de9r/v2/imgUpload.cfm\",\"method\":\"POST\"}\r\n[INFO] profileTab.js::uploadImage::response::{\"success\":false,\"data\":null,\"errors\":[\"Error calling webservice\"]}\r\n", "updateAuthor": { "name": "dspells", "key": "dspells", "displayName": "Henry David Spells III", "active": true, "timeZone": "America/Chicago" }, "created": "2015-09-17T16:36:52.000+0000", "updated": "2015-09-17T16:36:52.000+0000" }, { "id": "373522", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, Can you provide a full code and description of what you are trying to achieve. Provide a full test code which generates the issue. Also provide a full step to reporduce. Also, please specify the full platform information node, java, CLI, SDK etc. Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2015-12-24T08:52:54.000+0000", "updated": "2015-12-24T08:52:54.000+0000" }, { "id": "373531", "author": { "name": "dspells", "key": "dspells", "displayName": "Henry David Spells III", "active": true, "timeZone": "America/Chicago" }, "body": "I'm uploading an image after acquiring it from the camera or gallery api's. Hopefully I have stripped the code down properly so that you can setup a project and run it. You will not be able to post an image to our servers but you should be able to see the request posted to requestb.in\r\n\r\nThe nod version is 0.12.7\r\n\r\nThe CLI version was given in the very first line of the bug. What are you asking for it again?\r\n\"Appcelerator Command-Line Interface, version 4.1.2\"\r\n\r\nThe SDK's being used were mentioned in the first few lines of the bug also. The code in question worked properly in iOS in 3.5.1.GA and changes were made that broke the code in 4.1.0.GA\"\r\n\"Titanium SDK 4.1.0.GA HTTPClient breaks my calls to multipart/form-data web services on my server by adding a \"Content-Type\" to text parameters that it did not add in SDK 3.5.1.GA.\" I will test the bug in the latest SDK to see if it still reproduces and post the results. This was taking to long to fix so we created a new API that doesn't use multipart/form-data encoding to work around the issue.\r\n\r\nThis bug is so old now that I don't know what version of java I was using at the time. However here is the version that I am currently using.\r\n\"java version \"1.7.0_80\"\r\nJava(TM) SE Runtime Environment (build 1.7.0_80-b15)\r\nJava HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)\"\r\n\r\nI apologize but I can never figure out how to make JIRA show javascript code properly despite adding the javascript code tags\r\n\r\n{code:javascript}\r\nfunction uploadImage(event, aicbfn)\r\n{\r\n\tsetProfileImage({imageFile: event.media}, function(http, response)\r\n\t{\r\n\t\tif (!showErrDialogIfNeeded(response))\r\n\t\t{\r\n\t\t\t// $.profileImageId.image = event.media;\r\n\t\t\t// social.updateMemberPicture(qtp.memberid(), event.media);\r\n\t\t}\r\n\t\tTitanium.API.info('profileTab.js::uploadImage::http::' + JSON.stringify(http));\r\n\t\tTitanium.API.info('profileTab.js::uploadImage::response::' + JSON.stringify(response));\r\n\t\taicbfn();\r\n\t});\r\n}\r\n\r\nvar imageAcquireFunctions =\r\n{\r\n\tsuccess:function(event)\r\n\t{\r\n\t\t// called when media returned from the camera\r\n\t\tTi.API.debug('Our type was: '+event.mediaType);\r\n\t\tif (event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO)\r\n\t\t{\r\n\t\t\tuploadImage(event, aicbfn);;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\talert(\"got the wrong type back =\"+event.mediaType);\r\n\t\t}\r\n\t},\r\n\tcancel:function()\r\n\t{\r\n\t\t// called when user cancels taking a picture\r\n\t},\r\n\terror:function(error)\r\n\t{\r\n\t\t// called when there's an error\r\n\t\tvar a = Titanium.UI.createAlertDialog({title:'Camera'});\r\n\t\tif (error.code == Titanium.Media.NO_CAMERA)\r\n\t\t{\r\n\t\t\ta.setMessage('Please run this test on a device with a camera');\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\ta.setMessage('Unexpected error: ' + error.code);\r\n\t\t}\r\n\t\ta.show();\r\n\t},\r\n\t// set this value before calling image acquisition function\r\n//\tsaveToPhotoGallery:true,\r\n // allowEditing and mediaTypes are iOS-only settings\r\n\tallowEditing:true,\r\n\tmediaTypes:[Ti.Media.MEDIA_TYPE_PHOTO]\r\n};\r\n\r\nfunction doAcquireCameraImage()\r\n{\r\n\timageAcquireFunctions.saveToPhotoGallery = true;\r\n\tTitanium.Media.showCamera(imageAcquireFunctions);\r\n}\r\n\r\nfunction doAcquireGalleryImage()\r\n{\r\n\timageAcquireFunctions.saveToPhotoGallery = false;\r\n\tTi.Media.openPhotoGallery(imageAcquireFunctions);\r\n}\r\n{code}", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2015-12-24T15:31:56.000+0000", "updated": "2015-12-27T06:57:02.000+0000" }, { "id": "373541", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, I have edited your post. Can you try to test the issue in the latest release SDK 5.1.1.GA. You said it was working on iOS in 3.5.1.GA. Try with the latest release. Reply with your findings, Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2015-12-27T07:00:45.000+0000", "updated": "2015-12-27T07:00:45.000+0000" }, { "id": "373545", "author": { "name": "dspells", "key": "dspells", "displayName": "Henry David Spells III", "active": true, "timeZone": "America/Chicago" }, "body": "This is still broken on iOS in SDK 5.1.1.GA. It still works on Android in SDK 5.1.1.GA.", "updateAuthor": { "name": "dspells", "key": "dspells", "displayName": "Henry David Spells III", "active": true, "timeZone": "America/Chicago" }, "created": "2015-12-28T04:01:14.000+0000", "updated": "2015-12-28T04:01:14.000+0000" }, { "id": "373548", "author": { "name": "mgumbs", "key": "mgumbs", "displayName": "Mahlon Gumbs", "active": true, "timeZone": "America/New_York" }, "body": "@Sharif, when we ran into this problem, it looked like it was because of the charset on the text and json parts of our multipart posts had their charset wrapped in quotes. Can you try looking at [APSHTTPPostForm.m|https://github.com/appcelerator/APSHTTPClient/blob/master/APSHTTPClient/APSHTTPPostForm.m] and removing the quotes around the charset on lines 69 and 90 according to the snippets below?\r\n\r\n{code:title=Replace line 69}\r\n[self appendStringData: [NSString stringWithFormat:@\"Content-Type:application/json;charset=\\\"%@\\\"\\r\\n\", charset]];\r\n{code}\r\n{code:title=With this}\r\n[self appendStringData: [NSString stringWithFormat:@\"Content-Type:application/json;charset=%@\\r\\n\", charset]];\r\n{code}\r\n\r\n{code:title=And replace line 90}\r\n[self appendStringData: [NSString stringWithFormat:@\"Content-Type:text/plain;charset=\\\"%@\\\"\\r\\n\", charset]];\r\n{code}\r\n{code:title=With this}\r\n[self appendStringData: [NSString stringWithFormat:@\"Content-Type:text/plain;charset=%@\\r\\n\", charset]];\r\n{code}\r\n\r\nHope that helps.", "updateAuthor": { "name": "mgumbs", "key": "mgumbs", "displayName": "Mahlon Gumbs", "active": true, "timeZone": "America/New_York" }, "created": "2015-12-28T06:32:53.000+0000", "updated": "2015-12-28T06:32:53.000+0000" }, { "id": "373559", "author": { "name": "dspells", "key": "dspells", "displayName": "Henry David Spells III", "active": true, "timeZone": "America/Chicago" }, "body": "Nice catch Mahlon. I will try this fix in the next beta or GA release of the SDK.", "updateAuthor": { "name": "dspells", "key": "dspells", "displayName": "Henry David Spells III", "active": true, "timeZone": "America/Chicago" }, "created": "2015-12-28T16:57:44.000+0000", "updated": "2015-12-28T16:57:44.000+0000" }, { "id": "389547", "author": { "name": "simbu-anubavam", "key": "simbu-anubavam", "displayName": "Silambarasan Raman Anubavam", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi Appcelerator Team,\r\n\r\nStill the same issue (image uploading not working) occurs with Ti SDK 5.2.2 GA. We had push our store release because of this issue, Its been long times @Mahlon Gumbs answered the solution above. Can you let us know the solution?", "updateAuthor": { "name": "simbu-anubavam", "key": "simbu-anubavam", "displayName": "Silambarasan Raman Anubavam", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-06-30T07:22:39.000+0000", "updated": "2016-06-30T07:22:39.000+0000" }, { "id": "389550", "author": { "name": "simbu-anubavam", "key": "simbu-anubavam", "displayName": "Silambarasan Raman Anubavam", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I have checked with Ti SDK 5.3.0 GA, Still the same issue occurs. Can you reply for the solution?\r\n\r\nGetting this error response: this.status=500\r\n500 Internal Server Error,\r\n\r\nNote:\r\nSame server working fine for Android ( with 5.3.0 GA) and also on iOS with Ti SDK 3.5.1 GA, But Issue for iOS with Latest SDK ( >4.1.0 GA)\r\n", "updateAuthor": { "name": "simbu-anubavam", "key": "simbu-anubavam", "displayName": "Silambarasan Raman Anubavam", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-06-30T07:54:28.000+0000", "updated": "2016-06-30T10:04:29.000+0000" }, { "id": "392597", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "[~simbu-anubavam] Is your charset on the text and json parts of your multipart posts wrapped in quotes? Try removing them to see if it solves the issue? Trying to identify if your error is the same as what the ticket describes.", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-08-08T05:53:51.000+0000", "updated": "2016-08-08T05:53:51.000+0000" }, { "id": "392611", "author": { "name": "simbu-anubavam", "key": "simbu-anubavam", "displayName": "Silambarasan Raman Anubavam", "active": true, "timeZone": "America/Los_Angeles" }, "body": "@Chee Kiat Ng,\r\n\r\nTried by removing quotes on JSON part of post params and for Content-type i am passing like this,\r\nxhr.setRequestHeader(\"Content-Type\", \"multipart/form-data\");\r\n\r\nImage upload is still not working", "updateAuthor": { "name": "simbu-anubavam", "key": "simbu-anubavam", "displayName": "Silambarasan Raman Anubavam", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-08-08T10:41:29.000+0000", "updated": "2016-08-08T10:44:07.000+0000" }, { "id": "392793", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "[~simbu-anubavam] I am not sure if the issue you are facing is exactly the same as what the ticket has described. If at all possible, it will help us greatly if you could provide a reproducible test case (as exact as the code you are using now) so we can investigate better? Appreciate it very much.", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-08-10T02:01:36.000+0000", "updated": "2016-08-10T02:01:36.000+0000" }, { "id": "392832", "author": { "name": "simbu-anubavam", "key": "simbu-anubavam", "displayName": "Silambarasan Raman Anubavam", "active": true, "timeZone": "America/Los_Angeles" }, "body": "@Chee Kiat Ng\r\nI have posted my code here, The same code working fine with Ti SDK 3.5.1 GA but not with Latest SDK\r\n\r\n{code}\r\n/*\r\n * Method for uploading image file to the server.\r\n */\r\nfunction uploadFile(claimID, filename, tenant, onSuccessCallback, onErrorCallBack) {\r\n var uploadingFile = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory, filename);\r\n var xhr = Titanium.Network.createHTTPClient({\r\n onload: function() {\r\n uploadingFile = null;\r\n onSuccessCallback(JSON.parse(this.responseText));\r\n },\r\n onerror: function(data) {\r\n Ti.API.info('error data=' + data);\r\n Ti.API.info('this.status=' + this.status);\r\n uploadingFile = null;\r\n\r\n onErrorCallBack(this.status);\r\n }\r\n });\r\n\r\n xhr.open('POST', httpClient.getUserDomainInfo(config.URLs.imageupload, tenant));\r\n xhr.setRequestHeader(\"Content-Type\", \"multipart/form-data\");\r\n\r\n xhr.send({\r\n file: uploadingFile.read(),\r\n claimId: claimID,\r\n filename: filename,\r\n description: ''\r\n });\r\n};\r\n\r\n/*\r\n * Method to update the image database when upload is successful.\r\n */\r\nvar uploadSuccessCallback = function(resp) {\r\n alert(\"image upload is succeeded and resp =\" + resp);\r\n};\r\n\r\n/*\r\n * Method to update the image database when upload is failed.\r\n */\r\nvar uploadErrorCallback = function(statuscode) {\r\n alert(\"upload is failed and status is \" + statuscode);\r\n};\r\n\r\n//Sending the server request to start the upload to the server.\r\nuploadFile(currentImage.claimid, currentImage.filename, currentImage.tenant, uploadSuccessCallback, uploadErrorCallback);\r\n{code}", "updateAuthor": { "name": "simbu-anubavam", "key": "simbu-anubavam", "displayName": "Silambarasan Raman Anubavam", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-08-10T09:30:06.000+0000", "updated": "2016-08-10T09:35:25.000+0000" }, { "id": "393371", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "[~simbu-anubavam] Do you have the log of what the server received? Can you show what the server expects to receive vs what this code produced? \r\nThen we can see what's malformed. Because the code looks about right to me. ", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-08-17T09:29:16.000+0000", "updated": "2016-08-17T09:29:16.000+0000" }, { "id": "393373", "author": { "name": "simbu-anubavam", "key": "simbu-anubavam", "displayName": "Silambarasan Raman Anubavam", "active": true, "timeZone": "America/Los_Angeles" }, "body": "@Chee Kiat Ng\r\n\r\nFYI:\r\n\r\nImage upload is working fine with below SDK versions\r\n\r\nTi SDK 3.5.1 GA Working\r\nTi SDK 4.1.0 GA - Working\r\n\r\nImage upload is NOT working with below SDK versions\r\n\r\nTi SDK 5.1.1 GA\r\nTi SDK 5.1.2 GA\r\nTi SDK 5.2.0 GA\r\nTi SDK 5.2.2 GA\r\nTi SDK 5.3.0 GA\r\nand Latest\r\n\r\nAlso for Android image upload is working fine on All the SDK version, Problem is only with iOS on specific Ti SDK versions , So surely there is no issues with our server part, And we don't have access to server part to show the log what server received.", "updateAuthor": { "name": "simbu-anubavam", "key": "simbu-anubavam", "displayName": "Silambarasan Raman Anubavam", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-08-17T09:59:27.000+0000", "updated": "2016-08-17T09:59:27.000+0000" }, { "id": "393494", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "[~simbu-anubavam] what if you comment out this line?\r\n{code}\r\n// xhr.setRequestHeader(\"Content-Type\", \"multipart/form-data\");\r\n{code}\r\nas explained here:\r\nhttp://docs.appcelerator.com/platform/latest/#!/api/Titanium.Network.HTTPClient\r\n{quote}\r\nOn the Android and iOS platforms:\r\n\r\nIf you are sending a JavaScript object, the content type is set to multipart/form-data automatically.\r\n{quote}\r\nSometimes there's loopholes in earlier versions that gave false correct results, that we may have fixed in a later version, that's why i needed as much info as possible. especially since a working version was so long ago.", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-08-18T08:05:45.000+0000", "updated": "2016-08-18T08:06:17.000+0000" }, { "id": "393499", "author": { "name": "simbu-anubavam", "key": "simbu-anubavam", "displayName": "Silambarasan Raman Anubavam", "active": true, "timeZone": "America/Los_Angeles" }, "body": "@Chee Kiat Ng\r\nI have tested by removing the below line\r\nxhr.setRequestHeader(\"Content-Type\", \"multipart/form-data\");\r\n\r\nAnd the same server error code 500 returned.", "updateAuthor": { "name": "simbu-anubavam", "key": "simbu-anubavam", "displayName": "Silambarasan Raman Anubavam", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-08-18T08:56:20.000+0000", "updated": "2016-08-18T08:56:20.000+0000" }, { "id": "393708", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Ok, I'd like to get this sorted before taking it under further investigation. Can you please show an example using {{https://httpbin.org/}} as the API endpoint that reproduces your issue (expected vs. actual behavior)? The above discussion looks a bit scattered.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-08-20T22:55:18.000+0000", "updated": "2016-08-20T22:55:18.000+0000" }, { "id": "395506", "author": { "name": "simbu-anubavam", "key": "simbu-anubavam", "displayName": "Silambarasan Raman Anubavam", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi @Hans Knoechel, \r\nCan you let me know what parameter i need to send along with the image upload call(https://httpbin.org/image),\r\n\r\nBecause i just tried by passing image as key with value as image object, and got the below error response:\r\n{\"success\":false,\"code\":405,\"source\":{\"url\":\"https://httpbin.org/image\",\"method\":\"POST\"},\"type\":\"error\",\"error\":\"HTTP error\"}", "updateAuthor": { "name": "simbu-anubavam", "key": "simbu-anubavam", "displayName": "Silambarasan Raman Anubavam", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-09-07T11:16:43.000+0000", "updated": "2016-09-07T11:16:43.000+0000" }, { "id": "395987", "author": { "name": "simbu-anubavam", "key": "simbu-anubavam", "displayName": "Silambarasan Raman Anubavam", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi @Hans Knoechel, \r\nWhat is the status of this ticket, It seems to be your Sprint 18 SDK date also ended on Sep 9, 2016,\r\nWe are waiting for this ticket to be resolved for submit our app to stores. \r\nHope we will get the good response from you", "updateAuthor": { "name": "simbu-anubavam", "key": "simbu-anubavam", "displayName": "Silambarasan Raman Anubavam", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-09-13T06:48:46.000+0000", "updated": "2016-09-13T06:48:46.000+0000" }, { "id": "396102", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~simbu-anubavam] The last weeks has been entirely blocked for iOS 10 and Xcode 8 support. As we just 5.5.0.GA, I can schedule a further investigation for this sprint. Thanks!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-09-14T09:23:57.000+0000", "updated": "2016-09-14T09:23:57.000+0000" }, { "id": "396706", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~simbu] -Can you try to revert [this line|https://github.com/appcelerator/titanium_mobile/pull/7010/files] and see if it changes something? The change was made for 4.1.1, so it might causing it and we need to go from there.- Guess that's not it.\r\n\r\n*EDIT*: And when I see it correctly, {{ticket}} and {{imageType}} should not have a {{Content-Type}}, but have {{text/plain}} that causes problems? If so, [this line|https://github.com/cheekiatng/APSHTTPClient/blob/9fb593f475a36f77e95e38ec0a70c040730dce11/APSHTTPClient/APSHTTPPostForm.m#L90] will likely cause the problems. What do you think? Try to replace [this library|https://www.dropbox.com/s/exb8z2ax9p5wmco/libAPSHTTPClient.a?dl=1] in your SDK (_iphone/Classes/APSHTTPClient/libAPSHTTPClient.a_) and tell me about your findings. It would be cool if we both use the same sample (the above one linked in the ticket) to discuss on code-level.\r\n\r\n*EDIT2*: Reading the official multipart-content-type specification ([RFC1341(MIME)|https://www.w3.org/Protocols/rfc1341/7_2_Multipart.html], providing a {{Content-Type: text/plain}} looks valid for text-parts:\r\n{code}\r\n Content-type: multipart/mixed; boundary=\"simple \r\n boundary\" \r\n\r\n This is the preamble. It is to be ignored, though it \r\n is a handy place for mail composers to include an \r\n explanatory note to non-MIME compliant readers. \r\n --simple boundary \r\n\r\n This is implicitly typed plain ASCII text. \r\n It does NOT end with a linebreak. \r\n --simple boundary \r\n Content-type: text/plain; charset=us-ascii \r\n\r\n This is explicitly typed plain ASCII text. \r\n It DOES end with a linebreak. \r\n\r\n --simple boundary-- \r\n This is the epilogue. It is also to be ignored.\r\n{code}\r\n\r\nAnother example:\r\n- http://stackoverflow.com/a/23517227/5537752", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-09-20T19:07:28.000+0000", "updated": "2016-09-20T20:06:55.000+0000" }, { "id": "396774", "author": { "name": "simbu-anubavam", "key": "simbu-anubavam", "displayName": "Silambarasan Raman Anubavam", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi @Hans Knoechel \r\n\r\nThanks for the sharing of [library files|https://www.dropbox.com/s/exb8z2ax9p5wmco/libAPSHTTPClient.a?dl=1] After replaced this file with Ti SDK 5.1.2 GA 's (iphone/Classes/APSHTTPClient/libAPSHTTPClient.a) file, Image upload was working fine, \r\n\r\nWe are happy to see the image upload is working perfectly, \r\n\r\nI am expecting this changes on the Latest SDK files. So that we don't need to change the file (iphone/Classes/APSHTTPClient/libAPSHTTPClient.a) manually. When we can expect this?", "updateAuthor": { "name": "simbu-anubavam", "key": "simbu-anubavam", "displayName": "Silambarasan Raman Anubavam", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-09-21T05:22:51.000+0000", "updated": "2016-09-21T05:22:51.000+0000" }, { "id": "396775", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "[~hansknoechel] bumped priority to 6.0.0.", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-09-21T05:32:04.000+0000", "updated": "2016-09-21T05:32:04.000+0000" }, { "id": "396799", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~simbu] The library is not meant to be used in SDK-versions < 5.5.0, since it incorporates with SDK-related logic that may changed between 5.1.x and 5.5.x. I can do a PR for it, sure, but the more I think about it, the more I think we should not remove the content-type for individual parts, because:\r\n- Every part should have a proper content-type\r\n- If we provide a text-parameter, it should get the content-type \"text/plain\"\r\n- The official specification suggests the same\r\n- A native example with the #1 request-framework for Swift (Alamofire) suggests the same (I made an example project [here|https://www.dropbox.com/s/hm9eydpux7oxtkz/formdata_test.zip?dl=0])\r\n\r\nSo I would rather see an issue with the webserver that it can't understand the content-type for individual parts OR you need to provide more details on why providing the content-type for individual parts (text-parts) does not make sense. I mean, we already supply the content-type for the image (image/jpeg), so why would we want to leave it out for the text-parts?", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-09-21T08:05:12.000+0000", "updated": "2016-09-21T08:05:12.000+0000" }, { "id": "396811", "author": { "name": "simbu-anubavam", "key": "simbu-anubavam", "displayName": "Silambarasan Raman Anubavam", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi Hans Knoechel,\r\n\r\nYes i am agree with you and we should not remove the content-type as per the official suggestion,\r\nBut why the image is not uploading even while not passing content-type and also with content-type as image/jpeg,\r\n\r\nCan you clarify this? And we are just tested by replace the library file as you asked, \r\n\r\nWhen we can expect the 6.0.0 release? we are holding our apps update to store due to this issue only. If you share the expected release date of 6.0.0, we will plan accordingly.", "updateAuthor": { "name": "simbu-anubavam", "key": "simbu-anubavam", "displayName": "Silambarasan Raman Anubavam", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-09-21T10:16:49.000+0000", "updated": "2016-09-21T10:16:49.000+0000" }, { "id": "397153", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Ok, after going through the logs again and checking the previous comments, [~mgumbs] was correct that we need to remove the quotes from the {{charset}}, different to the required ones in the {{Content-Disposition}}. -PR's coming.- The PR's are added below.\r\n\r\n[~simbu-anubavam] Please check the binary from the below PR and replace it with yours. The binary should work the same for 5.5.0, so you could replace it before we release 6.0.0 in November.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-09-24T15:32:13.000+0000", "updated": "2016-09-24T15:44:25.000+0000" }, { "id": "397154", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "PR (APSHTTPClient/master): https://github.com/appcelerator/APSHTTPClient/pull/37\r\n\r\nPR (titanium_mobile/master): https://github.com/appcelerator/titanium_mobile/pull/8430\r\nPR (titanium_mobile/6_0_X): https://github.com/appcelerator/titanium_mobile/pull/8431\r\n\r\nSee the above code-snipper for an example. Expected behavior when checking the requestb.in logs: The content-type of the individual parts is now {{Content-Type:text/plain;charset=utf-8}} instead of {{Content-Type:text/plain;charset=\"utf-8\"}} and therefore can be accepted by the server again.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-09-24T15:42:39.000+0000", "updated": "2016-09-24T15:42:39.000+0000" }, { "id": "397197", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "APPROVED", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-09-26T03:29:06.000+0000", "updated": "2016-09-26T03:29:06.000+0000" }, { "id": "400828", "author": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Verified fixed, using:\r\nMacOS 10.12 (16A323)\r\nStudio 4.8.0.201611020954\r\nTi SDK 6.0.0.v20161111062138\r\nAppc NPM 4.2.8-9\r\nAppc CLI 6.0.0-69\r\nAlloy 1.9.4\r\nXcode 8.1 (8B62)\r\n\r\nThe charset portion of the Content-type header is no longer in quotes. Images and other data is able to be POSTed to the server. Tested by using the provided test cases and verifying that the data/headers are correct in the server logs.", "updateAuthor": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-11-11T22:11:54.000+0000", "updated": "2016-11-11T22:11:54.000+0000" } ], "maxResults": 33, "total": 33, "startAt": 0 } } }