mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
generic: drop support for webdav protocol
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
f14e07536e
commit
0009cbb5a2
19 changed files with 102 additions and 487 deletions
|
@ -472,7 +472,6 @@ install(
|
||||||
KIO/PreviewJob
|
KIO/PreviewJob
|
||||||
KIO/RenameDialog
|
KIO/RenameDialog
|
||||||
KIO/Scheduler
|
KIO/Scheduler
|
||||||
KIO/SessionData
|
|
||||||
KIO/SimpleJob
|
KIO/SimpleJob
|
||||||
KIO/SkipDialog
|
KIO/SkipDialog
|
||||||
KIO/Slave
|
KIO/Slave
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
#include "../../kio/sessiondata.h"
|
|
|
@ -169,12 +169,10 @@
|
||||||
7101 kio_file
|
7101 kio_file
|
||||||
7102 kio_ftp
|
7102 kio_ftp
|
||||||
7103 kio_http
|
7103 kio_http
|
||||||
7104 kcookiejar
|
|
||||||
7106 kio_smb
|
7106 kio_smb
|
||||||
7109 kio_tar
|
7109 kio_tar
|
||||||
7110 kio_gzip
|
7110 kio_gzip
|
||||||
7112 kio_smtp
|
7112 kio_smtp
|
||||||
7113 kio_http_debug
|
|
||||||
7115 kio_thumbnail
|
7115 kio_thumbnail
|
||||||
7118 kio_bzip2
|
7118 kio_bzip2
|
||||||
7120 kio_sftp
|
7120 kio_sftp
|
||||||
|
|
|
@ -80,7 +80,7 @@ void KUrlNavigatorButton::setUrl(const KUrl& url)
|
||||||
// is given where KIO::stat() should not be used:
|
// is given where KIO::stat() should not be used:
|
||||||
static QSet<QString> protocols;
|
static QSet<QString> protocols;
|
||||||
if (protocols.isEmpty()) {
|
if (protocols.isEmpty()) {
|
||||||
protocols << "fish" << "ftp" << "nfs" << "sftp" << "smb" << "webdav";
|
protocols << "ftp" << "nfs" << "sftp" << "smb";
|
||||||
}
|
}
|
||||||
startTextResolving = !protocols.contains(m_url.protocol());
|
startTextResolving = !protocols.contains(m_url.protocol());
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,10 +173,6 @@ void KUrlNavigatorProtocolCombo::updateMenu()
|
||||||
menu = m_menu->addMenu(i18nc("@item:inmenu", "Devices"));
|
menu = m_menu->addMenu(i18nc("@item:inmenu", "Devices"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SubversionCategory:
|
|
||||||
menu = m_menu->addMenu(i18nc("@item:inmenu", "Subversion"));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case OtherCategory:
|
case OtherCategory:
|
||||||
menu = m_menu->addMenu(i18nc("@item:inmenu", "Other"));
|
menu = m_menu->addMenu(i18nc("@item:inmenu", "Other"));
|
||||||
break;
|
break;
|
||||||
|
@ -204,11 +200,9 @@ void KUrlNavigatorProtocolCombo::initializeCategories()
|
||||||
if (m_categories.isEmpty()) {
|
if (m_categories.isEmpty()) {
|
||||||
m_categories.insert("file", CoreCategory);
|
m_categories.insert("file", CoreCategory);
|
||||||
m_categories.insert("ftp", CoreCategory);
|
m_categories.insert("ftp", CoreCategory);
|
||||||
m_categories.insert("fish", CoreCategory);
|
|
||||||
m_categories.insert("nfs", CoreCategory);
|
m_categories.insert("nfs", CoreCategory);
|
||||||
m_categories.insert("sftp", CoreCategory);
|
m_categories.insert("sftp", CoreCategory);
|
||||||
m_categories.insert("smb", CoreCategory);
|
m_categories.insert("smb", CoreCategory);
|
||||||
m_categories.insert("webdav", CoreCategory);
|
|
||||||
|
|
||||||
m_categories.insert("desktop", PlacesCategory);
|
m_categories.insert("desktop", PlacesCategory);
|
||||||
m_categories.insert("fonts", PlacesCategory);
|
m_categories.insert("fonts", PlacesCategory);
|
||||||
|
@ -219,12 +213,6 @@ void KUrlNavigatorProtocolCombo::initializeCategories()
|
||||||
m_categories.insert("floppy", DevicesCategory);
|
m_categories.insert("floppy", DevicesCategory);
|
||||||
m_categories.insert("camera", DevicesCategory);
|
m_categories.insert("camera", DevicesCategory);
|
||||||
m_categories.insert("remote", DevicesCategory);
|
m_categories.insert("remote", DevicesCategory);
|
||||||
|
|
||||||
m_categories.insert("svn", SubversionCategory);
|
|
||||||
m_categories.insert("svn+file", SubversionCategory);
|
|
||||||
m_categories.insert("svn+http", SubversionCategory);
|
|
||||||
m_categories.insert("svn+https", SubversionCategory);
|
|
||||||
m_categories.insert("svn+ssh", SubversionCategory);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,6 @@ private:
|
||||||
CoreCategory,
|
CoreCategory,
|
||||||
PlacesCategory,
|
PlacesCategory,
|
||||||
DevicesCategory,
|
DevicesCategory,
|
||||||
SubversionCategory,
|
|
||||||
OtherCategory,
|
OtherCategory,
|
||||||
CategoryCount // mandatory last entry
|
CategoryCount // mandatory last entry
|
||||||
};
|
};
|
||||||
|
|
|
@ -93,7 +93,6 @@ set(kiocore_STAT_SRCS
|
||||||
kio/previewjob.cpp
|
kio/previewjob.cpp
|
||||||
kio/renamedialog.cpp
|
kio/renamedialog.cpp
|
||||||
kio/scheduler.cpp
|
kio/scheduler.cpp
|
||||||
kio/sessiondata.cpp
|
|
||||||
kio/skipdialog.cpp
|
kio/skipdialog.cpp
|
||||||
kio/slave.cpp
|
kio/slave.cpp
|
||||||
kio/slavebase.cpp
|
kio/slavebase.cpp
|
||||||
|
@ -257,7 +256,6 @@ install(
|
||||||
kio/slaveinterface.h
|
kio/slaveinterface.h
|
||||||
kio/slave.h
|
kio/slave.h
|
||||||
kio/slaveconfig.h
|
kio/slaveconfig.h
|
||||||
kio/sessiondata.h
|
|
||||||
kio/global.h
|
kio/global.h
|
||||||
kio/netaccess.h
|
kio/netaccess.h
|
||||||
kio/job.h
|
kio/job.h
|
||||||
|
|
|
@ -312,20 +312,9 @@ QString KProtocolManager::noProxyFor()
|
||||||
return noProxy;
|
return noProxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString adjustProtocol(const QString& scheme)
|
|
||||||
{
|
|
||||||
if (scheme.compare(QL1S("webdav"), Qt::CaseInsensitive) == 0)
|
|
||||||
return QL1S("http");
|
|
||||||
|
|
||||||
if (scheme.compare(QL1S("webdavs"), Qt::CaseInsensitive) == 0)
|
|
||||||
return QL1S("https");
|
|
||||||
|
|
||||||
return scheme.toLower();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString KProtocolManager::proxyFor( const QString& protocol )
|
QString KProtocolManager::proxyFor( const QString& protocol )
|
||||||
{
|
{
|
||||||
const QString key = adjustProtocol(protocol) + QL1S("Proxy");
|
const QString key = protocol.toLower() + QL1S("Proxy");
|
||||||
QString proxyStr (config()->group("Proxy Settings").readEntry(key));
|
QString proxyStr (config()->group("Proxy Settings").readEntry(key));
|
||||||
const int index = proxyStr.lastIndexOf(QL1C(' '));
|
const int index = proxyStr.lastIndexOf(QL1C(' '));
|
||||||
|
|
||||||
|
@ -392,7 +381,7 @@ QStringList KProtocolManager::proxiesForUrl( const KUrl &url )
|
||||||
case WPADProxy:
|
case WPADProxy:
|
||||||
{
|
{
|
||||||
KUrl u (url);
|
KUrl u (url);
|
||||||
const QString protocol = adjustProtocol(u.protocol());
|
const QString protocol = u.protocol().toLower();
|
||||||
u.setProtocol(protocol);
|
u.setProtocol(protocol);
|
||||||
|
|
||||||
if (protocol.startsWith(QL1S("http")) || protocol.startsWith(QL1S("ftp"))) {
|
if (protocol.startsWith(QL1S("http")) || protocol.startsWith(QL1S("ftp"))) {
|
||||||
|
@ -516,10 +505,9 @@ QString KProtocolManager::slaveProtocol(const KUrl &url, QStringList &proxyList)
|
||||||
}
|
}
|
||||||
|
|
||||||
// The idea behind slave protocols is not applicable to http
|
// The idea behind slave protocols is not applicable to http
|
||||||
// and webdav protocols as well as protocols unknown to KDE.
|
// protocol as well as protocols unknown to KDE.
|
||||||
if (!proxyList.isEmpty()
|
if (!proxyList.isEmpty()
|
||||||
&& !protocol.startsWith(QL1S("http"))
|
&& !protocol.startsWith(QL1S("http"))
|
||||||
&& !protocol.startsWith(QL1S("webdav"))
|
|
||||||
&& KProtocolInfo::isKnownProtocol(protocol)) {
|
&& KProtocolInfo::isKnownProtocol(protocol)) {
|
||||||
Q_FOREACH(const QString& proxy, proxyList) {
|
Q_FOREACH(const QString& proxy, proxyList) {
|
||||||
KUrl u (proxy);
|
KUrl u (proxy);
|
||||||
|
@ -537,39 +525,9 @@ QString KProtocolManager::slaveProtocol(const KUrl &url, QStringList &proxyList)
|
||||||
|
|
||||||
/*================================= USER-AGENT SETTINGS =====================*/
|
/*================================= USER-AGENT SETTINGS =====================*/
|
||||||
|
|
||||||
QString KProtocolManager::userAgentForHost( const QString& hostname )
|
|
||||||
{
|
|
||||||
const QString sendUserAgent = KIO::SlaveConfig::self()->configData("http", hostname.toLower(), "SendUserAgent").toLower();
|
|
||||||
if (sendUserAgent == QL1S("false"))
|
|
||||||
return QString();
|
|
||||||
|
|
||||||
const QString useragent = KIO::SlaveConfig::self()->configData("http", hostname.toLower(), "UserAgent");
|
|
||||||
|
|
||||||
// Return the default user-agent if none is specified
|
|
||||||
// for the requested host.
|
|
||||||
if (useragent.isEmpty())
|
|
||||||
return defaultUserAgent();
|
|
||||||
|
|
||||||
return useragent;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString KProtocolManager::defaultUserAgent( )
|
QString KProtocolManager::defaultUserAgent( )
|
||||||
{
|
{
|
||||||
const QString modifiers = KIO::SlaveConfig::self()->configData("http", QString(), "UserAgentKeys");
|
return defaultUserAgent(DEFAULT_USER_AGENT_KEYS);
|
||||||
return defaultUserAgent(modifiers);
|
|
||||||
}
|
|
||||||
|
|
||||||
static QString defaultUserAgentFromPreferredService()
|
|
||||||
{
|
|
||||||
QString agentStr;
|
|
||||||
|
|
||||||
// Check if the default COMPONENT contains a custom default UA string...
|
|
||||||
KService::Ptr service = KMimeTypeTrader::self()->preferredService(QL1S("text/html"),
|
|
||||||
QL1S("KParts/ReadOnlyPart"));
|
|
||||||
if (service && service->showInKDE())
|
|
||||||
agentStr = service->property(QL1S("X-KDE-Default-UserAgent"),
|
|
||||||
QVariant::String).toString();
|
|
||||||
return agentStr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString platform()
|
static QString platform()
|
||||||
|
@ -618,166 +576,53 @@ QString KProtocolManager::defaultUserAgent( const QString &_modifiers )
|
||||||
|
|
||||||
QString systemName, systemVersion, machine, supp;
|
QString systemName, systemVersion, machine, supp;
|
||||||
const bool sysInfoFound = getSystemNameVersionAndMachine( systemName, systemVersion, machine );
|
const bool sysInfoFound = getSystemNameVersionAndMachine( systemName, systemVersion, machine );
|
||||||
QString agentStr = defaultUserAgentFromPreferredService();
|
|
||||||
|
|
||||||
if (agentStr.isEmpty())
|
supp += platform();
|
||||||
|
|
||||||
|
if (sysInfoFound)
|
||||||
{
|
{
|
||||||
supp += platform();
|
if (modifiers.contains('o'))
|
||||||
|
|
||||||
if (sysInfoFound)
|
|
||||||
{
|
{
|
||||||
if (modifiers.contains('o'))
|
supp += QL1S("; ");
|
||||||
|
supp += systemName;
|
||||||
|
if (modifiers.contains('v'))
|
||||||
{
|
{
|
||||||
supp += QL1S("; ");
|
supp += QL1C(' ');
|
||||||
supp += systemName;
|
supp += systemVersion;
|
||||||
if (modifiers.contains('v'))
|
|
||||||
{
|
|
||||||
supp += QL1C(' ');
|
|
||||||
supp += systemVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (modifiers.contains('m'))
|
|
||||||
{
|
|
||||||
supp += QL1C(' ');
|
|
||||||
supp += machine;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modifiers.contains('l'))
|
if (modifiers.contains('m'))
|
||||||
{
|
{
|
||||||
supp += QL1S("; ");
|
supp += QL1C(' ');
|
||||||
supp += KGlobal::locale()->language();
|
supp += machine;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Full format: Mozilla/5.0 (Linux
|
if (modifiers.contains('l'))
|
||||||
d->useragent = QL1S("Mozilla/5.0 (");
|
{
|
||||||
d->useragent += supp;
|
supp += QL1S("; ");
|
||||||
d->useragent += QL1S(") KHTML/");
|
supp += KGlobal::locale()->language();
|
||||||
d->useragent += QString::number(KDE::versionMajor());
|
}
|
||||||
d->useragent += QL1C('.');
|
|
||||||
d->useragent += QString::number(KDE::versionMinor());
|
|
||||||
d->useragent += QL1C('.');
|
|
||||||
d->useragent += QString::number(KDE::versionRelease());
|
|
||||||
d->useragent += QL1S(" (like Gecko) Konqueror/");
|
|
||||||
d->useragent += QString::number(KDE::versionMajor());
|
|
||||||
d->useragent += QL1C('.');
|
|
||||||
d->useragent += QString::number(KDE::versionMinor());
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
QString appName = QCoreApplication::applicationName();
|
|
||||||
if (appName.isEmpty() || appName.startsWith(QL1S("kcmshell"), Qt::CaseInsensitive))
|
|
||||||
appName = QL1S ("KDE");
|
|
||||||
|
|
||||||
QString appVersion = QCoreApplication::applicationVersion();
|
// Full format: Mozilla/5.0 (Linux
|
||||||
if (appVersion.isEmpty()) {
|
d->useragent = QL1S("Mozilla/5.0 (");
|
||||||
appVersion += QString::number(KDE::versionMajor());
|
d->useragent += supp;
|
||||||
appVersion += QL1C('.');
|
d->useragent += QL1S(") KHTML/");
|
||||||
appVersion += QString::number(KDE::versionMinor());
|
d->useragent += QString::number(KDE::versionMajor());
|
||||||
appVersion += QL1C('.');
|
d->useragent += QL1C('.');
|
||||||
appVersion += QString::number(KDE::versionRelease());
|
d->useragent += QString::number(KDE::versionMinor());
|
||||||
}
|
d->useragent += QL1C('.');
|
||||||
|
d->useragent += QString::number(KDE::versionRelease());
|
||||||
appName += QL1C('/');
|
d->useragent += QL1S(" (like Gecko) Konqueror/");
|
||||||
appName += appVersion;
|
d->useragent += QString::number(KDE::versionMajor());
|
||||||
|
d->useragent += QL1C('.');
|
||||||
agentStr.replace(QL1S("%appversion%"), appName, Qt::CaseInsensitive);
|
d->useragent += QString::number(KDE::versionMinor());
|
||||||
|
|
||||||
if (!QSslSocket::supportsSsl())
|
|
||||||
agentStr.replace(QL1S("%security%"), QL1S("N"), Qt::CaseInsensitive);
|
|
||||||
else
|
|
||||||
agentStr.remove(QL1S("%security%"), Qt::CaseInsensitive);
|
|
||||||
|
|
||||||
if (sysInfoFound)
|
|
||||||
{
|
|
||||||
// Platform (e.g. X11). It is no longer configurable from UI.
|
|
||||||
agentStr.replace(QL1S("%platform%"), platform(), Qt::CaseInsensitive);
|
|
||||||
|
|
||||||
// Operating system (e.g. Linux)
|
|
||||||
if (modifiers.contains('o'))
|
|
||||||
{
|
|
||||||
agentStr.replace(QL1S("%osname%"), systemName, Qt::CaseInsensitive);
|
|
||||||
|
|
||||||
// OS version (e.g. 2.6.36)
|
|
||||||
if (modifiers.contains('v'))
|
|
||||||
agentStr.replace(QL1S("%osversion%"), systemVersion, Qt::CaseInsensitive);
|
|
||||||
else
|
|
||||||
agentStr.remove(QL1S("%osversion%"), Qt::CaseInsensitive);
|
|
||||||
|
|
||||||
// Machine type (i686, x86-64, etc.)
|
|
||||||
if (modifiers.contains('m'))
|
|
||||||
agentStr.replace(QL1S("%systype%"), machine, Qt::CaseInsensitive);
|
|
||||||
else
|
|
||||||
agentStr.remove(QL1S("%systype%"), Qt::CaseInsensitive);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
agentStr.remove(QL1S("%osname%"), Qt::CaseInsensitive);
|
|
||||||
agentStr.remove(QL1S("%osversion%"), Qt::CaseInsensitive);
|
|
||||||
agentStr.remove(QL1S("%systype%"), Qt::CaseInsensitive);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Language (e.g. en_US)
|
|
||||||
if (modifiers.contains('l'))
|
|
||||||
agentStr.replace(QL1S("%language%"), KGlobal::locale()->language(), Qt::CaseInsensitive);
|
|
||||||
else
|
|
||||||
agentStr.remove(QL1S("%language%"), Qt::CaseInsensitive);
|
|
||||||
|
|
||||||
// Clean up unnecessary separators that could be left over from the
|
|
||||||
// possible keyword removal above...
|
|
||||||
agentStr.replace(QRegExp("[(]\\s*[;]\\s*"), QL1S("("));
|
|
||||||
agentStr.replace(QRegExp("[;]\\s*[;]\\s*"), QL1S("; "));
|
|
||||||
agentStr.replace(QRegExp("\\s*[;]\\s*[)]"), QL1S(")"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
agentStr.remove(QL1S("%osname%"));
|
|
||||||
agentStr.remove(QL1S("%osversion%"));
|
|
||||||
agentStr.remove(QL1S("%platform%"));
|
|
||||||
agentStr.remove(QL1S("%systype%"));
|
|
||||||
agentStr.remove(QL1S("%language%"));
|
|
||||||
}
|
|
||||||
|
|
||||||
d->useragent = agentStr.simplified();
|
|
||||||
}
|
|
||||||
|
|
||||||
//kDebug() << "USERAGENT STRING:" << d->useragent;
|
//kDebug() << "USERAGENT STRING:" << d->useragent;
|
||||||
return d->useragent;
|
return d->useragent;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString KProtocolManager::userAgentForApplication( const QString &appName, const QString& appVersion,
|
|
||||||
const QStringList& extraInfo )
|
|
||||||
{
|
|
||||||
QString systemName, systemVersion, machine, info;
|
|
||||||
|
|
||||||
if (getSystemNameVersionAndMachine( systemName, systemVersion, machine ))
|
|
||||||
{
|
|
||||||
info += systemName;
|
|
||||||
info += QL1C('/');
|
|
||||||
info += systemVersion;
|
|
||||||
info += QL1S("; ");
|
|
||||||
}
|
|
||||||
|
|
||||||
info += QL1S("KDE/");
|
|
||||||
info += QString::number(KDE::versionMajor());
|
|
||||||
info += QL1C('.');
|
|
||||||
info += QString::number(KDE::versionMinor());
|
|
||||||
info += QL1C('.');
|
|
||||||
info += QString::number(KDE::versionRelease());
|
|
||||||
|
|
||||||
if (!machine.isEmpty())
|
|
||||||
{
|
|
||||||
info += QL1S("; ");
|
|
||||||
info += machine;
|
|
||||||
}
|
|
||||||
|
|
||||||
info += QL1S("; ");
|
|
||||||
info += extraInfo.join(QL1S("; "));
|
|
||||||
|
|
||||||
return (appName + QL1C('/') + appVersion + QL1S(" (") + info + QL1C(')'));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool KProtocolManager::getSystemNameVersionAndMachine(
|
bool KProtocolManager::getSystemNameVersionAndMachine(
|
||||||
QString& systemName, QString& systemVersion, QString& machine )
|
QString& systemName, QString& systemVersion, QString& machine )
|
||||||
{
|
{
|
||||||
|
|
|
@ -85,36 +85,6 @@ public:
|
||||||
*/
|
*/
|
||||||
static QString defaultUserAgent(const QString &keys);
|
static QString defaultUserAgent(const QString &keys);
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the application's user-agent string.
|
|
||||||
* Example string is "KMail/1.9.50 (Windows/6.0; KDE/3.97.1; i686; svn-762186; 2008-01-15)",
|
|
||||||
* where "KMail" is the @p appName parameter, "1.9.50" is the @p appVersion parameter,
|
|
||||||
* "Windows/6.0; KDE/3.97.1; i686" part is added automatically and "svn-762186; 2008-01-15"
|
|
||||||
* is provided by @p extraInfo list.
|
|
||||||
*
|
|
||||||
* @param appName name of the application
|
|
||||||
* @param appVersion name of the application
|
|
||||||
* @param extraInfo a list of elements that will be appended to the string as extra information
|
|
||||||
* @return the application's user-agent string
|
|
||||||
*
|
|
||||||
* @since 4.1
|
|
||||||
*/
|
|
||||||
static QString userAgentForApplication( const QString &appName, const QString& appVersion,
|
|
||||||
const QStringList& extraInfo = QStringList() );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the user-agent string configured for the
|
|
||||||
* specified host.
|
|
||||||
*
|
|
||||||
* If hostname is not found or is empty (i.e. "" or
|
|
||||||
* QString()) this function will return the default
|
|
||||||
* user agent.
|
|
||||||
*
|
|
||||||
* @param hostname name of the host
|
|
||||||
* @return specified user-agent string
|
|
||||||
*/
|
|
||||||
static QString userAgentForHost( const QString &hostname );
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns system name, version and machine type, for example "Windows", "5.1", "i686".
|
* Returns system name, version and machine type, for example "Windows", "5.1", "i686".
|
||||||
* This information can be used for constructing custom user-agent strings.
|
* This information can be used for constructing custom user-agent strings.
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#include "scheduler.h"
|
#include "scheduler.h"
|
||||||
#include "scheduler_p.h"
|
#include "scheduler_p.h"
|
||||||
|
|
||||||
#include "sessiondata.h"
|
|
||||||
#include "slaveconfig.h"
|
#include "slaveconfig.h"
|
||||||
#include "authinfo.h"
|
#include "authinfo.h"
|
||||||
#include "slave.h"
|
#include "slave.h"
|
||||||
|
@ -31,7 +30,8 @@
|
||||||
#include <kdebug.h>
|
#include <kdebug.h>
|
||||||
#include <kprotocolmanager.h>
|
#include <kprotocolmanager.h>
|
||||||
#include <kprotocolinfo.h>
|
#include <kprotocolinfo.h>
|
||||||
#include <assert.h>
|
#include <kstandarddirs.h>
|
||||||
|
|
||||||
|
|
||||||
#include <QtCore/qhash.h>
|
#include <QtCore/qhash.h>
|
||||||
#include <QtGui/qwidget.h>
|
#include <QtGui/qwidget.h>
|
||||||
|
@ -39,6 +39,8 @@
|
||||||
#include <QtCore/qcoreapplication.h>
|
#include <QtCore/qcoreapplication.h>
|
||||||
#include <QtCore/qthread.h>
|
#include <QtCore/qthread.h>
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
// Slaves may be idle for a certain time (3 minutes) before they are killed.
|
// Slaves may be idle for a certain time (3 minutes) before they are killed.
|
||||||
static const int s_idleSlaveLifetime = 3 * 60;
|
static const int s_idleSlaveLifetime = 3 * 60;
|
||||||
|
|
||||||
|
@ -68,6 +70,47 @@ static void setupSlave(KIO::Slave *slave, const KUrl &url, const QString &protoc
|
||||||
static Scheduler *scheduler();
|
static Scheduler *scheduler();
|
||||||
static Slave *heldSlaveForJob(SimpleJob *job);
|
static Slave *heldSlaveForJob(SimpleJob *job);
|
||||||
|
|
||||||
|
/********************************* SessionData ****************************/
|
||||||
|
|
||||||
|
SessionData::SessionData()
|
||||||
|
{
|
||||||
|
useCookie = true;
|
||||||
|
initDone = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
SessionData::~SessionData()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void SessionData::configDataFor( MetaData &configData, const QString &proto)
|
||||||
|
{
|
||||||
|
if ( (proto.startsWith(QLatin1String("http"), Qt::CaseInsensitive)) )
|
||||||
|
{
|
||||||
|
if (!initDone)
|
||||||
|
reset();
|
||||||
|
|
||||||
|
// These might have already been set so check first
|
||||||
|
// to make sure that we do not trumpt settings sent
|
||||||
|
// by apps or end-user.
|
||||||
|
if ( configData["Languages"].isEmpty() )
|
||||||
|
configData["Languages"] = language;
|
||||||
|
if ( configData["Charsets"].isEmpty() )
|
||||||
|
configData["Charsets"] = charsets;
|
||||||
|
if ( configData["CacheDir"].isEmpty() )
|
||||||
|
configData["CacheDir"] = KGlobal::dirs()->saveLocation("cache", "http");
|
||||||
|
if ( configData["UserAgent"].isEmpty() )
|
||||||
|
configData["UserAgent"] = KProtocolManager::defaultUserAgent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SessionData::reset()
|
||||||
|
{
|
||||||
|
initDone = true;
|
||||||
|
|
||||||
|
language = KProtocolManager::acceptLanguagesHeader();
|
||||||
|
charsets = QString::fromLatin1(QTextCodec::codecForLocale()->name()).toLower();
|
||||||
|
KProtocolManager::reparseConfiguration();
|
||||||
|
}
|
||||||
|
|
||||||
int SerialPicker::changedPrioritySerial(int oldSerial, int newPriority) const
|
int SerialPicker::changedPrioritySerial(int oldSerial, int newPriority) const
|
||||||
{
|
{
|
||||||
|
@ -1047,7 +1090,7 @@ MetaData SchedulerPrivate::metaDataFor(const QString &protocol, const QStringLis
|
||||||
{
|
{
|
||||||
const QString host = url.host();
|
const QString host = url.host();
|
||||||
MetaData configData = SlaveConfig::self()->configData(protocol, host);
|
MetaData configData = SlaveConfig::self()->configData(protocol, host);
|
||||||
sessionData.configDataFor( configData, protocol, host );
|
sessionData.configDataFor( configData, protocol );
|
||||||
if (proxyList.isEmpty()) {
|
if (proxyList.isEmpty()) {
|
||||||
configData.remove(QLatin1String("UseProxy"));
|
configData.remove(QLatin1String("UseProxy"));
|
||||||
configData.remove(QLatin1String("ProxyUrls"));
|
configData.remove(QLatin1String("ProxyUrls"));
|
||||||
|
|
|
@ -24,6 +24,22 @@
|
||||||
|
|
||||||
namespace KIO {
|
namespace KIO {
|
||||||
|
|
||||||
|
class SessionData
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SessionData();
|
||||||
|
~SessionData();
|
||||||
|
|
||||||
|
void configDataFor(KIO::MetaData &configData, const QString &proto);
|
||||||
|
void reset();
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool initDone;
|
||||||
|
bool useCookie;
|
||||||
|
QString charsets;
|
||||||
|
QString language;
|
||||||
|
};
|
||||||
|
|
||||||
class SlaveKeeper : public QObject
|
class SlaveKeeper : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
|
@ -1,133 +0,0 @@
|
||||||
/* This file is part of the KDE project
|
|
||||||
Copyright (C) 2000 Dawit Alemayehu <adawit@kde.org>
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License (LGPL) as published by the Free Software Foundation;
|
|
||||||
either version 2 of the License, or (at your option) any
|
|
||||||
later version.
|
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Library General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; see the file COPYING.LIB. If not,
|
|
||||||
write to the Free Software Foundation, Inc., 51 Franklin Street,
|
|
||||||
Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "sessiondata.h"
|
|
||||||
#include "moc_sessiondata.cpp"
|
|
||||||
|
|
||||||
#include <QtCore/QList>
|
|
||||||
#include <QtCore/QTextCodec>
|
|
||||||
|
|
||||||
#include <kdebug.h>
|
|
||||||
#include <kconfiggroup.h>
|
|
||||||
#include <kglobal.h>
|
|
||||||
#include <klocale.h>
|
|
||||||
#include <kprotocolmanager.h>
|
|
||||||
#include <ksharedconfig.h>
|
|
||||||
#include <kstandarddirs.h>
|
|
||||||
|
|
||||||
#include <kio/slaveconfig.h>
|
|
||||||
#include <kio/http_slave_defaults.h>
|
|
||||||
|
|
||||||
namespace KIO {
|
|
||||||
|
|
||||||
/***************************** SessionData::AuthData ************************/
|
|
||||||
#if 0
|
|
||||||
struct SessionData::AuthData
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
AuthData() {}
|
|
||||||
|
|
||||||
AuthData(const QByteArray& k, const QByteArray& g, bool p) {
|
|
||||||
key = k;
|
|
||||||
group = g;
|
|
||||||
persist = p;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isKeyMatch( const QByteArray& val ) const {
|
|
||||||
return (val==key);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isGroupMatch( const QByteArray& val ) const {
|
|
||||||
return (val==group);
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray key;
|
|
||||||
QByteArray group;
|
|
||||||
bool persist;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/********************************* SessionData ****************************/
|
|
||||||
|
|
||||||
class SessionData::SessionDataPrivate
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
SessionDataPrivate() {
|
|
||||||
useCookie = true;
|
|
||||||
initDone = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool initDone;
|
|
||||||
bool useCookie;
|
|
||||||
QString charsets;
|
|
||||||
QString language;
|
|
||||||
};
|
|
||||||
|
|
||||||
SessionData::SessionData()
|
|
||||||
:d(new SessionDataPrivate)
|
|
||||||
{
|
|
||||||
// authData = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
SessionData::~SessionData()
|
|
||||||
{
|
|
||||||
delete d;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SessionData::configDataFor( MetaData &configData, const QString &proto,
|
|
||||||
const QString & )
|
|
||||||
{
|
|
||||||
if ( (proto.startsWith(QLatin1String("http"), Qt::CaseInsensitive)) ||
|
|
||||||
(proto.startsWith(QLatin1String("webdav"), Qt::CaseInsensitive)) )
|
|
||||||
{
|
|
||||||
if (!d->initDone)
|
|
||||||
reset();
|
|
||||||
|
|
||||||
// These might have already been set so check first
|
|
||||||
// to make sure that we do not trumpt settings sent
|
|
||||||
// by apps or end-user.
|
|
||||||
if ( configData["Cookies"].isEmpty() )
|
|
||||||
configData["Cookies"] = d->useCookie ? "true" : "false";
|
|
||||||
if ( configData["Languages"].isEmpty() )
|
|
||||||
configData["Languages"] = d->language;
|
|
||||||
if ( configData["Charsets"].isEmpty() )
|
|
||||||
configData["Charsets"] = d->charsets;
|
|
||||||
if ( configData["CacheDir"].isEmpty() )
|
|
||||||
configData["CacheDir"] = KGlobal::dirs()->saveLocation("cache", "http");
|
|
||||||
if ( configData["UserAgent"].isEmpty() )
|
|
||||||
configData["UserAgent"] = KProtocolManager::defaultUserAgent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SessionData::reset()
|
|
||||||
{
|
|
||||||
d->initDone = true;
|
|
||||||
// Get Cookie settings...
|
|
||||||
d->useCookie = KSharedConfig::openConfig("kcookiejarrc", KConfig::NoGlobals)->
|
|
||||||
group("Cookie Policy").
|
|
||||||
readEntry("Cookies", true);
|
|
||||||
|
|
||||||
d->language = KProtocolManager::acceptLanguagesHeader();
|
|
||||||
d->charsets = QString::fromLatin1(QTextCodec::codecForLocale()->name()).toLower();
|
|
||||||
KProtocolManager::reparseConfiguration();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,61 +0,0 @@
|
||||||
/* This file is part of the KDE project
|
|
||||||
Copyright (C) 2000 Dawit Alemayehu <adawit@kde.org
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License (LGPL) as published by the Free Software Foundation;
|
|
||||||
either version 2 of the License, or (at your option) any
|
|
||||||
later version.
|
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Library General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; see the file COPYING.LIB. If not,
|
|
||||||
write to the Free Software Foundation, Inc., 51 Franklin Street,
|
|
||||||
Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef KIO_SESSIONDATA_H
|
|
||||||
#define KIO_SESSIONDATA_H
|
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
|
||||||
#include <kio/global.h>
|
|
||||||
|
|
||||||
|
|
||||||
namespace KIO {
|
|
||||||
|
|
||||||
// KDE5 TODO: remove the KIO_EXPORT and rename to _p.h, this is really internal only
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
class KIO_EXPORT SessionData : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
SessionData();
|
|
||||||
~SessionData();
|
|
||||||
|
|
||||||
virtual void configDataFor( KIO::MetaData &configData, const QString &proto,
|
|
||||||
const QString &host );
|
|
||||||
virtual void reset();
|
|
||||||
|
|
||||||
// struct AuthData;
|
|
||||||
|
|
||||||
private:
|
|
||||||
class AuthDataList;
|
|
||||||
friend class AuthDataList;
|
|
||||||
// AuthDataList* authData;
|
|
||||||
|
|
||||||
private:
|
|
||||||
class SessionDataPrivate;
|
|
||||||
SessionDataPrivate* const d;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -13,8 +13,6 @@ install(TARGETS kio_http DESTINATION ${KDE4_PLUGIN_INSTALL_DIR})
|
||||||
########### install files ###############
|
########### install files ###############
|
||||||
|
|
||||||
install(
|
install(
|
||||||
FILES
|
FILES http.protocol https.protocol
|
||||||
http.protocol https.protocol
|
|
||||||
webdav.protocol webdavs.protocol
|
|
||||||
DESTINATION ${KDE4_SERVICES_INSTALL_DIR}
|
DESTINATION ${KDE4_SERVICES_INSTALL_DIR}
|
||||||
)
|
)
|
||||||
|
|
|
@ -77,7 +77,7 @@ void HttpProtocol::setHost( const QString& host, quint16 port, const QString& us
|
||||||
|
|
||||||
void HttpProtocol::stat( const KUrl &url )
|
void HttpProtocol::stat( const KUrl &url )
|
||||||
{
|
{
|
||||||
kDebug(7103);
|
kDebug(7103) << url.prettyUrl();
|
||||||
error(KIO::ERR_UNSUPPORTED_ACTION, url.prettyUrl());
|
error(KIO::ERR_UNSUPPORTED_ACTION, url.prettyUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,6 +109,6 @@ void HttpProtocol::put( const KUrl& url, int permissions, KIO::JobFlags flags )
|
||||||
Q_UNUSED(permissions);
|
Q_UNUSED(permissions);
|
||||||
Q_UNUSED(flags);
|
Q_UNUSED(flags);
|
||||||
|
|
||||||
kDebug(7103);
|
kDebug(7103) << url.prettyUrl();
|
||||||
error(KIO::ERR_UNSUPPORTED_ACTION, url.prettyUrl());
|
error(KIO::ERR_UNSUPPORTED_ACTION, url.prettyUrl());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
[Protocol]
|
|
||||||
exec=kio_http
|
|
||||||
protocol=webdav
|
|
||||||
input=none
|
|
||||||
output=filesystem
|
|
||||||
copyToFile=false
|
|
||||||
copyFromFile=false
|
|
||||||
listing=Name,Type,Size,Date,AccessDate,Access
|
|
||||||
reading=true
|
|
||||||
writing=true
|
|
||||||
makedir=false
|
|
||||||
deleting=false
|
|
||||||
moving=false
|
|
||||||
ProxiedBy=http
|
|
||||||
Icon=folder-remote
|
|
||||||
maxInstances=20
|
|
||||||
maxInstancesPerHost=5
|
|
||||||
defaultMimetype=application/octet-stream
|
|
||||||
determineMimetypeFromExtension=false
|
|
||||||
X-DocPath=kioslave/webdav/index.html
|
|
||||||
Class=:internet
|
|
|
@ -1,21 +0,0 @@
|
||||||
[Protocol]
|
|
||||||
exec=kio_http
|
|
||||||
protocol=webdavs
|
|
||||||
input=none
|
|
||||||
output=filesystem
|
|
||||||
copyToFile=false
|
|
||||||
copyFromFile=false
|
|
||||||
listing=Name,Type,Size,Date,AccessDate,Access
|
|
||||||
reading=true
|
|
||||||
writing=true
|
|
||||||
makedir=false
|
|
||||||
deleting=false
|
|
||||||
moving=false
|
|
||||||
ProxiedBy=http
|
|
||||||
Icon=folder-remote
|
|
||||||
maxInstances=20
|
|
||||||
maxInstancesPerHost=5
|
|
||||||
defaultMimetype=application/octet-stream
|
|
||||||
determineMimetypeFromExtension=false
|
|
||||||
X-DocPath=kioslave/webdav/index.html
|
|
||||||
Class=:internet
|
|
|
@ -141,11 +141,11 @@ void BrowserRun::scanFile()
|
||||||
if ( d->m_part ) {
|
if ( d->m_part ) {
|
||||||
const QString proto = d->m_part->url().protocol();
|
const QString proto = d->m_part->url().protocol();
|
||||||
|
|
||||||
if (proto == "https" || proto == "webdavs") {
|
if (proto == "https") {
|
||||||
metaData.insert("main_frame_request", "TRUE" );
|
metaData.insert("main_frame_request", "TRUE" );
|
||||||
metaData.insert("ssl_was_in_use", "TRUE" );
|
metaData.insert("ssl_was_in_use", "TRUE" );
|
||||||
// metaData.insert("ssl_activate_warnings", "TRUE" );
|
// metaData.insert("ssl_activate_warnings", "TRUE" );
|
||||||
} else if (proto == "http" || proto == "webdav") {
|
} else if (proto == "http") {
|
||||||
// metaData.insert("ssl_activate_warnings", "TRUE" );
|
// metaData.insert("ssl_activate_warnings", "TRUE" );
|
||||||
metaData.insert("ssl_was_in_use", "FALSE" );
|
metaData.insert("ssl_was_in_use", "FALSE" );
|
||||||
}
|
}
|
||||||
|
|
|
@ -457,8 +457,6 @@
|
||||||
<entry key="mtp" type="Bool" />
|
<entry key="mtp" type="Bool" />
|
||||||
<entry key="system" type="Bool" />
|
<entry key="system" type="Bool" />
|
||||||
<entry key="tar" type="Bool" />
|
<entry key="tar" type="Bool" />
|
||||||
<entry key="webdav" type="Bool" />
|
|
||||||
<entry key="webdavs" type="Bool" />
|
|
||||||
<entry key="zip" type="Bool" />
|
<entry key="zip" type="Bool" />
|
||||||
</group>
|
</group>
|
||||||
<group name="Toolbar style" >
|
<group name="Toolbar style" >
|
||||||
|
|
Loading…
Add table
Reference in a new issue