Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-7504] Android: Network.createHTTPClient - properties not initialized at creation

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionInvalid
Resolution Date2017-06-13T17:48:35.000+0000
Affected Version/sRelease 1.8.1
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
ReporterJustin Szczurowski
AssigneeIngo Muschenetz
Created2012-01-29T06:39:06.000+0000
Updated2017-06-13T17:48:35.000+0000

Description

Problem

In the following snippet, autoEncodeUrl is not set to false as expected.

Test Case

var socket = Ti.Network.createHTTPClient({
	autoEncodeUrl: false
});

socket.onload = function() {
	alert(this.location); // You'll see the encoded URL here
	Ti.API.info('this.location: ' + this.location);
};

socket.open("GET", "http://www.bosscube.com/flash/clock.swf?param1=¶m2=%");
socket.send();

Logs

  846           TiApplication  I  (main) [353,353] Titanium 1.8.1 (2012/01/27 17:31 a24502a)
  846               TiFastDev  D  (main) [100,453] Enabling Fastdev on port 53208
  846               TiFastDev  D  (main) [10,463] sent tokens successfully
  846               TiFastDev  D  (main) [1,464] Fastdev session handshake succesful.
  846           TiApplication  I  (main) [8,472] Titanium Javascript runtime: v8
  846           TiApplication  W  (main) [49,521] activity stack is emtpy, unable to get current activity
  846          TiRootActivity  I  (main) [0,0] checkpoint, on root activity create, savedInstanceState: null
  846           TiApplication  W  (main) [127,127] activity stack is emtpy, unable to get current activity
  846           TiApplication  W  (main) [0,127] activity stack is emtpy, unable to get current activity
  846           TiApplication  W  (main) [3,130] activity stack is emtpy, unable to get current activity
   60     NotificationService  W  Object died trying to hide notification android.app.ITransientNotification$Stub$Proxy@45155df0 in package com.appcelerator.testing10
   60         ActivityManager  W  setProcessForeground called on unknown pid: 817
  846           TiApplication  E  (KrollRuntimeThread) [975,1105] APP PROXY: ti.modules.titanium.app.AppModule@44f0cf60
  846           TiAssetHelper  D  Fetching "app.js" with Fastdev...
  846           dalvikvm-heap  I  Grow heap (frag case) to 2.932MB for 68928-byte allocation
  846            TiHttpClient  D  (KrollRuntimeThread) [426,1531] Setting ready state to 1
  846          TiRootActivity  I  (main) [0,0] checkpoint, on root activity resume. activity = com.appcelerator.testing10.Testing10Activity@44eba558
   60         ActivityManager  I  Displayed activity com.appcelerator.testing10/.Testing10Activity: 3374 ms (total 3374 ms)
  846            TiHttpClient  D  (TiHttpClient-1) [1089,1089] Setting ready state to 2
  846            TiHttpClient  D  (TiHttpClient-1) [1,1090] Setting ready state to 3
  846            TiHttpClient  D  (TiHttpClient-1) [159,1249] Setting ready state to 4
  846                   ALERT  I  (KrollRuntimeThread) [4,1253] http://www.bosscube.com/flash/clock.swf?param1=¶m2=%EF%BF%BD%EF%BF%BD
  846                   TiAPI  I  this.location: http://www.bosscube.com/flash/clock.swf?param1=¶m2=0.000000E+00FBFBD1.269065E-317FBFBD

Workaround

Set autoEncodeUrl to false after creation.
var socket = Ti.Network.createHTTPClient();

socket.autoEncodeUrl = false;

socket.onload = function() {
    alert(this.location); // URL is now unencoded.
};

socket.open("GET", "http://www.bosscube.com/flash/clock.swf?param1= ¶m2=%");
socket.send();

Comments

  1. Paul Dowsett 2012-01-30

    Thanks for raising this ticket. In order for me to escalate it to the core team, please would you complete the environment field? Also, a console log of the test case in action would be appreciated. Please review the [JIRA Ticket Checklist](https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report#HowtoSubmitaBugReport-JIRATicketChecklist) when raising tickets, and always start with the [JIRA Ticket Template](https://wiki.appcelerator.org/display/guides/JIRA+Ticket+Template) to ensure they follow the recommended format. Thanks
  2. Lee Morris 2017-06-13

    Closing ticket due to the time passed, lack of information and lack of progress. Any problems, please file a new ticket.

JSON Source