From f98d3bd44bfcaa322e9f1501ebc6b87dbb3043ad Mon Sep 17 00:00:00 2001 From: Ross Boucher Date: Sat, 1 May 2010 11:57:32 -0700 Subject: [PATCH] Add global 403 handler for CFHTTPRequest, to make it easier to catch authentication challenges. --- Objective-J/CFHTTPRequest.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Objective-J/CFHTTPRequest.js b/Objective-J/CFHTTPRequest.js index d4f9cba76..f44b334db 100644 --- a/Objective-J/CFHTTPRequest.js +++ b/Objective-J/CFHTTPRequest.js @@ -101,6 +101,9 @@ GLOBAL(CFHTTPRequest) = function() { determineAndDispatchHTTPRequestEvents(self); } + + if (CFHTTPRequest.AuthenticationDelegate !== nil) + this._eventDispatcher.addEventListener("HTTP403", function(){CFHTTPRequest.AuthenticationDelegate(self)}); } CFHTTPRequest.UninitializedState = 0; @@ -109,6 +112,9 @@ CFHTTPRequest.LoadedState = 2; CFHTTPRequest.InteractiveState = 3; CFHTTPRequest.CompleteState = 4; +//override to forward all CFHTTPRequest authorization failures to a single function +CFHTTPRequest.AuthenticationDelegate = nil; + CFHTTPRequest.prototype.status = function() { try