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

iOS: Search for response headers is case sensitive

    Details

      Description

      Expected Behavior

      Create a custom header with a name, and find it by this name case insensitive

      Actual Behavior

      While upgrading from iOS4 to iOS5 we ran into some issues where iOS4 appeared to be changing the case of response header names--so "MY-Custom-Header" would become "My-Custom-Header". As a result when we tried searching for "MY-Custom-Header" it would not be found. To solve this problem we performed a case-insensitive search for response headers.
      In the Titanium Mobile's caseCorrect method (iPhone/Classes/TiUtils.m) it looks like the code is attempting to fix this case-changing problem on pre-iOS5 versions. There's a problem here though: if the a response header is called "my-custom-header" it will not be found in pre-iOS5 versions because caseCorrect converts it to "My-Custom-Header".

      Test Case

      var xhr = Titanium.Network.createHTTPClient();
       
      xhr.onload = function()
      {
          var customHeader = "my-custom-header";
          Titanium.API.debug( "Custom response header: " + customHeader + " = " + xhr.getResponseHeader( customHeader ) );
      };
       
      xhr.open( "GET", "http://localhost:8080/" );
      xhr.send();
      
      

      Response

      The debug output on the iPhone 4.3 Simulator was:
      [DEBUG] Custom response header: my-custom-header = undefined
      The debug output on the iPhone 5 Simulator was:
      [DEBUG] Custom response header: my-custom-header = header value

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                stephentramer Stephen Tramer
                Reporter:
                rtlechuga Radamantis Torres-Lechuga (Inactive)
              • Watchers:
                0 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

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

                    Git Integration