GNOME Bugzilla – Bug 583462
emits authenticate twice in specific conditions
Last modified: 2009-05-21 21:48:39 UTC
This is that bug we have in WebKitGTK+, where the auth dialog shows up twice, after you cancelled it once (https://bugs.webkit.org/show_bug.cgi?id=24818). I have been investigating it, and I think I am close to understanding it. The problem is, when no authentication is atempted (the dialog is cancelled), soup adds the auth to its host->auths hash table nevertheless, even though it has no username/password. When soup-auth-manager's request_started is called, lookup_auth succeeds; since the last "auth" did not fail, it emits the authenticate signal to fill up the auth data, but also gets a 401, and emits authenticate again when it gets got-headers. I am trying to hack auth-test.c to test this possibility, but it is hanging for me. I'll try to get a test going tonight.
Created attachment 135131 [details] [review] test case for the problem There you go. This is what happens.
Fixed in git. Thanks for the regression test. As this has just missed 2.26.2, you'll probably want to work around it in WebKit. You should be able to just check msg->status_code in your authenticate handler, and if it's 0, just return immediately without doing anything else. That will basically replicate the behavior of the SoupAuthManager changes. (But put a comment there noting that it can go away later once WebKit depends on a libsoup newer than 2.26.2.)