Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-5807] getResponseHeader('WWW-Authenticate') on 401 returns null

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-01-05T12:44:38.000+0000
Affected Version/sRelease 1.7.2
Fix Version/sSprint 2011-45, Sprint 2011-49, Release 1.8.0.1, Release 2.0.0
ComponentsiOS
Labelsmodule_network, parity, qe-testadded
ReporterMutasim Karim
AssigneeStephen Tramer
Created2011-08-22T08:12:36.000+0000
Updated2014-06-19T12:44:15.000+0000

Description

Retrieving WWW-Authenticate header when the server status code is 401 returns null. Usecase:
var url = 'http://tools.dynamicdrive.com/password/example/';
var request = Titanium.Network.createHTTPClient();
request.open('GET',url);

//Send
request.send();

request.onerror = function() {
	if (this.status == 401) {
	 	Ti.API.info('Server: '+ this.getResponseHeader('Server'));
	 	Ti.API.info('Connection: '+ this.getResponseHeader('Connection'));
	 	Ti.API.info('WWW-Authenticate: '+this.getResponseHeader('WWW-Authenticate'));
	 	Ti.API.info('Date: '+this.getResponseHeader('Date'));
	 }
}
WWW-Authenticate is needed to create a Digest Auth system.

Comments

  1. Stephen Tramer 2011-11-11

    This is an Apple bug with HTTP header processing; for now, the response header is actually "Www-Authenticate". Until we can resolve this bug (which will require investigating the issue more completely and filing a report with Apple; this may affect more headers than just this one) you can use this workaround.
  2. Stephen Tramer 2011-11-11

    Pull request #679. Please let us know if you can keep your 401 response test up; I'll begin working on a reproduction outside of Titanium so that we can submit a response to Apple within short order.
  3. Stephen Tramer 2011-11-14

    Could not reproduce in 1.8.0.1.d6c7cab, iPhone Sim 5.0 / iPad 1 5.0. Was able to previously reproduce; could have been a configuration issue on the client side. Not sure what's up with this one.
  4. Wilson Luu 2011-12-10

    Closing bug. Verified fix on: OS: Mac OS X Lion SDK build: 1.8.0.1.RC1 Titanium Studio, build: 1.0.7.201112080131 Device: iphone 4S (5.0.1)
  5. James David Low 2011-12-10

    Hi Wilson, I just wanted to check the confirmation of the closing of this bug. Because the original bug only affects iOS4, it worked fine on iOS5 already.
  6. James David Low 2011-12-10

    Hi Wilson, I just wanted to check the confirmation of the closing of this bug. Because the original bug only affects iOS4, it worked fine on iOS5 already.
  7. Stephen Tramer 2011-12-10

    James - Looks like we didn't get a 4.x pass in the QE finalization, but I did test the bug and fix against iOS 4.3.5 during development and can confidently say that the issue is resolved. Please let us know if it's not or if the fix introduces issues with handling other headers or doesn't work for you so the bug can be reopened.
  8. Stephen Tramer 2011-12-14

    Reopening to remove merge tag.
  9. Wilson Luu 2012-01-05

    Reopening issue to add tags
  10. Wilson Luu 2012-01-05

    Added tag
  11. jithinpv 2013-11-25

    Anvil test case added. PR link: https://github.com/appcelerator/titanium_mobile/pull/5011

JSON Source