[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
mjs
mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:46:04 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 729da5ce3d96378e55b0ce058804b727a37bfff3
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Jul 2 22:48:41 2003 +0000
Reviewed by Ken.
- fixed 3304992 - REGRESSION: Every GET on an authenticated site requires a login (genentech)
I fixed this by adding a per-window queue of waiting
authentication requests. Before going to a later item in the
queue, the auth handler checks if there's already a credential
available to handle it, and if so uses that as the answer instead of
prompting.
* Panels.subproj/WebPanelAuthenticationHandler.h:
* Panels.subproj/WebPanelAuthenticationHandler.m:
(-[NSMutableDictionary _web_setObject:forUncopiedKey:]):
(-[WebPanelAuthenticationHandler init]):
(-[WebPanelAuthenticationHandler dealloc]):
(-[WebPanelAuthenticationHandler enqueueChallenge:forWindow:]):
(-[WebPanelAuthenticationHandler tryNextChallengeForWindow:]):
(-[WebPanelAuthenticationHandler startAuthentication:window:]):
(-[WebPanelAuthenticationHandler _authenticationDoneWithChallenge:result:]):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4581 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 9a8cef5..aea7807 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,25 @@
+2003-07-02 Maciej Stachowiak <mjs at apple.com>
+
+ Reviewed by Ken.
+
+ - fixed 3304992 - REGRESSION: Every GET on an authenticated site requires a login (genentech)
+
+ I fixed this by adding a per-window queue of waiting
+ authentication requests. Before going to a later item in the
+ queue, the auth handler checks if there's already a credential
+ available to handle it, and if so uses that as the answer instead of
+ prompting.
+
+ * Panels.subproj/WebPanelAuthenticationHandler.h:
+ * Panels.subproj/WebPanelAuthenticationHandler.m:
+ (-[NSMutableDictionary _web_setObject:forUncopiedKey:]):
+ (-[WebPanelAuthenticationHandler init]):
+ (-[WebPanelAuthenticationHandler dealloc]):
+ (-[WebPanelAuthenticationHandler enqueueChallenge:forWindow:]):
+ (-[WebPanelAuthenticationHandler tryNextChallengeForWindow:]):
+ (-[WebPanelAuthenticationHandler startAuthentication:window:]):
+ (-[WebPanelAuthenticationHandler _authenticationDoneWithChallenge:result:]):
+
2003-06-30 John Sullivan <sullivan at apple.com>
- fixed 3310716 -- Authentication dialog could be tweaked to
diff --git a/WebKit/Panels.subproj/WebPanelAuthenticationHandler.h b/WebKit/Panels.subproj/WebPanelAuthenticationHandler.h
index 2ef3bce..4febbb4 100644
--- a/WebKit/Panels.subproj/WebPanelAuthenticationHandler.h
+++ b/WebKit/Panels.subproj/WebPanelAuthenticationHandler.h
@@ -13,6 +13,7 @@
{
NSMutableDictionary *windowToPanel;
NSMutableDictionary *challengeToWindow;
+ NSMutableDictionary *windowToChallengeQueue;
}
+ (id)sharedHandler;
diff --git a/WebKit/Panels.subproj/WebPanelAuthenticationHandler.m b/WebKit/Panels.subproj/WebPanelAuthenticationHandler.m
index 0dfcb24..7dfa76a 100644
--- a/WebKit/Panels.subproj/WebPanelAuthenticationHandler.m
+++ b/WebKit/Panels.subproj/WebPanelAuthenticationHandler.m
@@ -13,6 +13,18 @@
static NSString *WebModalDialogPretendWindow = @"WebModalDialogPretendWindow";
+ at interface NSMutableDictionary (WebExtras)
+- (void)_web_setObject:(id)object forUncopiedKey:(id)key;
+ at end
+
+ at implementation NSMutableDictionary (WebExtras)
+-(void)_web_setObject:(id)object forUncopiedKey:(id)key
+{
+ CFDictionarySetValue((CFMutableDictionaryRef)self, key, object);
+}
+ at end
+
+
@implementation WebPanelAuthenticationHandler
WebPanelAuthenticationHandler *sharedHandler;
@@ -32,6 +44,7 @@ WebPanelAuthenticationHandler *sharedHandler;
if (self != nil) {
windowToPanel = [[NSMutableDictionary alloc] init];
challengeToWindow = [[NSMutableDictionary alloc] init];
+ windowToChallengeQueue = [[NSMutableDictionary alloc] init];
}
return self;
}
@@ -40,22 +53,66 @@ WebPanelAuthenticationHandler *sharedHandler;
{
[windowToPanel release];
[challengeToWindow release];
+ [windowToChallengeQueue release];
[super dealloc];
}
--(void)startAuthentication:(NSURLAuthenticationChallenge *)challenge window:(NSWindow *)w
+-(void)enqueueChallenge:(NSURLAuthenticationChallenge *)challenge forWindow:(id)window
{
- if ([w attachedSheet] != nil) {
- w = nil;
+ NSMutableArray *queue = [windowToChallengeQueue objectForKey:window];
+ if (queue == nil) {
+ queue = [[NSMutableArray alloc] init];
+ [windowToChallengeQueue _web_setObject:queue forUncopiedKey:window];
+ [queue release];
+ }
+ [queue addObject:challenge];
+}
+
+-(void)tryNextChallengeForWindow:(id)window
+{
+ NSMutableArray *queue = [windowToChallengeQueue objectForKey:window];
+ if (queue == nil) {
+ return;
+ }
+
+ NSURLAuthenticationChallenge *challenge = [[queue objectAtIndex:0] retain];
+ [queue removeObjectAtIndex:0];
+ if ([queue count] == 0) {
+ [windowToChallengeQueue removeObjectForKey:window];
}
+ NSURLCredential *latestCredential = [[NSURLCredentialStorage sharedCredentialStorage] defaultCredentialForProtectionSpace:[challenge protectionSpace]];
+
+ if ([latestCredential hasPassword]) {
+ [[challenge sender] useCredential:latestCredential forAuthenticationChallenge:challenge];
+ [challenge release];
+ return;
+ }
+
+ [self startAuthentication:challenge window:(window == WebModalDialogPretendWindow ? nil : window)];
+ [challenge release];
+}
+
+
+-(void)startAuthentication:(NSURLAuthenticationChallenge *)challenge window:(NSWindow *)w
+{
id window = w ? (id)w : (id)WebModalDialogPretendWindow;
if ([windowToPanel objectForKey:window] != nil) {
- [[challenge sender] cancelAuthenticationChallenge:challenge];
+ [self enqueueChallenge:challenge forWindow:window];
return;
}
+ // In this case, we have an attached sheet that's not one of our
+ // authentication panels, so enqueing is not an option. Just
+ // cancel authentication instead, since this case is fairly
+ // unlikely (how would you be loading a page if you had an error
+ // sheet up?)
+ if ([w attachedSheet] != nil) {
+ [[challenge sender] cancelAuthenticationChallenge:challenge];
+ return;
+ }
+
WebAuthenticationPanel *panel = [[WebAuthenticationPanel alloc] initWithCallback:self selector:@selector(_authenticationDoneWithChallenge:result:)];
[challengeToWindow _web_setObject:window forUncopiedKey:challenge];
[windowToPanel _web_setObject:panel forUncopiedKey:window];
@@ -80,6 +137,7 @@ WebPanelAuthenticationHandler *sharedHandler;
-(void)_authenticationDoneWithChallenge:(NSURLAuthenticationChallenge *)challenge result:(NSURLCredential *)credential
{
id window = [challengeToWindow objectForKey:challenge];
+ [window retain];
if (window != nil) {
[windowToPanel removeObjectForKey:window];
[challengeToWindow removeObjectForKey:challenge];
@@ -90,6 +148,9 @@ WebPanelAuthenticationHandler *sharedHandler;
} else {
[[challenge sender] useCredential:credential forAuthenticationChallenge:challenge];
}
+
+ [self tryNextChallengeForWindow:window];
+ [window release];
}
@end
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list