{ "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(
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.
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.
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.