[TIMOB-5807] getResponseHeader('WWW-Authenticate') on 401 returns null
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-01-05T12:44:38.000+0000 |
Affected Version/s | Release 1.7.2 |
Fix Version/s | Sprint 2011-45, Sprint 2011-49, Release 1.8.0.1, Release 2.0.0 |
Components | iOS |
Labels | module_network, parity, qe-testadded |
Reporter | Mutasim Karim |
Assignee | Stephen Tramer |
Created | 2011-08-22T08:12:36.000+0000 |
Updated | 2014-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.
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.
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.
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.
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)
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.
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.
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.
Reopening to remove merge tag.
Reopening issue to add tags
Added tag
Anvil test case added. PR link: https://github.com/appcelerator/titanium_mobile/pull/5011