diff --git a/kio/kio/slavebase.cpp b/kio/kio/slavebase.cpp index 6667a941..0c80cbf7 100644 --- a/kio/kio/slavebase.cpp +++ b/kio/kio/slavebase.cpp @@ -80,7 +80,7 @@ static QString authInfoUrl(const KUrl &authinfourl, const bool removeuser) cleanurl.setPath(nullstring); cleanurl.setQuery(nullstring); cleanurl.setFragment(nullstring); - return cleanurl.prettyUrl(); + return cleanurl.url(); } static QByteArray authInfoKey(const AuthInfo &authinfo) @@ -571,18 +571,6 @@ void SlaveBase::reparseConfiguration() bool SlaveBase::openPasswordDialog(AuthInfo& info, const QString &errorMsg) { - KPasswdStore* passwdstore = d->passwdStore(); - Q_ASSERT(passwdstore); - - if (!passwdstore->isOpen() && passwdstore->openStore()) { - kDebug(7019) << "opening store for authorization" << info.url.prettyUrl(); - if (checkCachedAuthentication(info)) { - // do not store the authorization, it was just pulled from the cache - info.keepPassword = false; - return true; - } - } - if (metaData(QLatin1String("no-auth-prompt")).compare(QLatin1String("true"), Qt::CaseInsensitive) == 0) { kDebug(7019) << "not asking for authorization" << info.url.prettyUrl(); return false; @@ -936,12 +924,6 @@ bool SlaveBase::checkCachedAuthentication(AuthInfo &info) { KPasswdStore* passwdstore = d->passwdStore(); Q_ASSERT(passwdstore); - if (!passwdstore->isOpen() && !passwdstore->cacheOnly()) { - // let it fail the first time, if authorization is really required openPasswordDialog() - // will open the store and call this method - kDebug(7019) << "initial cache check rejected" << info.url.prettyUrl(); - return false; - } const qlonglong windowId = metaData(QLatin1String("window-id")).toLongLong(); QByteArray authkey = authInfoKey(info); diff --git a/kioslave/curl/kio_curl.cpp b/kioslave/curl/kio_curl.cpp index 92cf6907..40a2802e 100644 --- a/kioslave/curl/kio_curl.cpp +++ b/kioslave/curl/kio_curl.cpp @@ -1069,22 +1069,25 @@ bool CurlProtocol::setupCurl(const KUrl &url, const bool ftp) CURLcode CurlProtocol::performCurl(const KUrl &url, KUrl *redirecturl) { - CURLcode curlresult = CURLE_OK; KIO::AuthInfo kioauthinfo; kioauthinfo.url = url; kioauthinfo.username = url.userName(); kioauthinfo.password = url.password(); - if (checkCachedAuthentication(kioauthinfo)) { - kDebug(7103) << "Authorizing from cache" << url.prettyUrl(); - curlresult = setupAuth(kioauthinfo.username, kioauthinfo.password); - if (curlresult != CURLE_OK) { - return curlresult; + CURLcode curlresult = curl_easy_perform(m_curl); + if (curlresult != CURLE_OK) { + const KIO::Error kioerror = curlToKIOError(curlresult, m_curl); + if (kioerror == KIO::ERR_COULD_NOT_LOGIN) { + if (checkCachedAuthentication(kioauthinfo)) { + kDebug(7103) << "Authorizing from cache" << url.prettyUrl(); + curlresult = setupAuth(kioauthinfo.username, kioauthinfo.password); + if (curlresult != CURLE_OK) { + return curlresult; + } + curlresult = curl_easy_perform(m_curl); + } } - } else { - kDebug(7103) << "No cached authorization" << url.prettyUrl(); } - curlresult = curl_easy_perform(m_curl); if (curlresult != CURLE_OK) { const KIO::Error kioerror = curlToKIOError(curlresult, m_curl); if (kioerror == KIO::ERR_COULD_NOT_LOGIN) {