Bug 51559

Summary: kio_http remembering incorrect proxy username even after being corrected
Product: [Frameworks and Libraries] kio Reporter: Stuart Herring <stuart.herring>
Component: httpAssignee: Unassigned bugs mailing-list <unassigned-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: patch to invalidate proxy auth cache on error

Description Stuart Herring 2002-12-06 04:29:20 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc 2.95.4 
OS:          Linux

kio_http seems to be remembering the proxy username and password in at least two different places.
I supplied the username and password, but typoed the username, when re-prompted, I then supplied the correct username and password.

Now I will intermittantly get reprompted for username and password (via the proxy authentication failed) and the prefilled username field will contain my original typo.

It's remembering the corrected version most of the time, as new pages will usualy come up OK, but the loading of an image will sometimes prompt the proxy authentication failed with the wrong username.

I have tried restarting konqueror, but that didn't help.
I haven't tried logging out of and back into KDE, but I'm assuming that would probably fix it.

I think the same also happens with passwords, as whenever my proxy password changes, I often go through a day of having to resupply my password in the proxy auth failed dialogue for some images on the page, in the same way.  But of course, with passwords, I can't be certain that it's remembering my prechanged password.
Comment 1 Waldo Bastian 2002-12-06 10:44:16 UTC
Subject: Re:  New: kio_http remembering incorrect proxy username even after being corrected

>            Summary: kio_http remembering incorrect proxy username even
> after being corrected
>            Product: kio
>            Version: unspecified

Which version of KDE are you using?

Cheers,
Waldo
Comment 2 Stuart Herring 2002-12-07 00:41:54 UTC
CVS HEAD as of sometime last week.
I'll update this weekend and see if I can still reproduce it.

Regards,
Stuart
Comment 3 Waldo Bastian 2003-01-10 17:31:09 UTC
Created attachment 725 [details]
patch to invalidate proxy auth cache on error

This patch might help, please try
Comment 4 Waldo Bastian 2003-04-03 18:22:39 UTC
Subject: KDE_3_1_BRANCH: kdelibs/kioslave/http

CVS commit by waba: 

CCMAIL: 51559-done@bugs.kde.org
Refetch proxy credentials from kpasswd on error. (BR51559)


  M +14 -1     http.cc   1.551.2.10
  M +1 -0      http.h   1.145.2.3


--- kdelibs/kioslave/http/http.cc  #1.551.2.9:1.551.2.10
@@ -122,4 +122,5 @@ HTTPProtocol::HTTPProtocol( const QCStri
   m_bBusy = false;
   m_bFirstRequest = false;
+  m_bProxyAuthValid = false;
   
   m_iSize = NO_SIZE;
@@ -205,4 +206,5 @@ void HTTPProtocol::resetSessionSettings(
        (!proxy.pass().isNull() && proxy.pass() != m_proxyURL.pass()) )
   {
+    m_bProxyAuthValid = false;
     m_proxyURL = proxy;
     m_bUseProxy = m_proxyURL.isValid();
@@ -4790,4 +4792,14 @@ bool HTTPProtocol::getAuthorization()
     // We also do not use verify path unlike the pre-emptive
     // requests because we already know the realm value...
+    
+    if (m_bProxyAuthValid)
+    {
+      // Reset cached proxy auth
+      m_bProxyAuthValid = false;
+      KURL proxy = config()->readEntry("UseProxy");
+      m_proxyURL.setUser(proxy.user());
+      m_proxyURL.setPass(proxy.pass());
+    }
+    
     info.verifyPath = false;
     if ( m_responseCode == 407 )
@@ -4893,4 +4905,5 @@ void HTTPProtocol::saveAuthorization()
   if ( m_prevResponseCode == 407 )
   {
+    m_bProxyAuthValid = true;
     info.url = m_proxyURL;
     info.username = m_proxyURL.user();

--- kdelibs/kioslave/http/http.h  #1.145.2.2:1.145.2.3
@@ -502,4 +502,5 @@ protected:
   bool m_bNeedTunnel; // Whether we need to make a SSL tunnel
   bool m_bIsTunneled; // Whether we have an active SSL tunnel 
+  bool m_bProxyAuthValid;
   int m_iProxyPort;
   KURL m_proxyURL;