Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-14012

Android: Parity - XHR user agent is null on Android, populated on iOS

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: Release 3.1.1
    • Component/s: Android
    • Environment:

      Mac OS 10.8.3
      Safari: 6.0.4
      Xcode 4.6.2
      CLI: 3.1.1-alpha
      titanium-code-processor: 1.0.1-alpha
      Alloy: 1.1.3-alpha
      Appcelerator Studio, build: 3.1.1.201305271814
      Titanium SDK version 3.1.1.v20130524180421

      Description

      Description:

      While verifying results from an XHR feature change, I noted that the user agent for iOS and Android were different. On Android, the user agent is null.

      Here are examples of the user agent info for iOS and android:

      Android
      { 'x-titanium-id': 'd67defe8-12dd-45ba-b8fd-1e915158ee1b', 'x-requested-with': 'XMLHttpRequest', 'user-agent': '', host: '172.16.83.53:8000', connection: 'Keep-Alive' }
      iOS
      { host: '127.0.0.1:8000', 'x-titanium-id': '589be76d-ff3d-42ff-baca-07f1363aced0', 'accept-encoding': 'gzip', 'user-agent': 'Appcelerator Titanium/3.1.1.v20130522190722 (iPhone Simulator/6.0; iPhone OS; en_US;)', connection: 'close', 'x-requested-with': 'XMLHttpRequest' }
      Steps to reproduce:

      1) Download and run the attached ".js" file with "node testserver.js"
      2) Install the following test code and run in simulator
      3) Press the send request button

      Test code

      var win = Ti.UI.createWindow({
          backgroundColor : 'white'
      });
        
      var url = "http://127.0.0.1:8000";
        
      var button = Ti.UI.createButton({
          title : 'Send request',
          top : 280,
          width : 240,
          height : 100
      });
        
      win.add(button);
        
      button.addEventListener('click', function() {
          var client = Ti.Network.createHTTPClient({
              onload : function(e) {
                  Ti.API.info("Received text: " + this.responseText);
                  alert('success');
              },
              onerror : function(e) {
                  Ti.API.debug(e.error);
                  alert('error');
              },
              timeout : 5000
          });
          
          client.open("GET", url);
      //  client.setRequestHeader('X-Titanium-Id', null);
          client.send();
      });
        
      win.open();
      

      Result:

      Android user agent is null

      Expected Result:

      iOS and Android have parity with regards to user agent

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                srahim Sabil Rahim
                Reporter:
                emerriman Eric Merriman
                Reviewer:
                Ping Wang
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-16597
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Integration