Titanium JIRA Archive
Appcelerator Community (AC)

[AC-472] Multipart HTTP request composed with errors

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionWon't Fix
Resolution Date2015-10-29T08:59:37.000+0000
Affected Version/sAppcelerator Studio 4.3.1
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsn/a
ReporterArtem Akulshin
AssigneeAshraf Abu
Created2015-10-18T07:18:58.000+0000
Updated2015-10-29T09:00:03.000+0000

Description

I send HTTP multipart request with te following code: thefile=Titanium.Filesystem.getFile(this.filepath_to_upload); postdata={ name: this.guid, createDT:this.createDT+"", session_length:this.session_length+"", device_model:Titanium.Platform.getModel(), device_manufacturer:Titanium.Platform.getManufacturer(), device_osname:Titanium.Platform.getOsname(), device_version:Titanium.Platform.getVersion(), device_locale:Titanium.Platform.getLocale(), result_type:2, //for fitness=0, for science=1, for fitness+science =2 debug:false, file: thefile }; client.open("POST", url); client.setRequestHeader( 'Authorization', 'Basic ' + Ti.Utils.base64encode(auth.username+':'+auth.password) ); client.setRequestHeader("enctype", "multipart/form-data"); client.send(postdata); And the app composes inclosed name tags in the request, for example: ---0Yp7DHdqG1dPhejcf_POatQ2DMYKnOxDBeC Content-Disposition: form-data; name="name Content-Type: ; charset=UTF-8 Content-Transfer-Encoding: 8bit 52959e65-8c74-c8c0-be18-90f047f5e9b6 ---0Yp7DHdqG1dPhejcf_POatQ2DMYKnOxDBeC Content-Disposition: form-data; name="device_locale Content-Type: ; charset=UTF-8 Content-Transfer-Encoding: 8bit en-US ---0Yp7DHdqG1dPhejcf_POatQ2DMYKnOxDBeC Content-Disposition: form-data; name="debug Content-Type: ; charset=UTF-8 Content-Transfer-Encoding: 8bit Only file field are formed correctly. This appear in all versions of Titanium SDK 5, but if fall back to version 4 or 3 - all works perfectly.

Attachments

FileDateSize
devcenetr-tcpdump.txt2015-10-18T07:18:18.000+00005442

Comments

  1. Artem Akulshin 2015-10-20

    The error does not appear under iOS.
  2. Ashraf Abu 2015-10-29

    [~xvk@mail.ru] You can run appc ti sdk install -d -b 5_0_X on terminal to get an updated SDK. This should be fixed with that version of SDK. Let me know if it's working for you.
  3. Artem Akulshin 2015-10-29

    Yes, it is fine with this version. Thank you.
  4. Ashraf Abu 2015-10-29

    Thanks [~xvk@mail.ru] for the reply. Resolving issue! :)

JSON Source