diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index bccc1309..f3483fec 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -66,18 +66,6 @@ check_function_exists(sendfile HAVE_SENDFILE) # ki check_symbol_exists(ttyname_r "unistd.h" HAVE_TTYNAME_R) # kinit, kpty -# Check for libresolv -# e.g. on slackware 9.1 res_init() is only a define for __res_init, so we check both, Alex -set(HAVE_RESOLV_LIBRARY FALSE) # kdecore, kdecore/network, kpac -check_library_exists(resolv res_init "" HAVE_RES_INIT_IN_RESOLV_LIBRARY) -check_library_exists(resolv __res_init "" HAVE___RES_INIT_IN_RESOLV_LIBRARY) -if (HAVE___RES_INIT_IN_RESOLV_LIBRARY OR HAVE_RES_INIT_IN_RESOLV_LIBRARY) - set(HAVE_RESOLV_LIBRARY TRUE) -endif (HAVE___RES_INIT_IN_RESOLV_LIBRARY OR HAVE_RES_INIT_IN_RESOLV_LIBRARY) - -check_library_exists(nsl gethostbyname "" HAVE_NSL_LIBRARY) -check_library_exists(socket connect "" HAVE_SOCKET_LIBRARY) - if (UNIX) # for kpty check_include_files("sys/types.h;libutil.h" HAVE_LIBUTIL_H) diff --git a/kio/kio/kprotocolmanager.cpp b/kio/kio/kprotocolmanager.cpp index cf0c3ef5..6048c9a1 100644 --- a/kio/kio/kprotocolmanager.cpp +++ b/kio/kio/kprotocolmanager.cpp @@ -375,22 +375,6 @@ QStringList KProtocolManager::proxiesForUrl( const KUrl &url ) if (!d->shouldIgnoreProxyFor(url)) { switch (proxyType()) { - case PACProxy: - case WPADProxy: - { - KUrl u (url); - const QString protocol = u.protocol().toLower(); - u.setProtocol(protocol); - - if (protocol.startsWith(QL1S("http")) || protocol.startsWith(QL1S("ftp"))) { - QDBusReply reply = QDBusInterface(QL1S("org.kde.kded"), - QL1S("/modules/proxyscout"), - QL1S("org.kde.KPAC.ProxyScout")) - .call(QL1S("proxiesForUrl"), u.url()); - proxyList = reply; - } - break; - } case EnvVarProxy: proxyList = getSystemProxyFor( url ); break; @@ -407,8 +391,8 @@ QStringList KProtocolManager::proxiesForUrl( const KUrl &url ) proxy = QL1S("socks://") + (index == -1 ? proxy : proxy.mid(index+3)); proxyList << proxy; } + break; } - break; case NoProxy: default: break; diff --git a/kio/kio/kprotocolmanager.h b/kio/kio/kprotocolmanager.h index 2b4a65fc..748e1fdb 100644 --- a/kio/kio/kprotocolmanager.h +++ b/kio/kio/kprotocolmanager.h @@ -158,16 +158,12 @@ public: * Types of proxy configuration * @li NoProxy - No proxy is used * @li ManualProxy - Proxies are manually configured - * @li PACProxy - A Proxy configuration URL has been given - * @li WPADProxy - A proxy should be automatically discovered * @li EnvVarProxy - Use the proxy values set through environment variables. */ enum ProxyType { NoProxy, ManualProxy, - PACProxy, - WPADProxy, EnvVarProxy }; diff --git a/kio/misc/CMakeLists.txt b/kio/misc/CMakeLists.txt index cecb1b60..4c794fd7 100644 --- a/kio/misc/CMakeLists.txt +++ b/kio/misc/CMakeLists.txt @@ -2,9 +2,6 @@ # for strange kio/foo.h includes include_directories(BEFORE ${CMAKE_SOURCE_DIR}/kio) -# arpa/nameser.h -add_subdirectory(kpac) - ########### next target ############### add_executable(kmailservice kmailservice.cpp) diff --git a/kio/misc/kpac/CMakeLists.txt b/kio/misc/kpac/CMakeLists.txt deleted file mode 100644 index b75bdb3a..00000000 --- a/kio/misc/kpac/CMakeLists.txt +++ /dev/null @@ -1,80 +0,0 @@ - -if(KDE_PLATFORM_FEATURE_BINARY_COMPATIBLE_FEATURE_REDUCTION) - set(KPAC_NO_SOLID TRUE) -endif() - -include_directories(${CMAKE_SOURCE_DIR}/kded) - -if(NOT KPAC_NO_SOLID) - include_directories(${CMAKE_BINARY_DIR}/solid) - include_directories(${CMAKE_SOURCE_DIR}/solid) - set(KPAC_EXTRA_LIBS ${KDE4_SOLID_LIBS}) -endif() - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}") - -include(ConfigureChecks.cmake) -configure_file( - config-kpac.h.cmake - ${CMAKE_CURRENT_BINARY_DIR}/config-kpac.h -) - -########### next target ############### - -set(kded_proxyscout_PART_SRCS - proxyscout.cpp - script.cpp - downloader.cpp - discovery.cpp -) - -kde4_add_plugin(kded_proxyscout ${kded_proxyscout_PART_SRCS}) - -target_link_libraries(kded_proxyscout - ${QT_QTSCRIPT_LIBRARY} - ${KPAC_EXTRA_LIBS} - ${KDE4_KDECORE_LIBS} - ${KDE4_KIO_LIBS} -) - -# this needs -lresolv e.g on Slackware, but not on FreeBSD -if(HAVE_RESOLV_LIBRARY) - target_link_libraries(kded_proxyscout resolv) -endif() - -install( - TARGETS kded_proxyscout - DESTINATION ${KDE4_PLUGIN_INSTALL_DIR} -) - -########### next target ############### - -add_executable(kpac_dhcp_helper kpac_dhcp_helper.c) - -if(HAVE_NSL_LIBRARY) - # Assume Solaris - target_link_libraries(kpac_dhcp_helper nsl) -endif() - -if (HAVE_SOCKET_LIBRARY) - target_link_libraries(kpac_dhcp_helper socket) -endif() - -install( - TARGETS kpac_dhcp_helper - DESTINATION ${KDE4_LIBEXEC_INSTALL_DIR} -) - -########### install files ############### - -install( - FILES - proxyscout.notifyrc - DESTINATION ${KDE4_DATA_INSTALL_DIR}/proxyscout -) -install( - FILES - proxyscout.desktop - DESTINATION ${KDE4_SERVICES_INSTALL_DIR}/kded -) - diff --git a/kio/misc/kpac/ConfigureChecks.cmake b/kio/misc/kpac/ConfigureChecks.cmake deleted file mode 100644 index 47994b45..00000000 --- a/kio/misc/kpac/ConfigureChecks.cmake +++ /dev/null @@ -1,4 +0,0 @@ -include(CheckIncludeFiles) -check_include_files(arpa/nameser_compat.h HAVE_ARPA_NAMESER_COMPAT_H) -check_include_files(arpa/nameser8_compat.h HAVE_ARPA_NAMESER8_COMPAT_H) -check_include_files("sys/types.h;netinet/in.h" HAVE_NETINET_IN_H) diff --git a/kio/misc/kpac/README b/kio/misc/kpac/README deleted file mode 100644 index d211ae07..00000000 --- a/kio/misc/kpac/README +++ /dev/null @@ -1,9 +0,0 @@ -Proxy Auto Configuration is a means to use a JavaScript function to -determine the proxy to use based on the requested URL. -It is described in detail here: -http://home.netscape.com/eng/mozilla/2.0/relnotes/demo/proxy-live.html - -Also implemented by this library are parts of the now expired Internet Draft -at http://www.wrec.org/Drafts/draft-cooper-webi-wpad-00.txt about WPAD -(Web Proxy Automatic Discovery). The discovery implemented discovery methods -are DHCP and DNS "Well known Aliases". diff --git a/kio/misc/kpac/README.wpad b/kio/misc/kpac/README.wpad deleted file mode 100644 index f63d2576..00000000 --- a/kio/misc/kpac/README.wpad +++ /dev/null @@ -1,73 +0,0 @@ -Web Proxy Auto Discovery (WPAD) -=============================== - -This README is intended for network administrators who want to enable the -users on their network to fully automatically find the proxy settings. - -Automatic proxy discovery works in two steps: -1) Find a configuration script -2) Determine a proxy to use by running that script - -The configuration script is a "PAC" (JavaScript) file just as in plain Proxy -Auto Configuration as described here: -http://home.netscape.com/eng/mozilla/2.0/relnotes/demo/proxy-live.html - -The WPAD part of the process (#1 above) described here is about how to find -this script without having the users enter its URL into the proxy settings. -(All they have to do in a WPAD-enabled network is to select "Automatically -detected script file" in KDE's proxy setup. - -There are two alternative ways to discover the PAC script's URL implemented -in KDE: - -1. DHCP based autodiscovery - - If you are running a DHCP server on your network anyway, you might - want to use this approach; all you have to do is to add the WPAD - option (numeric 252 or hex fc) as a string containing the URL to the - PAC script. - - To do so with older versions of ISC dhcpd, add this to - /etc/dhcpd.conf, either globally or just for the subnets you want to - enable WPAD for: - - option option-252 "http://example.com/path/to/proxyconfig.pac"; - - Or, for newer ISC dhcpd versions, add this globally: - - option wpad code 252 = text; - - and this either globally or for the WPAD subnets: - - option wpad "http://example.com/path/to/proxyconfig.pac"; - - For other DHCP servers, please consult the reference manual on how - to add an option by number if WPAD support is not built-in. - -2. DNS based autodiscovery - - If you don't run a DHCP server or prefer DNS based discovery, you - need to configure one of your hosts to have the name - wpad.example.com and make sure the PAC script is available as - http://wpad.example.com/wpad.dat If your network consists of several - subdomains, like a.example.com and b.example.com you can either - provide both http://a.example.com/wpad.dat and - http://b.example.com/wpad.dat or just http://example.com/wpad.dat - When a client searches for that script, it will search for a host - named "wpad" in its own domain, then in the next higher level domain - until success or if only the TLD is left (i.e. wpad.com will never - be tried) - -Note that DHCP is the preferred approach since it's more flexible than DNS -as it doesn't require a well known host name nor a fixed location -(/wpad.dat) for the PAC script. It is also the first method tried before -resorting to DNS, so if you use DNS there will be a noticeable delay of 5 -seconds while waiting for a DHCP reply. - -However, DHCP requires a helper program, kpac_dhcp_helper to be installed -suid root. If you consider this a security problem, just delete that program -or remove its suid permissions and use DNS instead. If the helper cannot -execute as root, the 5 seconds delay will also go away. - -If you have further questions or comments, please contact me: Malte -Starostik diff --git a/kio/misc/kpac/TODO b/kio/misc/kpac/TODO deleted file mode 100644 index ce5cd6a1..00000000 --- a/kio/misc/kpac/TODO +++ /dev/null @@ -1 +0,0 @@ -* Make use of badProxy() in KProtocolManager to enable fallbacks diff --git a/kio/misc/kpac/config-kpac.h.cmake b/kio/misc/kpac/config-kpac.h.cmake deleted file mode 100644 index 5a536147..00000000 --- a/kio/misc/kpac/config-kpac.h.cmake +++ /dev/null @@ -1,4 +0,0 @@ -#cmakedefine KPAC_NO_SOLID -#cmakedefine HAVE_ARPA_NAMESER_COMPAT_H -#cmakedefine HAVE_ARPA_NAMESER8_COMPAT_H -#cmakedefine HAVE_NETINET_IN_H 1 diff --git a/kio/misc/kpac/dhcp.h b/kio/misc/kpac/dhcp.h deleted file mode 100644 index 41643ae3..00000000 --- a/kio/misc/kpac/dhcp.h +++ /dev/null @@ -1,78 +0,0 @@ -/* This file is part of the KDE Libraries - Copyright (c) 2001 Malte Starostik - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - 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 Library 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. - */ - - -/* See RFC 2131 for details */ - -#ifndef __dhcp_h__ -#define __dhcp_h__ - -#ifdef HAVE_STDINT_H -# include -#endif - -#define DHCP_OPT_LEN 312 - -struct dhcp_msg -{ -#define DHCP_BOOTREQUEST 1 -#define DHCP_BOOTREPLY 2 - uint8_t op; /* operation */ - uint8_t htype; /* hwaddr type */ - uint8_t hlen; /* hwaddr len */ - uint8_t hops; - uint32_t xid; /* transaction id */ - uint16_t secs; /* seconds since protocol start */ -#define DHCP_BROADCAST 1 - uint16_t flags; - uint32_t ciaddr; /* client IP */ - uint32_t yiaddr; /* "your" IP */ - uint32_t siaddr; /* server IP */ - uint32_t giaddr; /* gateway IP */ - uint8_t chaddr[16]; /* client hwaddr */ - uint8_t sname[64]; /* server name */ - uint8_t file[128]; /* bootstrap file */ - uint8_t options[DHCP_OPT_LEN]; -}; - -/* first four bytes in options */ -#define DHCP_MAGIC1 0x63 -#define DHCP_MAGIC2 0x82 -#define DHCP_MAGIC3 0x53 -#define DHCP_MAGIC4 0x63 - -/* DHCP message types */ -#define DHCP_DISCOVER 1 -#define DHCP_OFFER 2 -#define DHCP_REQUEST 3 -#define DHCP_DECLINE 4 -#define DHCP_ACK 5 -#define DHCP_NAK 6 -#define DHCP_RELEASE 7 -#define DHCP_INFORM 8 - -/* option types */ -#define DHCP_OPT_MSGTYPE 0x35 -#define DHCP_OPT_PARAMREQ 0x37 -#define DHCP_OPT_WPAD 0xfc -#define DHCP_OPT_END 0xff - -#endif - -/* vim: ts=4 sw=4 noet - */ diff --git a/kio/misc/kpac/discovery.cpp b/kio/misc/kpac/discovery.cpp deleted file mode 100644 index 40191083..00000000 --- a/kio/misc/kpac/discovery.cpp +++ /dev/null @@ -1,148 +0,0 @@ -/* - Copyright (c) 2003 Malte Starostik - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License 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 Library 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 -#include -#include -#include - -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#include -#ifdef HAVE_ARPA_NAMESER8_COMPAT_H -#include -#else -#ifdef HAVE_ARPA_NAMESER_COMPAT_H -#include -#endif -#endif -#ifdef HAVE_SYS_PARAM_H -// Basically, the BSDs need this before resolv.h -#include -#endif - -#include -#include - -#include -#include -#include - -#include -#include -#include -#include "moc_discovery.cpp" - -namespace KPAC -{ - Discovery::Discovery( QObject* parent ) - : Downloader( parent ), - m_helper( new QProcess(this) ) - { - m_helper->setProcessChannelMode(QProcess::SeparateChannels); - connect( m_helper, SIGNAL(readyReadStandardOutput()), SLOT(helperOutput()) ); - connect( m_helper, SIGNAL(finished(int,QProcess::ExitStatus)), SLOT(failed()) ); - m_helper->start(KStandardDirs::findExe("kpac_dhcp_helper")); - if ( !m_helper->waitForStarted() ) - QTimer::singleShot( 0, this, SLOT(failed()) ); - } - - bool Discovery::initDomainName() - { - m_domainName = QHostInfo::localDomainName(); - return !m_domainName.isEmpty(); - } - - bool Discovery::checkDomain() const - { - // If a domain has a SOA record, don't traverse any higher. - // Returns true if no SOA can be found (domain is "ok" to use) - // Stick to old resolver interface for portability reasons. - union - { - HEADER header; - unsigned char buf[ PACKETSZ ]; - } response; - - int len = res_query( m_domainName.toLocal8Bit(), C_IN, T_SOA, - response.buf, sizeof( response.buf ) ); - if ( len <= int( sizeof( response.header ) ) || - ntohs( response.header.ancount ) != 1 ) - return true; - - unsigned char* pos = response.buf + sizeof( response.header ); - unsigned char* end = response.buf + len; - - // skip query section - pos += dn_skipname( pos, end ) + QFIXEDSZ; - if ( pos >= end ) - return true; - - // skip answer domain - pos += dn_skipname( pos, end ); - short type; - GETSHORT( type, pos ); - return type != T_SOA; - } - - void Discovery::failed() - { - setError( i18n( "Could not find a usable proxy configuration script" ) ); - - // If this is the first DNS query, initialize our host name or abort - // on failure. Otherwise abort if the current domain (which was already - // queried for a host called "wpad" contains a SOA record) - const bool firstQuery = m_domainName.isEmpty(); - if ( ( firstQuery && !initDomainName() ) || - ( !firstQuery && !checkDomain() ) ) - { - emit result( false ); - return; - } - - const int dot = m_domainName.indexOf( '.' ); - if ( dot > -1 || firstQuery ) - { - QString address (QLatin1String("http://wpad.")); - address += m_domainName; - address += QLatin1String ("/wpad.dat"); - if ( dot > -1 ) - m_domainName.remove (0, dot + 1); // remove one domain level - download( KUrl(address) ); - return; - } - - emit result( false ); - } - - void Discovery::helperOutput() - { - m_helper->disconnect( this ); - const QByteArray line = m_helper->readLine(); - const KUrl url( QString::fromLocal8Bit(line.constData(), line.length()).trimmed() ); - download( url ); - } -} - -// vim: ts=4 sw=4 et diff --git a/kio/misc/kpac/discovery.h b/kio/misc/kpac/discovery.h deleted file mode 100644 index 33f6b67d..00000000 --- a/kio/misc/kpac/discovery.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - Copyright (c) 2003 Malte Starostik - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License 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 Library 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 KPAC_DISCOVERY_H -#define KPAC_DISCOVERY_H - -#include "downloader.h" - -#include - -namespace KPAC -{ - class Discovery : public Downloader - { - Q_OBJECT - public: - Discovery( QObject* ); - - protected Q_SLOTS: - virtual void failed(); - - private Q_SLOTS: - void helperOutput(); - - private: - bool initDomainName(); - bool checkDomain() const; - - QProcess* m_helper; - QString m_domainName; - }; -} - -#endif // KPAC_DISCOVERY_H - -// vim: ts=4 sw=4 et diff --git a/kio/misc/kpac/downloader.cpp b/kio/misc/kpac/downloader.cpp deleted file mode 100644 index c26df080..00000000 --- a/kio/misc/kpac/downloader.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - Copyright (c) 2003 Malte Starostik - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License 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 Library 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 "downloader.h" - -#include -#include - -#include - -#include -#include -#include -#include - -namespace KPAC -{ - Downloader::Downloader( QObject* parent ) - : QObject( parent ) - { - } - - void Downloader::download( const KUrl& url ) - { - m_data.resize( 0 ); - m_script.clear(); - m_scriptURL = url; - - KIO::TransferJob* job = KIO::get( url, KIO::NoReload, KIO::HideProgressInfo ); - connect( job, SIGNAL(data(KIO::Job*,QByteArray)), - SLOT(data(KIO::Job*,QByteArray)) ); - connect( job, SIGNAL (redirection(KIO::Job*,KUrl)), - SLOT(redirection(KIO::Job*,KUrl)) ); - connect( job, SIGNAL(result(KJob*)), SLOT(result(KJob*)) ); - } - - void Downloader::failed() - { - emit result( false ); - } - - void Downloader::setError( const QString& error ) - { - m_error = error; - } - - void Downloader::redirection( KIO::Job* , const KUrl& url ) - { - m_scriptURL = url; - } - - void Downloader::data( KIO::Job*, const QByteArray& data ) - { - unsigned offset = m_data.size(); - m_data.resize( offset + data.size() ); - std::memcpy( m_data.data() + offset, data.data(), data.size() ); - } - - static bool hasErrorPage(KJob* job) - { - KIO::TransferJob* tJob = qobject_cast(job); - return (tJob && tJob->isErrorPage()); - } - - void Downloader::result( KJob* job ) - { - if ( !job->error() && !hasErrorPage(job) ) - { - bool dummy; - m_script = KGlobal::charsets()->codecForName( - static_cast( job )->queryMetaData( "charset" ), dummy )->toUnicode( m_data ); - emit result( true ); - } - else - { - if ( job->error() ) - setError( i18n( "Could not download the proxy configuration script:\n%1" , - job->errorString() ) ); - else setError( i18n( "Could not download the proxy configuration script" ) ); // error page - failed(); - } - } -} - -// vim: ts=4 sw=4 et -#include "moc_downloader.cpp" - diff --git a/kio/misc/kpac/downloader.h b/kio/misc/kpac/downloader.h deleted file mode 100644 index e5a8d998..00000000 --- a/kio/misc/kpac/downloader.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - Copyright (c) 2003 Malte Starostik - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License 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 Library 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 KPAC_DOWNLOADER_H -#define KPAC_DOWNLOADER_H - -#include - -#include - -class KJob; -namespace KIO { class Job; } - -namespace KPAC -{ - class Downloader : public QObject - { - Q_OBJECT - public: - Downloader( QObject* ); - - void download( const KUrl& ); - const KUrl& scriptUrl() { return m_scriptURL; } - const QString& script() { return m_script; } - const QString& error() { return m_error; } - - Q_SIGNALS: - void result( bool ); - - protected: - virtual void failed(); - void setError( const QString& ); - - private Q_SLOTS: - void redirection( KIO::Job*, const KUrl& ); - void data( KIO::Job*, const QByteArray& ); - void result( KJob* ); - - private: - QByteArray m_data; - KUrl m_scriptURL; - QString m_script; - QString m_error; - }; -} - -#endif // KPAC_DOWNLOADER_H - -// vim: ts=4 sw=4 et diff --git a/kio/misc/kpac/kpac_dhcp_helper.c b/kio/misc/kpac/kpac_dhcp_helper.c deleted file mode 100644 index c5c38ebb..00000000 --- a/kio/misc/kpac/kpac_dhcp_helper.c +++ /dev/null @@ -1,286 +0,0 @@ -/* This file is part of the KDE Libraries - Copyright (c) 2001 Malte Starostik - Copyright (c) 2011 Dawit Alemayehu - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - 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 Library 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 - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "dhcp.h" - - -#ifndef INADDR_NONE /* some OSes don't define this */ -#define INADDR_NONE -1 -#endif - -static int set_gid(gid_t); -static int set_uid(uid_t); -static int get_port(const char *); -static int init_socket(void); -static uint32_t send_request(int); -static void get_reply(int, uint32_t); - -static int set_gid(gid_t gid) -{ -#if 0 /* was: HAVE_SHORTSETGROUPS */ - short x[2]; - x[0] = gid; - x[1] = 73; /* catch errors */ - if (setgroups(1, x) == -1) - return -1; -#else - if (setgroups(1, &gid) == -1) - return -1; -#endif - return setgid(gid); /* _should_ be redundant, but on some systems it isn't */ -} - -static int set_uid(uid_t uid) -{ - return setuid(uid); -} - -/* All functions below do an exit(1) on the slightest error */ - -/* Returns the UDP port number for the given service name */ -static int get_port(const char *service) -{ - struct servent *serv = getservbyname(service, "udp"); - if (serv == NULL) - exit(1); - - return serv->s_port; -} - -/* Opens the UDP socket, binds to the bootpc port and drops root privileges */ -static int init_socket() -{ - struct sockaddr_in addr; - struct protoent *proto; - int sock; - int bcast = 1; - - memset(&addr, 0, sizeof(addr)); - addr.sin_family = AF_INET; - addr.sin_addr.s_addr = INADDR_ANY; - addr.sin_port = get_port("bootpc"); - - if ((proto = getprotobyname("udp")) == NULL || - (sock = socket(AF_INET, SOCK_DGRAM, proto->p_proto)) == -1) - exit(1); - - if (setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &bcast, sizeof(bcast)) == -1 || - setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &bcast, sizeof(bcast)) == -1 || - bind(sock, (struct sockaddr *)&addr, sizeof(addr)) == -1) - exit(1); - - if (set_gid(getgid()) != 0 || /* we don't need it anymore */ - set_uid(getuid()) != 0) - exit(1); - return sock; -} - -struct response -{ - uint32_t result; - uint16_t err; -}; - -static struct response send_request_for(int sock, const char* hostname) -{ - struct sockaddr_in addr; - struct in_addr inaddr; - struct dhcp_msg request; - uint8_t *offs = request.options; - struct response r; - - if (!inet_aton(hostname, &inaddr)) { - r.err = -1; - r.result = 0; - } - - memset(&addr, 0, sizeof(addr)); - addr.sin_family = AF_INET; - addr.sin_addr.s_addr = INADDR_NONE; - addr.sin_port = get_port("bootps"); - - memset(&request, 0, sizeof(request)); - request.op = DHCP_BOOTREQUEST; - srand(time(NULL)); - request.xid = rand(); - request.ciaddr = (uint32_t)inaddr.s_addr; - - *offs++ = DHCP_MAGIC1; - *offs++ = DHCP_MAGIC2; - *offs++ = DHCP_MAGIC3; - *offs++ = DHCP_MAGIC4; - - *offs++ = DHCP_OPT_MSGTYPE; - *offs++ = 1; /* length */ - *offs++ = DHCP_INFORM; - - *offs++ = DHCP_OPT_PARAMREQ; - *offs++ = 1; /* length */ - *offs++ = DHCP_OPT_WPAD; - - *offs++ = DHCP_OPT_END; - - if (sendto(sock, &request, sizeof(request), 0, - (struct sockaddr *)&addr, sizeof(addr)) != sizeof(request)) { - r.err = -1; - r.result = 0; - } - - r.err = 0; - r.result = request.xid; - return r; -} - -/* Fills the DHCPINFORM request packet, returns the transaction id */ -static uint32_t send_request(int sock) -{ - char hostname[NI_MAXHOST]; - struct ifaddrs *ifaddr, *ifa; - int status = -1; - - if (getifaddrs(&ifaddr) == -1) { - exit(1); - } - - for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) { - if (ifa->ifa_addr == NULL) - continue; - - if (ifa->ifa_flags & IFF_LOOPBACK) - continue; - - if (ifa->ifa_addr->sa_family != AF_INET) - continue; - - status = getnameinfo(ifa->ifa_addr, sizeof(struct sockaddr_in), - hostname, NI_MAXHOST, NULL, 0, NI_NUMERICHOST); - - if (status != 0) - continue; - - struct response r = send_request_for(sock, hostname); - - if (r.err != 0) - continue; - - status = r.result; - } - - freeifaddrs(ifaddr); - - if (status == -1) - exit(1); - - return status; -} - -/* Reads the reply from the socket, checks it and outputs the URL to STDOUT */ -static void get_reply(int sock, uint32_t xid) -{ - struct dhcp_msg reply; - int len; - char wpad[DHCP_OPT_LEN + 1]; - uint8_t wpad_len; - uint8_t *offs = reply.options; - uint8_t *end; - - if ((len = recvfrom(sock, &reply, sizeof(reply), 0, NULL, NULL)) <= 0) - exit(1); - - end = (uint8_t *)&reply + len; - if (end < offs + 4 || - end > &reply.options[DHCP_OPT_LEN] || - reply.op != DHCP_BOOTREPLY || - reply.xid != xid || - *offs++ != DHCP_MAGIC1 || - *offs++ != DHCP_MAGIC2 || - *offs++ != DHCP_MAGIC3 || - *offs++ != DHCP_MAGIC4) - exit(1); - - for ( ; offs < end - 1; offs += *offs+1) - { - switch (*offs++) - { - case DHCP_OPT_END: - exit(1); - case DHCP_OPT_MSGTYPE: - if (*offs != 1 || (offs >= end - 1) || *(offs + 1) != DHCP_ACK) - exit(1); - break; - case DHCP_OPT_WPAD: - memset(wpad, 0, sizeof(wpad)); - wpad_len = *offs++; - if (offs >= end) - exit(1); - if (wpad_len > end - offs) - wpad_len = end - offs; - strncpy(wpad, (char *)offs, wpad_len); - wpad[wpad_len] = 0; - printf("%s\n", wpad); - close(sock); - exit(0); - } - } - exit(1); -} - -int main() -{ - fd_set rfds; - struct timeval tv; - int sock; - uint32_t xid; - - sock = init_socket(); - xid = send_request(sock); - - FD_ZERO(&rfds); - FD_SET(sock, &rfds); - tv.tv_sec = 5; - tv.tv_usec = 0; - if (select(sock + 1, &rfds, NULL, NULL, &tv) == 1 && FD_ISSET(sock, &rfds)) { - get_reply(sock, xid); - } - - close(sock); - exit(1); -} - -/* vim: ts=4 sw=4 noet - */ diff --git a/kio/misc/kpac/kpactest.pac b/kio/misc/kpac/kpactest.pac deleted file mode 100644 index 2858e16f..00000000 --- a/kio/misc/kpac/kpactest.pac +++ /dev/null @@ -1,177 +0,0 @@ -/* - A script to test the PAC specification. - - To use this script, select "Use automatic proxy configuration URL:" in the - KDE proxy configuration dialog and run: - - qdbus org.kde.kded /modules/proxyscout proxyForUrl http://blah (URL doesn't matter) - - If everything succeeds, the output you get will be http:///. If not, - you would get http:/// where contains the - tests that "failed". You can lookup the failed test name in the comments below - and file a report in the KDE bug tracking system if you feel the problem is in - the implementation. -*/ - -function FindProxyForURL( url, host ) -{ - var result = "PROXY http://" + myIpAddress(); - - // plainhost1 - if ( !isPlainHostName( "foo" ) ) - result += "/plainhost1=failed"; - // plainhost2 - if ( isPlainHostName( "foo.bar" ) ) - result += "/plainhost2=failed"; - - // dnsdomain1 - if ( !dnsDomainIs( "foo.bar", "bar" ) ) - result += "/dnsdomain1=failed"; - // dnsdomain2 - if ( dnsDomainIs( "foo.baz", "bar" ) ) - result += "/dnsdomain2=failed"; - - // localordomain1 - if ( !localHostOrDomainIs( "foo", "bar" ) ) - result += "/localordomain1=failed"; - // localordomain2 - if ( !localHostOrDomainIs( "foo.bar", "foo.bar" ) ) - result += "/localordomain2=failed"; - // localordomain3 - if ( !localHostOrDomainIs( "foo", "foo.baz" ) ) - result += "/localordomain3=failed"; - // localordomain4 - if ( localHostOrDomainIs( "foo.bar", "foo.baz" ) ) - result += "/localordomain4=failed"; - - // isresolvable1 - // on failure make sure you can resolve www.kde.org correctly :-) - if ( !isResolvable( "www.kde.org" ) ) result += "/isresolvable1=failed"; - // isresolvable2 - // on failure make sure dummy.invalid doesn't resolve :-) - if ( isResolvable( "dummy.invalid" ) ) result += "/isresolvable2=failed"; - - // isinnet1 - // on failure check if localhost resolves to 127.0.0.1 as it should - if ( isInNet( "localhost", "1.2.3.4", "255.0.0.0" ) ) - result += "/isinnet1=failed"; - // isinnet2 - if ( isInNet( "1.2.3.4", "1.2.3.5", "255.255.255.255" ) ) - result += "/isinnet2=failed"; - // isinnet3 - if ( !isInNet( "1.2.3.4", "1.2.3.5", "255.255.255.0" ) ) - result += "/isinnet3=failed"; - - // dnsresolve1 - // on failure check if localhost resolves to 127.0.0.1 as it should - if ( dnsResolve( "localhost" ) != "127.0.0.1" ) - result += "/dnsresolve1=failed"; - - // dnslevels1 - if ( dnsDomainLevels( "foo" ) != 0 ) - result += "/dnslevels1=failed"; - // dnslevels2 - if ( dnsDomainLevels( "foo.bar" ) != 1 ) - result += "/dnslevels2=failed"; - // dnslevels3 - if ( dnsDomainLevels( "foo.bar.baz" ) != 2 ) - result += "/dnslevels3=failed"; - - // shexp1 - if ( !shExpMatch( "foobar", "foobar" ) ) - result += "/shexp1=failed"; - // shexp2 - if ( shExpMatch( "FoObAr", "foobar" ) ) - result += "/shexp2=failed"; - // shexp3 - if ( !shExpMatch( "Foobar", "?oobar" ) ) - result += "/shexp3=failed"; - // shexp4 - if ( !shExpMatch( "FoObAr", "*b*" ) ) - result += "/shexp4=failed"; - // shexp5 - if ( shExpMatch( "FoObAr", "*x*" ) ) - result += "/shexp5=failed"; - // shexp6 - if ( shExpMatch( "www.kde.org", "*.kde" ) ) - result += "/shexp6=failed"; - - var now = new Date; - var days = new Array( "sun", "mon", "tue", "wed", "thu", "fri", "sat" ); - var months = new Array( "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec" ); - - // weekday1 - if ( !weekdayRange( "sun", "sat" ) ) - result += "/weekday1=failed"; - // weekday2 - if ( !weekdayRange( "sat", "sun" ) ) - result += "/weekday2=failed"; - // weekday3 - if ( !weekdayRange( days[ now.getDay() ] ) ) - result += "/weekday3=failed"; - // weekday4 - if ( weekdayRange( now.getDay() ? "sun" : "mon" ) ) - result += "/weekday4=failed"; - - // date1 - if ( !dateRange( now.getDate() ) ) - result += "/date1=failed"; - // date2 - if ( !dateRange( now.getDate(), 31 ) ) - result += "/date2=failed"; - // date3 - if ( !dateRange( 1, now.getDate() ) ) - result += "/date3=failed"; - // date4 - if ( dateRange( now.getDay() > 5 ? 1 : 6, now.getDay() > 5 ? 3 : 8 ) ) - result += "/date4=failed"; - // date5 - if ( !dateRange( months[ now.getMonth() ] ) ) - result += "/date5=failed"; - // date6 - if ( !dateRange( months[ now.getMonth() ], "dec" ) ) - result += "/date6=failed"; - // date7 - if ( !dateRange( "dec", months[ now.getMonth() ] ) ) - result += "/date7=failed"; - // date8 - if ( !dateRange( now.getFullYear() ) ) - result += "/date8=failed"; - // date9 - if ( dateRange( now.getFullYear() - 1 ) ) - result += "/date9=failed"; - // date10 - // if this fails, check your clock first :-) - if ( dateRange( 1, "jan", 1990, 31, "dec", 2000 ) ) - result += "/date10=failed"; - // date11 - // if this fails, check your clock first :-) - if ( !dateRange( 1, "jan", 2000, 31, "dec", 3000 ) ) - result += "/date11=failed"; - - // time1 - if ( !timeRange( now.getHours() ) ) - result += "/time1=failed"; - // time2 - if ( !timeRange( now.getHours(), now.getMinutes(), 0, 0 ) ) - result += "/time2=failed"; - // time3 - if ( !timeRange( now.getHours(), now.getMinutes(), now.getSeconds(), 0, 0, 0 ) ) - result += "/time3=failed"; - // time4 - if ( timeRange( now.getHours() > 5 ? 1 : 6, now.getHours() > 5 ? 3 : 8 ) ) - result += "/time4=failed"; - // time5 - if ( now.getHours() == now.getUTCHours() ) - result += "/time5=skipped"; - else if ( timeRange( now.getUTCHours() ) ) - result += "/time5=failed"; - // time6 - if ( now.getHours() == now.getUTCHours() ) - result += "/time6=skipped"; - else if ( !timeRange( now.getUTCHours(), "GMT" ) ) - result += "/time6=failed"; - - return result; -} - diff --git a/kio/misc/kpac/kpactest2.pac b/kio/misc/kpac/kpactest2.pac deleted file mode 100644 index be82c639..00000000 --- a/kio/misc/kpac/kpactest2.pac +++ /dev/null @@ -1,64 +0,0 @@ -/* - A script to test Microsoft's IPv6 extension to the PAC specification. If - you want to test the original PAC specification, use 'kpactest.pac'. - - To use this script, select "Use automatic proxy configuration URL:" in the - KDE proxy configuration dialog and run: - - qdbus org.kde.kded /modules/proxyscout proxyForUrl http://blah (URL doesn't matter) - - If everything succeeds, the output you get will be http:///. If not, - you would get http:/// where contains the - tests that "failed". You can lookup the failed test name in the comments below - and file a report in the KDE bug tracking system if you feel the problem is in - the implementation. - - Please note that since myIpAddressEx returns a semi-colon delimited list of all the - valid ip address for your machine matches, including the IPv6 representations for - the same network interface, you should always see at least two http:/// - in the result. -*/ - -function FindProxyForURLEx( url, host ) -{ - var result = ""; - - // isResolvableEx1 - // on failure make sure you can resolve www.kde.org correctly :-) - if ( !isResolvableEx( "www.kde.org" ) ) - result += "/isResolvableEx1=failed"; - // isResolvableEx2 - // on failure make sure dummy.invalid doesn't resolve :-) - if ( isResolvableEx( "dummy.invalid" ) ) - result += "/isResolvableEx2=failed"; - - // isInNetEx1 - // on failure check if localhost resolves to 127.0.0.1 as it should - if ( isInNetEx( "localhost", "1.2.3.4/8" ) ) - result += "/isInNetEx1=failed"; - // isInNetEx2 - if ( isInNetEx( "1.2.3.4", "1.2.3.5/32" ) ) - result += "/isInNetEx2=failed"; - // isInNetEx3 - if ( !isInNetEx( "1.2.3.4", "1.2.3.5/24" ) ) - result += "/isInNetEx3=failed"; - - // dnsResolveEx1 - // on failure check if localhost resolves to 127.0.0.1 as it should - if ( dnsResolveEx( "localhost" ).indexOf("127.0.0.1") == -1 ) - result += "/dnsResolveEx1=failed"; - - // sortIpAddressList - var sorted = sortIpAddressList("2001:4898:28:3:201:2ff:feea:fc14;157.59.139.22;fe80::5efe:157.59.139.2"); - if ( sorted != "fe80::5efe:157.59.139.2;2001:4898:28:3:201:2ff:feea:fc14;157.59.139.22" ) - result += "/sortIpAddressList=failed"; - - var output = new Array(); - var items = myIpAddressEx().split(";"); - for (var i = 0; i < items.length; ++i) { - var entry = "PROXY http://" + items[i] + result; - output[i] = entry; - } - - return output.join(';'); -} diff --git a/kio/misc/kpac/proxyscout.cpp b/kio/misc/kpac/proxyscout.cpp deleted file mode 100644 index dc54fd8c..00000000 --- a/kio/misc/kpac/proxyscout.cpp +++ /dev/null @@ -1,363 +0,0 @@ -/* - Copyright (c) 2003 Malte Starostik - Copyright (c) 2011 Dawit Alemayehu - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License 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 Library 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 "proxyscout.h" - -#include "config-kpac.h" - -#include "discovery.h" -#include "script.h" - -#include -#include -#include -#include -#include -#include - -#ifndef KPAC_NO_SOLID -#include -#endif - -#include -#include - -#include -#include - -K_PLUGIN_FACTORY(ProxyScoutFactory, - registerPlugin(); - ) -K_EXPORT_PLUGIN(ProxyScoutFactory("KProxyScoutd")) - -namespace KPAC -{ - enum ProxyType { - Unknown = -1, - Proxy, - Socks, - Direct - }; - - static ProxyType proxyTypeFor(const QString& mode) - { - if (mode.compare(QLatin1String("PROXY"), Qt::CaseInsensitive) == 0) - return Proxy; - - if (mode.compare(QLatin1String("DIRECT"), Qt::CaseInsensitive) == 0) - return Direct; - - if (mode.compare(QLatin1String("SOCKS"), Qt::CaseInsensitive) == 0 || - mode.compare(QLatin1String("SOCKS5"), Qt::CaseInsensitive) == 0) - return Socks; - - return Unknown; - } - - ProxyScout::QueuedRequest::QueuedRequest( const QDBusMessage &reply, const KUrl& u, bool sendall ) - : transaction( reply ), url( u ), sendAll(sendall) - { - } - - ProxyScout::ProxyScout(QObject* parent, const QList&) - : KDEDModule(parent), - m_componentData("proxyscout"), - m_downloader( 0 ), - m_script( 0 ), - m_suspendTime( 0 ), - m_debugArea (KDebug::registerArea("proxyscout")), - m_watcher( 0 ) - { -#ifndef KPAC_NO_SOLID - connect (Solid::Networking::notifier(), SIGNAL(shouldDisconnect()), SLOT(disconnectNetwork())); -#endif - } - - ProxyScout::~ProxyScout() - { - delete m_script; - } - - QStringList ProxyScout::proxiesForUrl( const QString& checkUrl, QDBusMessage msg ) - { - KUrl url(checkUrl); - - if (m_suspendTime) { - if ( std::time( 0 ) - m_suspendTime < 300 ) { - return QStringList (QLatin1String("DIRECT")); - } - m_suspendTime = 0; - } - - // Never use a proxy for the script itself - if (m_downloader && url.equals(m_downloader->scriptUrl(), KUrl::CompareWithoutTrailingSlash)) { - return QStringList (QLatin1String("DIRECT")); - } - - if (m_script) { - return handleRequest(url); - } - - if (m_downloader || startDownload()) { - msg.setDelayedReply(true); - m_requestQueue.append( QueuedRequest( msg, url, true ) ); - return QStringList(); // return value will be ignored - } - - return QStringList(QLatin1String("DIRECT")); - } - - QString ProxyScout::proxyForUrl( const QString& checkUrl, QDBusMessage msg ) - { - KUrl url(checkUrl); - - if (m_suspendTime) { - if ( (std::time( 0 ) - m_suspendTime) < 300 ) { - return QLatin1String("DIRECT"); - } - m_suspendTime = 0; - } - - // Never use a proxy for the script itself - if (m_downloader && url.equals(m_downloader->scriptUrl(), KUrl::CompareWithoutTrailingSlash)) { - return QLatin1String("DIRECT"); - } - - if (m_script) { - return handleRequest(url).first(); - } - - if (m_downloader || startDownload()) { - msg.setDelayedReply(true); - m_requestQueue.append( QueuedRequest( msg, url ) ); - return QString(); // return value will be ignored - } - - return QLatin1String("DIRECT"); - } - - void ProxyScout::blackListProxy( const QString& proxy ) - { - m_blackList[ proxy ] = std::time( 0 ); - } - - void ProxyScout::reset() - { - delete m_script; - m_script = 0; - delete m_downloader; - m_downloader = 0; - delete m_watcher; - m_watcher = 0; - m_blackList.clear(); - m_suspendTime = 0; - KProtocolManager::reparseConfiguration(); - } - - bool ProxyScout::startDownload() - { - switch ( KProtocolManager::proxyType() ) - { - case KProtocolManager::WPADProxy: - if (m_downloader && !qobject_cast(m_downloader)) { - delete m_downloader; - m_downloader = 0; - } - if (!m_downloader) { - m_downloader = new Discovery(this); - connect(m_downloader, SIGNAL(result(bool)), this, SLOT(downloadResult(bool))); - } - break; - case KProtocolManager::PACProxy: { - if (m_downloader && !qobject_cast(m_downloader)) { - delete m_downloader; - m_downloader = 0; - } - if (!m_downloader) { - m_downloader = new Downloader(this); - connect(m_downloader, SIGNAL(result(bool)), this, SLOT(downloadResult(bool))); - } - - const KUrl url (KProtocolManager::proxyConfigScript()); - if (url.isLocalFile()) { - if (!m_watcher) { - m_watcher = new QFileSystemWatcher(this); - connect (m_watcher, SIGNAL(fileChanged(QString)), SLOT(proxyScriptFileChanged(QString))); - } - proxyScriptFileChanged(url.path()); - } else { - delete m_watcher; - m_watcher = 0; - m_downloader->download( url ); - } - break; - } - default: - return false; - } - - return true; - } - - void ProxyScout::disconnectNetwork() - { - // NOTE: We only connect to Solid's network notifier's shouldDisconnect - // signal because we only want to redo WPAD when a network interface is - // brought out of hibernation or restarted for whatever reason. - reset(); - } - - void ProxyScout::downloadResult( bool success ) - { - if ( success ) { - try - { - if (!m_script) { - m_script = new Script(m_downloader->script()); - } - } - catch ( const Script::Error& e ) - { - kWarning() << "Error:" << e.message(); - KNotification *notify= new KNotification ( "script-error" ); - notify->setText( i18n("The proxy configuration script is invalid:\n%1" , e.message() ) ); - notify->setComponentData(m_componentData); - notify->sendEvent(); - success = false; - } - } else { - KNotification *notify = new KNotification ("download-error"); - notify->setText( m_downloader->error() ); - notify->setComponentData(m_componentData); - notify->sendEvent(); - } - - if (success) { - for (RequestQueue::Iterator it = m_requestQueue.begin(), itEnd = m_requestQueue.end(); it != itEnd; ++it) { - if ((*it).sendAll) { - const QVariant result (handleRequest((*it).url)); - QDBusConnection::sessionBus().send((*it).transaction.createReply(result)); - } else { - const QVariant result (handleRequest((*it).url).first()); - QDBusConnection::sessionBus().send((*it).transaction.createReply(result)); - } - } - } else { - for (RequestQueue::Iterator it = m_requestQueue.begin(), itEnd = m_requestQueue.end(); it != itEnd; ++it) { - QDBusConnection::sessionBus().send((*it).transaction.createReply(QString::fromLatin1("DIRECT"))); - } - } - - m_requestQueue.clear(); - - // Suppress further attempts for 5 minutes - if ( !success ) { - m_suspendTime = std::time( 0 ); - } - } - - void ProxyScout::proxyScriptFileChanged(const QString& path) - { - // Should never get called if we do not have a watcher... - Q_ASSERT(m_watcher); - - // Remove the current file being watched... - if (!m_watcher->files().isEmpty()) { - m_watcher->removePaths(m_watcher->files()); - } - - // NOTE: QFileSystemWatcher only adds a path if it either exists or - // is not already being monitored. - m_watcher->addPath(path); - - // Reload... - m_downloader->download(KUrl::fromPath(path)); - } - - QStringList ProxyScout::handleRequest( const KUrl& url ) - { - try - { - QStringList proxyList; - const QString result = m_script->evaluate(url).trimmed(); - const QStringList proxies = result.split(QLatin1Char(';'), QString::SkipEmptyParts); - const int size = proxies.count(); - - for (int i = 0; i < size; ++i) { - QString mode, address; - const QString proxy = proxies.at(i).trimmed(); - const int index = proxy.indexOf(QLatin1Char(' ')); - if (index == -1) { // Only "DIRECT" should match this! - mode = proxy; - address = proxy; - } else { - mode = proxy.left(index); - address = proxy.mid(index + 1).trimmed(); - } - - const ProxyType type = proxyTypeFor(mode); - if (type == Unknown) { - continue; - } - - if (type == Proxy || type == Socks) { - const int index = address.indexOf(QLatin1Char(':')); - if (index == -1 || !KProtocolInfo::isKnownProtocol(address.left(index))) { - const QString protocol ((type == Proxy ? QLatin1String("http://") : QLatin1String("socks://"))); - const KUrl url (protocol + address); - if (url.isValid()) { - address = url.url(); - } else { - continue; - } - } - } - - if (type == Direct || !m_blackList.contains(address)) { - proxyList << address; - } else if (std::time(0) - m_blackList[address] > 1800) { // 30 minutes - // black listing expired - m_blackList.remove( address ); - proxyList << address; - } - } - - if (!proxyList.isEmpty()) { - kDebug(m_debugArea) << proxyList; - return proxyList; - } - // FIXME: blacklist - } - catch ( const Script::Error& e ) - { - kError() << e.message(); - KNotification *n=new KNotification( "evaluation-error" ); - n->setText( i18n( "The proxy configuration script returned an error:\n%1" , e.message() ) ); - n->setComponentData(m_componentData); - n->sendEvent(); - } - - return QStringList (QLatin1String("DIRECT")); - } -} - -#include "moc_proxyscout.cpp" - -// vim: ts=4 sw=4 et diff --git a/kio/misc/kpac/proxyscout.desktop b/kio/misc/kpac/proxyscout.desktop deleted file mode 100644 index 464508b6..00000000 --- a/kio/misc/kpac/proxyscout.desktop +++ /dev/null @@ -1,169 +0,0 @@ -[Desktop Entry] -Type=Service -Name=Network Proxy Configuration -Name[ar]=إعدادات وكيل الشبكة -Name[bg]=Настройки на мрежови посредник -Name[bn]=নেটওয়ার্ক প্রক্সি কনফিগারেশন -Name[bs]=Podešavanje proksija za mrežu -Name[ca]=Configuració del servidor intermediari de la xarxa -Name[ca@valencia]=Configuració del servidor intermediari de xarxa -Name[cs]=Nastavení proxy sítě -Name[da]=Indstilling af netværksproxy -Name[de]=Netzwerk-Proxy-Einrichtung -Name[el]=Ρύθμιση διαμεσολαβητή δικτύου -Name[en_GB]=Network Proxy Configuration -Name[es]=Configuración del proxy de la red -Name[et]=Võrgupuhverserveri seadistamine -Name[eu]=Sareko ordezkariaren konfigurazioa -Name[fi]=Verkon välityspalvelinasetukset -Name[fr]=Configuration du serveur mandataire de réseau -Name[ga]=Cumraíocht an tSeachfhreastalaí -Name[gl]=Configuración do proxy de rede -Name[gu]=નેટવર્ક પ્રોક્સી રુપરેખાંકન -Name[he]=קביעת הגדרות מתווך רשת -Name[hi]=नेटवर्क प्रॉक्सी कॉन्फ़िगरेशन -Name[hr]=Podešavanje mrežnog proxyja -Name[hu]=Hálózati proxybeállítások -Name[hy]=Ցանցի փոխարինող կերպարանք -Name[ia]=Configuration de proxy de rete -Name[id]=Konfigurasi Proxy Jaringan -Name[is]=Stillingar milliþjóna (proxy) -Name[it]=Configurazione proxy di rete -Name[ja]=ネットワークプロキシ設定 -Name[kk]=Желі проксиін баптау -Name[km]=ការ​កំណត់​រចនាសម្ព័ន្ធ​ប្រូកស៊ី​បណ្ដាញ -Name[ko]=네트워크 프록시 설정 -Name[ku]=Veavakirina Proxy ya Torê -Name[lt]=Tinklo įgaliotųjų serverių konfigūravimas -Name[lv]=Starpniekserveru konfigurēšana -Name[mr]=संजाळ प्रतिनिधि संयोजना -Name[nb]=Oppsett for mellomtjener -Name[nds]=Nettwark-Proxy instellen -Name[nl]=Configuratie voor netwerk-proxy -Name[pa]=ਨੈੱਟਵਰਕ ਪਰਾਕਸੀ ਸੰਰਚਨਾ -Name[pl]=Ustawienia pośrednika sieciowego -Name[pt]=Configuração do 'Proxy' de Rede -Name[pt_BR]=Configuração do proxy de rede -Name[ro]=Configurare proxy rețea -Name[ru]=Настройка прокси-серверов -Name[se]=Fierpmádatgaskabálvvá heivehus -Name[si]=ජාල ප්‍රොක්සි සැකසීම -Name[sk]=Nastavenie sieťového proxy -Name[sl]=Nastavitev omrežnega posredniškega strežnika -Name[sr]=Подешавање проксија за мрежу -Name[sr@ijekavian]=Подешавање проксија за мрежу -Name[sr@ijekavianlatin]=Podešavanje proksija za mrežu -Name[sr@latin]=Podešavanje proksija za mrežu -Name[sv]=Inställning av nätverksproxy -Name[ta]=பிணைய மாற்று வடிவமைப்பு -Name[tg]=Танзимоти шабакаи Proxy -Name[th]=การปรับแต่งพร็อกซีของเครือข่าย -Name[tr]=Vekil Sunucu Yapılandırması -Name[tt]=Челтәрнең прокси көйләнеше -Name[ug]=تور ۋاكالەتچى سەپلىمە -Name[uk]=Налаштування проксі-сервера мережі -Name[vi]=Cấu hình proxy mạng -Name[wa]=Apontiaedje do procsi del rantoele -Name[x-test]=xxNetwork Proxy Configurationxx -Name[zh_CN]=网络代理配置 -Name[zh_TW]=網路代理組態 -Comment=Automatic proxy configuration -Comment[af]=Outomatiese proksie opstelling -Comment[ar]=تهيئة آلية للخادم الوكيل -Comment[as]=স্বয়ংক্ৰিয় নিযুক্তকৰ বিন্যাস -Comment[ast]=Configuración automática del proxy -Comment[be]=Аўтаматычнае настаўленне проксі -Comment[be@latin]=Aŭtamatyčnaje naładžvańnie proxy -Comment[bg]=Автоматично настройване на мрежови посредник -Comment[bn]=স্বয়ংক্রিয় প্রক্সি কনফিগারেশন -Comment[bn_IN]=স্বয়ংক্রিয় প্রক্সি কনফিগারেশন ব্যবস্থা -Comment[br]=Kefluniadur emgefreekh ar proksi -Comment[bs]=Automatsko podešavanje proksija -Comment[ca]=Configuració automàtica de l'intermediari -Comment[ca@valencia]=Configuració automàtica de l'intermediari -Comment[cs]=Automatické nastavení proxy -Comment[csb]=Aùtokònfigùracëjô pòstrzédnika -Comment[cy]=Ffurweddiad Awtomatig o'r Dirprwy -Comment[da]=Automatisk proxy-indstilling -Comment[de]=Sucht nach einem Proxy-Server und richtet ihn ein -Comment[el]=Αυτόματη ρύθμιση διαμεσολαβητή -Comment[en_GB]=Automatic proxy configuration -Comment[eo]=Aŭtomata prokuragordo -Comment[es]=Configuración automática del proxy -Comment[et]=Automaatne puhverserveri seadistamine -Comment[eu]=Ordezkariaren konfigurazio automatikoa -Comment[fa]=پیکربندی خودکار پیشکار -Comment[fi]=Automaattiset välityspalvelinasetukset -Comment[fr]=Configuration automatique du serveur mandataire -Comment[fy]=Automatyske proxy ynstelling -Comment[ga]=Uathchumraíocht an tseachfhreastalaí -Comment[gl]=Configuración automática do proxy -Comment[gu]=આપમેળે પ્રોક્સી રુપરેખાંકન -Comment[he]=קביעת הגדרות מתווכים באופן אוטומטי -Comment[hi]=स्वचालित प्रॉक्सी कॉन्फ़िगरेशन -Comment[hne]=अपने अपन प्राक्सी कान्फिगरेसन -Comment[hr]=Automatsko konfiguriranje proxyja -Comment[hsb]=Awtomatiska konfiguracija proxyja -Comment[hu]=Automatikus proxybeállítás -Comment[hy]=Ավտոմատ պոխարինողի ձևակերպություն -Comment[ia]=Configuration automatic de proxy -Comment[id]=Konfigurasi proxy otomatis -Comment[is]=Sjálfvirkar stillingar vefsels -Comment[it]=Configurazione automatica proxy -Comment[ja]=自動プロキシ設定 -Comment[kk]=Проксиді автоматты түрде бапату -Comment[km]=ការ​កំណត់​រចនាសម្ព័ន្ធ​ប្រូកស៊ី​ដោយ​ស្វ័យប្រវត្តិ -Comment[kn]=ಸ್ವಯಂಚಾಲಿತ ಪ್ರಾತಿನಿಧಿಕ (ಪ್ರಾಕ್ಸಿ) ಸಂರಚನೆ -Comment[ko]=자동 프록시 설정 -Comment[ku]=Veavakirina bixweber yê proxy -Comment[lb]=Automatesch Proxy-Configuratioun -Comment[lt]=Automatinis proxy derinimas -Comment[lv]=Automātiska starpniekserveru konfigurēšana -Comment[mai]=स्वचालित प्राक्सी बिन्यास -Comment[mk]=Автоматска конфигурација на прокси -Comment[ml]=പ്രോക്സിയുടെ സ്വയം ക്രമീകരണം -Comment[mr]=स्वयंचलित प्रतिनिधि संयोजना -Comment[ms]=Penyelarasan Proksi Automatik -Comment[nb]=Automatisk mellomtjeneroppsett -Comment[nds]=Proxy automaatsch instellen -Comment[ne]=स्वचालित प्रोक्सी कन्फिगरेसन -Comment[nl]=Automatische proxy-configuratie -Comment[nn]=Automatisk mellomtenaroppsett -Comment[or]=ସ୍ୱୟଂଚାଳିତ ଛାୟା ବିନ୍ୟାସ -Comment[pa]=ਆਟੋਮੈਟਿਕ ਪਰਾਕਸੀ ਸੰਰਚਨਾ -Comment[pl]=Autoustawienia pośrednika -Comment[ps]=خپلکارې ګوډاګي سازونه -Comment[pt]=Configuração automática do 'proxy' -Comment[pt_BR]=Configuração automática do proxy -Comment[ro]=Configurare automată pentru proxy -Comment[ru]=Автоматическая настройка прокси-сервера -Comment[se]=Automáhtalaš gaskabálváheiveheapmi -Comment[si]=ස්වයංක්‍රීය ප්‍රොක්සි සැකසීම -Comment[sk]=Automatické nastavenie proxy -Comment[sl]=Samodejne nastavitve posredniškega strežnika -Comment[sr]=Аутоматско подешавање проксија -Comment[sr@ijekavian]=Аутоматско подешавање проксија -Comment[sr@ijekavianlatin]=Automatsko podešavanje proksija -Comment[sr@latin]=Automatsko podešavanje proksija -Comment[sv]=Automatisk proxyinställning -Comment[ta]=தானியக்க மாற்று வடிவமைப்பு -Comment[te]=స్వయంచాలక ప్రాక్సీ రూపకరణం -Comment[tg]=Танзимоти худкории proxy -Comment[th]=การปรับแต่งพร็อกซีอัตโนมัติ -Comment[tr]=Otomatik vekil sunucu yapılandırması -Comment[tt]=Проксины автоматик рәвештә көйләү -Comment[ug]=ئاپتوماتىك ۋاكالەتچى سەپلىمىسى -Comment[uk]=Автоматичне визначення проксі-сервера -Comment[uz]=Proksini avtomatik ravishda moslash -Comment[uz@cyrillic]=Проксини автоматик равишда мослаш -Comment[vi]=Cấu hình proxy tự động -Comment[wa]=Apontiaedje otomatike do procsi -Comment[x-test]=xxAutomatic proxy configurationxx -Comment[zh_CN]=自动代理配置 -Comment[zh_HK]=自動代理伺服器組態 -Comment[zh_TW]=自動代理組態 -X-KDE-ServiceTypes=KDEDModule -X-KDE-Library=proxyscout -X-KDE-DBus-ModuleName=proxyscout -X-KDE-Kded-autoload=false -X-KDE-Kded-load-on-demand=true diff --git a/kio/misc/kpac/proxyscout.h b/kio/misc/kpac/proxyscout.h deleted file mode 100644 index 5d3ee316..00000000 --- a/kio/misc/kpac/proxyscout.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - Copyright (c) 2003 Malte Starostik - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License 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 Library 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 KPAC_PROXYSCOUT_H -#define KPAC_PROXYSCOUT_H - -#include -#include -#include - -#include -#include - -#include - -namespace KPAC -{ - class Downloader; - class Script; - - class ProxyScout : public KDEDModule - { - Q_OBJECT - Q_CLASSINFO("D-Bus Interface", "org.kde.KPAC.ProxyScout") - public: - ProxyScout(QObject* parent, const QList&); - virtual ~ProxyScout(); - - public Q_SLOTS: - Q_SCRIPTABLE QString proxyForUrl( const QString& checkUrl, QDBusMessage); - Q_SCRIPTABLE QStringList proxiesForUrl( const QString& checkUrl, QDBusMessage); - Q_SCRIPTABLE void blackListProxy( const QString& proxy ); - Q_SCRIPTABLE void reset(); - - private Q_SLOTS: - void disconnectNetwork(); - void downloadResult( bool ); - void proxyScriptFileChanged(const QString&); - - private: - bool startDownload(); - QStringList handleRequest( const KUrl& url ); - - KComponentData m_componentData; - Downloader* m_downloader; - Script* m_script; - - struct QueuedRequest - { - QueuedRequest() {} - QueuedRequest( const QDBusMessage&, const KUrl&, bool sendall = false); - - QDBusMessage transaction; - KUrl url; - bool sendAll; - }; - typedef QList< QueuedRequest > RequestQueue; - RequestQueue m_requestQueue; - - typedef QMap< QString, qint64 > BlackList; - BlackList m_blackList; - qint64 m_suspendTime; - int m_debugArea; - QFileSystemWatcher* m_watcher; - }; -} - -#endif // KPAC_PROXYSCOUT_H - -// vim: ts=4 sw=4 et diff --git a/kio/misc/kpac/proxyscout.notifyrc b/kio/misc/kpac/proxyscout.notifyrc deleted file mode 100644 index c74a832b..00000000 --- a/kio/misc/kpac/proxyscout.notifyrc +++ /dev/null @@ -1,620 +0,0 @@ -[Global] -IconName=preferences-system-network-proxy -Comment=Network Proxy Configuration -Comment[ar]=إعدادات وكيل الشبكة -Comment[bg]=Настройки на мрежови посредник -Comment[bn]=নেটওয়ার্ক প্রক্সি কনফিগারেশন -Comment[bs]=Podešavanje proksija za mrežu -Comment[ca]=Configuració del servidor intermediari de la xarxa -Comment[ca@valencia]=Configuració del servidor intermediari de la xarxa -Comment[cs]=Nastavení proxy sítě -Comment[da]=Indstilling af netværksproxy -Comment[de]=Netzwerk-Proxy-Einrichtung -Comment[el]=Ρύθμιση διαμεσολαβητή δικτύου -Comment[en_GB]=Network Proxy Configuration -Comment[es]=Configuración del proxy de la red -Comment[et]=Võrgupuhverserveri seadistamine -Comment[eu]=Sareko ordezkariaren konfigurazioa -Comment[fi]=Verkon välityspalvelinasetukset -Comment[fr]=Configuration réseau du serveur mandataire -Comment[ga]=Cumraíocht an tSeachfhreastalaí -Comment[gl]=Configuración do proxy de rede -Comment[gu]=નેટવર્ક પ્રોક્સી રુપરેખાંકન -Comment[he]=קביעת הגדרות מתווך רשת -Comment[hi]=नेटवर्क प्रॉक्सी कॉन्फ़िगरेशन -Comment[hr]=Podešavanje mrežnog proxyja -Comment[hu]=Hálózati proxybeállítások -Comment[hy]=Ցանցի փոխարինողի ձեվակերպություն -Comment[ia]=Configuration de proxy de rete -Comment[id]=Konfigurasi Proxy Jaringan -Comment[is]=Stillingar milliþjóna (proxy) -Comment[it]=Configurazione proxy di rete -Comment[ja]=ネットワークプロキシ設定 -Comment[kk]=Желі проксиін баптау -Comment[km]=ការ​កំណត់​រចនាសម្ព័ន្ធ​ប្រូកស៊ី​បណ្ដាញ -Comment[ko]=네트워크 프록시 설정 -Comment[ku]=Veavakirina Proxy ya Torê -Comment[lt]=Tinklo įgaliotųjų serverių konfigūravimas -Comment[lv]=Konfigurē tīkla starpniekserveru iestatījumus -Comment[mr]=संजाळ प्रतिनिधि संयोजना -Comment[nb]=Oppsett for mellomtjener -Comment[nds]=Nettwark-Proxy instellen -Comment[nl]=Configuratie voor netwerk-proxy -Comment[pa]=ਆਟੋਮੈਟਿਕ ਪਰਾਕਸੀ ਸੰਰਚਨਾ -Comment[pl]=Ustawienia pośrednika sieciowego -Comment[pt]=Configuração do 'Proxy' de Rede -Comment[pt_BR]=Configuração do proxy de rede -Comment[ro]=Configurare proxy rețea -Comment[ru]=Настройка прокси-серверов -Comment[se]=Fierpmádatgaskabálvvá heivehus -Comment[si]=ජාල ප්‍රොක්සි සැකසීම -Comment[sk]=Nastavenie sieťového proxy -Comment[sl]=Nastavitev omrežnega posredniškega strežnika -Comment[sr]=Подешавање проксија за мрежу -Comment[sr@ijekavian]=Подешавање проксија за мрежу -Comment[sr@ijekavianlatin]=Podešavanje proksija za mrežu -Comment[sr@latin]=Podešavanje proksija za mrežu -Comment[sv]=Inställning av nätverksproxy -Comment[ta]=பிணைய மாற்று வடிவமைப்பு -Comment[tg]=Танзимоти шабкаи Proxy -Comment[th]=การปรับแต่งพร็อกของเครือข่าย -Comment[tr]=Vekil Sunucu Yapılandırması -Comment[tt]=Челтәрнең прокси көйләнеше -Comment[ug]=تور ۋاكالەتچى سەپلىمە -Comment[uk]=Налаштування проксі-сервера мережі -Comment[vi]=Cấu hình proxy mạng -Comment[wa]=Apontiaedje do procsi del rantoele -Comment[x-test]=xxNetwork Proxy Configurationxx -Comment[zh_CN]=网络代理配置 -Comment[zh_TW]=網路代理組態 - -[Event/script-error] -Name=Invalid Proxy Script -Name[ar]=سكربت الوكيل غير صالح -Name[as]=অবৈধ নিয়ুক্তকৰ স্ক্ৰিপ্ট -Name[ast]=Guión de proxy inválidu -Name[be]=Няправільны сцэнар проксі -Name[be@latin]=Niapravilny proksi-skrypt -Name[bg]=Невалиден скрипт за посредник -Name[bn]=অবৈধ প্রক্সি স্ক্রিপ্ট -Name[bn_IN]=অবৈধ প্রক্সি স্ক্রিপ্ট -Name[bs]=Neispravna skripta proksija -Name[ca]=L'script de l'intermediari no és vàlid -Name[ca@valencia]=Script de l'intermediari no vàlid -Name[cs]=Neplatný proxy skript -Name[csb]=Zmiłkòwi skrip pòstrzédnika -Name[da]=Ugyldigt proxy-script -Name[de]=Ungültiges Proxy-Skript -Name[el]=Μη έγκυρο σενάριο διαμεσολαβητή -Name[en_GB]=Invalid Proxy Script -Name[eo]=Nevalida prokura skripto -Name[es]=Script de proxy no válido -Name[et]=Vigane puhverserveri skript -Name[eu]=Ordezkariaren script baliogabea -Name[fa]=دست‌نوشتهٔ نامعتبر پیشکار -Name[fi]=Virheellinen välityspalvelinskripti -Name[fr]=Script non valable pour serveur mandataire -Name[fy]=Unjildich proksy skript -Name[ga]=Script Neamhbhailí Seachfhreastalaí -Name[gl]=O script de proxy non é válido -Name[gu]=અયોગ્ય પ્રોક્સી સ્ક્રિપ્ટ -Name[he]=תסריט מתווך לא תקין -Name[hi]=अवैध प्रॉक्सी स्क्रिप्ट -Name[hne]=अवैध प्राक्सी स्क्रिप्ट -Name[hr]=Neispravna proxy skripta -Name[hsb]=Njekorektny proxyjowy skript -Name[hu]=Érvénytelen proxyszkript -Name[hy]=սխալ փոխարինող գիր -Name[ia]=Script de proxy invalide -Name[id]=Skrip Proxy Tidak Sah -Name[is]=Ógild vefselsskrifta -Name[it]=Script proxy non valido -Name[ja]=無効なプロキシスクリプト -Name[kk]=Жарамсыз прокси скрипті -Name[km]=ស្គ្រីប​ប្រូកស៊ី​មិនត្រឹមត្រូវ -Name[kn]=ಅಮಾನ್ಯ ಪ್ರಾತಿನಿಧಿಕ (ಪ್ರಾಕ್ಸಿ) ವಿಧಿಗುಚ್ಛ (ಸ್ಕ್ರಿಪ್ಟ್) -Name[ko]=잘못된 프록시 스크립트 -Name[ku]=Skrîpta Proxy yê Ne Derbasdar -Name[lt]=Blogas proxy scenarijus -Name[lv]=Nederīgs starpniekservera skripts -Name[mai]=अवैध प्राक्सी स्क्रिप्ट -Name[mk]=Невалидна прокси-скрипта -Name[ml]=അസാധുവായ പ്രോക്സി സ്ക്രിപ്റ്റ് -Name[mr]=अवैध प्रतिनिधि स्क्रिप्ट -Name[nb]=Ugyldig mellomtjenerskript -Name[nds]=Leeg Proxy-Skript -Name[ne]=अवैध प्रोक्सी स्क्रिप्ट -Name[nl]=Ongeldig proxyscript -Name[nn]=Ugyldig mellomtenarskript -Name[or]=ଅବୈଧ ଛାୟା ସ୍କ୍ରିପ୍ଟ -Name[pa]=ਗਲਤ ਪਰਾਕਸੀ ਸਕ੍ਰਿਪਟ -Name[pl]=Niepoprawny skrypt pośrednika -Name[ps]=ناسم ګوډاګی سکرېپټ -Name[pt]=Programa de 'Proxy' Inválido -Name[pt_BR]=Script de proxy inválido -Name[ro]=Script proxy invalid -Name[ru]=Недопустимый сценарий настройки прокси-сервера -Name[se]=Gustohis gaskabálvaskripta -Name[si]=සාවද්‍ය ප්‍රොක්සි ස්ක්‍රිප්ටය -Name[sk]=Neplatný proxy skript -Name[sl]=Neveljaven skript posredniškega strežnika -Name[sr]=Неисправна скрипта проксија -Name[sr@ijekavian]=Неисправна скрипта проксија -Name[sr@ijekavianlatin]=Neispravna skripta proksija -Name[sr@latin]=Neispravna skripta proksija -Name[sv]=Ogiltigt proxyskript -Name[ta]=செல்லாத மாற்று குறுநிரல் -Name[te]=చెల్లని ప్రాక్సీ స్క్రిప్ట్ -Name[tg]=Дастнависи Proxy нодуруст -Name[th]=สคริปต์พร็อกซีไม่ถูกต้อง -Name[tr]=Geçersiz Vekil Sunucu Betiği -Name[tt]=Прокси скриптында хата -Name[ug]=ئىناۋەتسىز ۋاكالەتچى قوليازمىسى -Name[uk]=Некоректний скрипт проксі -Name[vi]=Mã proxy không hợp lệ -Name[wa]=Scripe do procsi nén valåbe -Name[x-test]=xxInvalid Proxy Scriptxx -Name[zh_CN]=无效的代理脚本 -Name[zh_TW]=不合法的代理文稿 -Comment=The downloaded proxy configuration script is invalid -Comment[af]=Die proksie skrip wat afgelaai is, is ongeldig -Comment[ar]=سكربت إعدادات الوكيل المنزل غير صالح -Comment[as]=ডাউন্‌লোড কৰা নিযুক্তক বিন্যাসৰ স্ক্ৰিপ্ট অবৈধ -Comment[ast]=El guión de configuración del proxy descargáu ye inválidu -Comment[be]=Сцягнуты сцэнар настаўлення проксі-сервера няправільны -Comment[be@latin]=Atrymany niapravilny skrypt naładžvańnia proxy -Comment[bg]=Сваленият скрипт за настройка на посредник е невалиден -Comment[bn]=ডাউনলোড করা প্রক্সি কনফিগারেশন স্ক্রিপ্টটি অবৈধ -Comment[bn_IN]=ডাউনলোড করা প্রক্সি কনফিগারেশন স্ক্রিপ্ট বৈধ নয় -Comment[br]=N'eo ket mat urzhiaoug kefluniadur ar proksi -Comment[bs]=Preuzeta skripta postave proksija nije ispravna -Comment[ca]=L'script de configuració baixat de l'intermediari no és vàlid -Comment[ca@valencia]=L'script descarregat de configuració de l'intermediari no és vàlid -Comment[cs]=Stažený konfigurační skript pro proxy je neplatný -Comment[csb]=Zladowóny skrip kònfigùracëji pòstrzédnika je zmiłkòwi -Comment[cy]=Mae'r sgript ffurfweddu'r dirprwy a chafodd ei lawrlwytho yn annilys -Comment[da]=Det hentede proxy-indstillingsscript er ugyldigt -Comment[de]=Das heruntergeladene Konfigurationsskript für den Proxy ist ungültig. -Comment[el]=Το ληφθέν σενάριο ρύθμισης διαμεσολαβητή δεν είναι έγκυρο -Comment[en_GB]=The downloaded proxy configuration script is invalid -Comment[eo]=La elŝutita prokura agordoskripto estas nevalida -Comment[es]=El script de configuración del proxy descargado no es válido -Comment[et]=Allalaaditud puhverserveri seadistuse skript on vigane -Comment[eu]=Jaitsitako ordezkaria konfiguratzeko script-a baliogabea da -Comment[fa]=دست‌نوشتهٔ پیکربندی پیشکار بارگیری شده نامعتبر است -Comment[fi]=Ladattu välityspalvelin asetusskripti on virheellinen -Comment[fr]=Le script téléchargé pour configurer un serveur mandataire n'est pas valable -Comment[fy]=It ynladen proxy ynstellings skript is ûnjildich -Comment[ga]=Is neamhbhailí í script chumraíocht an tseachfhreastalaí a íosluchtaíodh -Comment[gl]=O script de configuración do proxy que se descargou non é válido -Comment[gu]=ડાઉનલોડ કરેલ પ્રોક્સી રૂપરેખાંકન સ્ક્રિપ્ટ અયોગ્ય છે -Comment[he]=תסריט ההגדרות של השרת המתווך שהורד לא תקין -Comment[hi]=डाउनलोड किया गया प्रॉक्सी कॉन्फ़िगरेशन स्क्रिप्ट अवैध है -Comment[hne]=डाउनलोड करे गे प्राक्सी कान्फिगरेसन स्क्रिप्ट अवैध हे -Comment[hr]=Preuzeta skripta za konfiguriranje proxyja je neispravna -Comment[hsb]=Sćehnjeny konfiguraciski skript za proxy je njekorektny. -Comment[hu]=A letöltött proxyszkript érvénytelen -Comment[ia]=Le script de configuration de proxy discargate es invalide -Comment[id]=Skrip konfigurasi proxy yang diunduh tidak sah -Comment[is]=Sótt vefselsskrifta er ógild -Comment[it]=Lo script di configurazione proxy scaricato non è valido -Comment[ja]=ダウンロードされたプロキシ設定スクリプトは無効です -Comment[kk]=Жүктеп алынған проксиді баптау скрипті жарамсыз -Comment[km]=ស្គ្រីប​កំណត់​រចនា​សម្ព័ន្ធ​ប្រូកស៊ី​ដែល​បាន​ទាញយក​គឺ​មិនត្រឹមត្រូវ -Comment[kn]=ನಕಲಿಳಿಸಲಾದ ಪ್ರಾತಿನಿಧಿಕದ (ಪ್ರಾಕ್ಸಿ) ಸಂರಚನಾ ವಿಧಿಗುಚ್ಛ (ಸ್ಕ್ರಿಪ್ಟ್) ಅಮಾನ್ಯವಾದದ್ದಾಗಿದೆ -Comment[ko]=다운로드한 프록시 설정 스크립트가 잘못되었습니다 -Comment[ku]=Skrîpta veavakirina proxy yê daxistî ne derbasdar e -Comment[lb]=D'Proxy-Configuratiounsskript, dat erofgelude gouf, ass ongülteg -Comment[lt]=Atsisiųstas proxy derinimo scenarijus yra blogas -Comment[lv]=Lejupielādētais starpniekservera skripts ir nederīgs -Comment[mai]=डाउनलोड कएल गेल प्राक्सी बिन्यास स्क्रिप्ट अवैध अछि -Comment[mk]=Симнатата скрипта за конфигурација на прокси е навалидна -Comment[ml]=ഡൌണ്‍ലോഡ് ചെയ്ത പ്രോക്സി സജ്ജീകരിക്കുന്ന സ്ക്രിപ്റ്റ് ശരിയല്ല -Comment[mr]=डाउनलोड केलेले संयोजना स्क्रिप्ट अवैध -Comment[ms]=Skrip penyelarasan proksi yang dimuat turun tidak sah -Comment[nb]=Mellomtjenerskriptet som ble lastet ned er ugyldig -Comment[nds]=Dat daallaadte Proxy-Instellskript is leeg -Comment[ne]=डाउनलोड गरिएका प्रोक्सी कन्फिगरेसन स्क्रिप्ट अवैध छ -Comment[nl]=Het gedownloade script met de proxyconfiguratie is ongeldig -Comment[nn]=Det nedlasta skriptet for automatisk mellomtenaroppsett er ugyldig -Comment[or]=ଆହରଣ କୃତ ଛାୟା ବିନ୍ୟାସ ସ୍କ୍ରିପ୍ଟ ଟି ଅବୈଧ -Comment[pa]=ਡਾਊਨਲੋਡ ਕੀਤੀ ਪਰਾਕਸੀ ਸੰਰਚਨਾ ਸਕ੍ਰਿਪਟ ਗਲਤ ਹੈ -Comment[pl]=Pobrany skrypt ustawień pośrednika jest nieprawidłowy -Comment[ps]=رالېښل شوی ګوډاګي سازونې سکرېپټ ناسم دی -Comment[pt]=O programa de configuração do 'proxy' transferido é inválido -Comment[pt_BR]=O script de configuração do proxy obtido é inválido -Comment[ro]=Scriptul de configurare proxy este eronat -Comment[ru]=Загруженный сценарий настройки прокси-сервера содержит ошибки -Comment[se]=Vižžon gaskabálvaskripta ii gusto -Comment[sk]=Stiahnutý konfiguračný skript pre proxy je neplatný -Comment[sl]=Prejet nastavitveni skript posredniškega strežnika je neveljaven -Comment[sr]=Преузета скрипта поставе проксија није исправна -Comment[sr@ijekavian]=Преузета скрипта поставе проксија није исправна -Comment[sr@ijekavianlatin]=Preuzeta skripta postave proksija nije ispravna -Comment[sr@latin]=Preuzeta skripta postave proksija nije ispravna -Comment[sv]=Det nerladdade proxyinställningsskriptet är ogiltigt -Comment[ta]=இறக்கப்பட்ட மாற்று வடிவமைப்பு குறிநிரல் செல்லாது -Comment[te]=డౌన్ లోడ్ చేయబడిన్ ప్రాక్సీ రూపకరణపు స్క్రిప్ట్ చెల్లదు -Comment[tg]=Дастнависи proxy боршуда нодуруст аст -Comment[th]=สคริปต์ปรับแต่งพร็อกซีที่ดาวน์โหลดมาใช้ไม่ได้ -Comment[tr]=İndirilen vekil sunucu yapılandırma betiği geçersiz -Comment[tt]=Кабул ителгән прокси көйләүченең скрипты бозык -Comment[ug]=چۈشۈرگەن ۋاكالەتچى سەپلىمە قوليازمىسى ئىناۋەتسىز -Comment[uk]=Звантажено некоректний скрип проксі -Comment[uz]=Proksini moslash uchun yozib olingan skript haqiqiy emas -Comment[uz@cyrillic]=Проксини мослаш учун ёзиб олинган скрипт ҳақиқий эмас -Comment[vi]=Mã cấu hình proxy đã tải không hợp lệ -Comment[wa]=Li scripe d' apontiaedje do procsi aberweté n' est nén valåbe -Comment[x-test]=xxThe downloaded proxy configuration script is invalidxx -Comment[zh_CN]=下载的代理配置脚本无效 -Comment[zh_HK]=剛下載的代理伺服器組態 script 語法有誤 -Comment[zh_TW]=下載的代理組態文稿不合法 -Action=Popup - -[Event/download-error] -Name=Script Download Error -Name[af]=Skrip aflaaifout -Name[ar]=خطأ في تنزيل السكربت -Name[as]=স্ক্ৰিপ্ট ডাউন্‌লোড কৰোঁতে ভুল -Name[ast]=Error na descarga de guión -Name[be]=Памылка сцягвання сцэнара -Name[be@latin]=Pamyłka atrymańnia skrypta -Name[bg]=Грешка при сваляне на скрипт -Name[bn]=স্ক্রিপ্ট ডাউনলোডে সমস্যা -Name[bn_IN]=স্ক্রিপ্ট ডাউনলোড সংক্রান্ত ত্রুটি -Name[bs]=Greška u preuzimanju skripte -Name[ca]=Error en baixar l'script -Name[ca@valencia]=Error de descàrrega de l'script -Name[cs]=Chyba ve stažení skriptu -Name[csb]=Fela zladowaniô skriptu -Name[da]=Fejl under download af Script -Name[de]=Fehler beim Herunterladen des Skripts -Name[el]=Σφάλμα λήψης σεναρίου -Name[en_GB]=Script Download Error -Name[eo]=Eraro pri elŝuto de skripto -Name[es]=Error de descarga del script -Name[et]=Viga skripti allalaadimisel -Name[eu]=Errorea script-a deskargatzean -Name[fa]=خطا در بارگیری دست‌نوشته -Name[fi]=Skriptin latausvirhe -Name[fr]=Erreur de téléchargement du script -Name[fy]=Skript ynlaad flater -Name[ga]=Earráid Íosluchtaithe Scripte -Name[gl]=Erro na descarga do script -Name[gu]=સ્ક્રિપ્ટ ડાઉનલોડ ક્ષતિ -Name[he]=שגיאת הורדת תסריט -Name[hi]=स्क्रिप्ट डाउनलोड त्रुटि -Name[hne]=स्क्रिप्ट डाउनलोड गलती -Name[hr]=Pogreška pri preuzimanju skripte -Name[hsb]=Zmylk sćehnjenja skripta -Name[hu]=Szkriptletöltési hiba -Name[hy]=Գրի ներբեռման սխալ -Name[ia]=Error de discarga del script -Name[id]=Galat Unduh Skrip -Name[is]=Villa við niðurhal skriftu -Name[it]=Errore scaricamento script -Name[ja]=スクリプトのダウンロードエラー -Name[kk]=Скриптті жүктеу қатесі -Name[km]=កំហុស​ក្នុង​ការ​ទាញយក​ស្គ្រីប -Name[kn]=ವಿಧಿಗುಚ್ಛ (ಸ್ಕ್ರಿಪ್ಟ್ ) ನಕಲಿಳಿಸು ದೋಷ -Name[ko]=스크립트 다운로드 오류 -Name[ku]=Çewtiya Daxistina Skrîptê -Name[lt]=Scenarijaus atsisiuntimo klaida -Name[lv]=Skripta lejupielādes kļūda -Name[mai]=स्क्रिप्ट डाउनलोडक त्रुटि -Name[mk]=Грешка при симнување на скриптата -Name[ml]=സ്ക്രിപ്റ്റ് ഡൌണ്‍ലോഡില്‍ തെറ്റുണ്ടു് -Name[mr]=स्क्रिप्ट डाउनलोड त्रुटी -Name[nb]=Feil ved skriptnedlasting -Name[nds]=Skript-Daallaadfehler -Name[ne]=स्क्रिप्टले त्रुटि डाउनलोड गर्यो -Name[nl]=Fout bij scriptdownload -Name[nn]=Feil ved skriptnedlasting -Name[or]=ସ୍କ୍ରିପ୍ଟ ଆହରଣ ତ୍ରୁଟି -Name[pa]=ਸਕ੍ਰਿਪਟ ਡਾਊਨਲੋਡ ਗਲਤੀ -Name[pl]=Błąd pobierania skryptu -Name[ps]=د سکرېپټ رالېښنې تېروتنه -Name[pt]=Erro de Transferência do Programa -Name[pt_BR]=Erro no download do script -Name[ro]=Eroare de descărcare a scriptului -Name[ru]=Ошибка загрузки скрипта -Name[se]=Filtii skripta viežžamis -Name[si]=ස්ක්‍රිප්ට් ලබාගැනීමේ දෝෂය -Name[sk]=Chyba počas sťahovania skriptu -Name[sl]=Napaka med prejemom skripta -Name[sr]=Грешка у преузимању скрипте -Name[sr@ijekavian]=Грешка у преузимању скрипте -Name[sr@ijekavianlatin]=Greška u preuzimanju skripte -Name[sr@latin]=Greška u preuzimanju skripte -Name[sv]=Nerladdningsfel för skript -Name[ta]=குறுநிரல் இறக்கத்தில் பிழை -Name[te]=స్క్రిప్ట్ డౌన్ లోడ్ దోషం -Name[tg]=Хатои боркунии дастнавис -Name[th]=การดาวน์โหลดสคริปต์เกิดข้อผิดพลาด -Name[tr]=Betik İndirme Hatası -Name[tt]=Бирелгән скрипта хата -Name[ug]=قوليازما چۈشۈرۈش خاتالىقى -Name[uk]=Помилка звантаження проксі -Name[vi]=Lỗi tải mã -Name[wa]=Aroke d' aberwetaedje do scripe -Name[x-test]=xxScript Download Errorxx -Name[zh_CN]=脚本下载错误 -Name[zh_TW]=文稿下載錯誤 -Comment=The proxy configuration script could not be downloaded -Comment[af]=Die proksie opstellingskrip kon nie afgelaai word nie -Comment[ar]=لا يمكن تنزيل سكربت إعدادات الوكيل -Comment[as]=নিযুক্তক বিন্যাসৰ স্ক্ৰিপ্ট ডাউন্‌লোড কৰিব পৰা ন'গ'ল -Comment[ast]=Nun pudo descargase'l guión de configuración del proxy -Comment[be]=Немагчыма сцягнуць сцэнар настаўлення проксі -Comment[be@latin]=Nie ŭdałosia atrymać skrypt naładžvańnia proxy -Comment[bg]=Скриптът за настройка на посредник не беше свален -Comment[bn]=প্রক্সি কনফিগারেশন স্ক্রিপ্ট ডাউনলোড করা যায়নি -Comment[bn_IN]=প্রক্সি কনফিগারেশনের স্ক্রিপ্ট ডাউনলোড করা যায়নি -Comment[br]=Ne m'eus ket enkargañ urzhiaoug kefluniadur ar proksi -Comment[bs]=Skripta postave proksija ne može biti preuzeta -Comment[ca]=L'script de configuració de l'intermediari no es pot baixar -Comment[ca@valencia]=L'script de configuració de l'intermediari no es pot descarregar -Comment[cs]=Nelze stáhnout konfigurační skript pro proxy -Comment[csb]=Skript kònfigùracëji pòstrzédnika ni mòże bëc zladowóny -Comment[cy]=Y sgript ffurfweddu'r dirprwy -Comment[da]=Proxy-indstillingsscriptet kunne ikke hentes -Comment[de]=Das Konfigurationsskript für den Proxy kann nicht heruntergeladen werden. -Comment[el]=Αδύνατη η λήψη του σεναρίου ρύθμισης διαμεσολαβητή -Comment[en_GB]=The proxy configuration script could not be downloaded -Comment[eo]=Ne povis elŝuti la prokuran agordoskripton -Comment[es]=No se puede descargar el script de configuración del proxy -Comment[et]=Puhverserveri seadistuse skripti allalaadimine nurjus -Comment[eu]=Ordezkaria konfiguratzeko script-a ezin izan da deskargatu -Comment[fa]=دست‌نوشتهٔ پیکربندی پیشکار نتوانست بارگیری شود -Comment[fi]=Välityspalvelimen asetusskriptin lataaminen ei onnistunut -Comment[fr]=Le script de configuration du serveur mandataire (proxy) n'a pas pu être téléchargé -Comment[fy]=It ynladen fan de proxy ynstellings skript is net slagge -Comment[ga]=Níorbh fhéidir script chumraíochta an tseachfhreastalaí a íosluchtú -Comment[gl]=Non foi posíbel descargar o script de configuración do proxy -Comment[gu]=પ્રોક્સી રૂપરેખાંકન સ્ક્રિપ્ટ ડાઉનલોડ કરી શકાતી નથી -Comment[he]=אין אפשרות להוריד את תסריט הגדרות שרת המתווך -Comment[hi]=प्रॉक्सी कॉन्फ़िगरेशन स्क्रिप्ट को डाउनलोड नहीं किया जा सका -Comment[hne]=प्राक्सी कान्फिगरेसन स्क्रिप्ट ल डाउनलोड नइ कर सकिस -Comment[hr]=Skripta za konfiguraciju proxyja nije mogla biti preuzeta -Comment[hsb]=Konfiguraciski skript za proxy njehodźi so sćahnyć -Comment[hu]=A proxyszkriptet nem sikerült letölteni -Comment[hy]=Փոխարինող ձեւավորման գիրը չի ներբեռվել -Comment[ia]=Le configuration del script poterea non esser discargate -Comment[id]=Skrip konfigurasi proxy tak dapat diunduh -Comment[is]=Gat ekki sótt stillingaskriftu vefsels -Comment[it]=Impossibile scaricare lo script di configurazione proxy -Comment[ja]=プロキシ設定スクリプトをダウンロードできませんでした -Comment[kk]=Проксиді баптау скрипті жүктеп алынбайды -Comment[km]=មិន​អាច​ទាញយក​ស្គ្រីប​កំណត់រចនា​សម្ព័ន្ធ​ប្រូកស៊ី​បាន​ឡើយ -Comment[kn]=ಪ್ರಾತಿನಿಧಿಕದ (ಪ್ರಾಕ್ಸಿ) ಸಂರಚನಾ ವಿಧಿಗುಚ್ಛವನ್ನು (ಸ್ಕ್ರಿಪ್ಟ್) ನಕಲಿಳಿಸಲಾಗಲಿಲ್ಲ -Comment[ko]=프록시 구성 스크립트를 다운로드할 수 없습니다 -Comment[ku]=Skrîpta veavakirina proxy nayê daxistin -Comment[lb]=D'Proxy-Konfiguratiounsskript konnt net erofgeluede ginn -Comment[lt]=Proxy derinimo scenarijus negali būti atsisiųstas -Comment[lv]=Neizdevās lejupielādēt starpniekservera konfigurācijas skriptu -Comment[mai]=प्राक्सी बिन्यास स्क्रिप्ट केँ डाउनलोड नहि कएल जाए सकल -Comment[mk]=Скриптата за конфигурација на прокси не можеше да се симне -Comment[ml]=പ്രോക്സി സജ്ജീകരിക്കുന്ന സ്ക്രിപ്റ്റ് ഡൌണ്‍ലോഡ് ചെയ്യാന്‍ പറ്റുന്നില്ല -Comment[mr]=प्रतिनिधि संयोजना स्क्रिप्ट डाउनलोड होऊ शकत नाही -Comment[ms]=Skrip penyelarasan proksi tidak boleh dimuat turun -Comment[nb]=Klarte ikke å laste ned skript for mellomtjeneroppsett -Comment[nds]=Dat Proxy-Instellskript lett sik nich daalladen -Comment[ne]=प्रोक्सी कन्फिगरेसन स्क्रिप्ट डाउनलोड गर्न सकेन -Comment[nl]=Het script met de proxyconfiguratie kon niet worden gedownload -Comment[nn]=Klarte ikkje lasta ned skript for automatisk mellomtenaroppsett -Comment[or]=ଛାୟା ବିନ୍ୟାସ ସ୍କ୍ରିପ୍ଟ ଆହରଣ କରିହେଲା ନାହିଁ -Comment[pa]=ਪਰਾਕਸੀ ਸੰਰਚਨਾ ਸਕ੍ਰਿਪਟ ਡਾਊਨਲੋਡ ਨਹੀਂ ਕੀਤੀ ਜਾ ਸਕੀ -Comment[pl]=Nie można pobrać skryptu ustawień pośrednika -Comment[ps]=د ګوډاګي د سازونې سکرېپټ رالېښل کېدی نه شي -Comment[pt]=Não foi possível transferir o programa de configuração do 'proxy' -Comment[pt_BR]=O script de configuração do proxy não pôde ser baixado -Comment[ro]=Nu am putut descărca scriptul de configurare proxy -Comment[ru]=Невозможно загрузить сценарий настройки прокси-сервера -Comment[se]=Ii sáhttán viežžat skripta automáhtalaš gaskabálvaheivehusa várás -Comment[sk]=Nepodarilo sa stiahnuť konfiguračný skript pre proxy -Comment[sl]=Nastavitvenega skripta posredniškega strežnika ni bilo mogoče prejeti -Comment[sr]=Скрипта поставе проксија не може бити преузета -Comment[sr@ijekavian]=Скрипта поставе проксија не може бити преузета -Comment[sr@ijekavianlatin]=Skripta postave proksija ne može biti preuzeta -Comment[sr@latin]=Skripta postave proksija ne može biti preuzeta -Comment[sv]=Proxyinställningsskriptet kunde inte laddas ner -Comment[ta]=மாற்று வடிவமைப்பு குறுநிரலை இறக்க முடியவில்லை -Comment[te]=ప్రాక్సీ రూపకరణపు స్క్రిప్ట్ ని డౌన్ లోడ్ చేయలేకపోయాం -Comment[tg]=Дастнависи танзимшавандаи proxy бор карда намешавад -Comment[th]=ไม่สามารถดาวน์โหลดสคริปต์ปรับแต่งพร็อกซีได้ -Comment[tr]=Vekil sunucu yapılandırma dosyası indirilemedi -Comment[tt]=Прокси көйләүченең скриптын кабыл итеп булмый -Comment[ug]=ۋاكالەتچى سەپلىمە قوليازمىسىنى چۈشۈرەلمىدى -Comment[uk]=Неможливо звантажити скрипт налаштування проксі -Comment[uz]=Proksini moslash uchun skriptni yozib olib boʻlmadi -Comment[uz@cyrillic]=Проксини мослаш учун скриптни ёзиб олиб бўлмади -Comment[vi]=Không thể tải mã lệnh cấu hình proxy -Comment[wa]=Dji n' a savou aberweter l' sicripe d' apontiaedje do procsi -Comment[x-test]=xxThe proxy configuration script could not be downloadedxx -Comment[zh_CN]=无法下载代理配置脚本 -Comment[zh_HK]=無法取得代理伺服器組態 script 檔案 -Comment[zh_TW]=代理組態文稿無法下載 -Action=Popup - -[Event/evaluation-error] -Name=Script Evaluation Error -Name[af]=Skrip evaluasiefout -Name[ar]=خطأ في تقييم السكربت -Name[as]=স্ক্ৰিপ্টৰ পৰীক্ষাত ভুল -Name[ast]=Error d'evaluación del guión -Name[be]=Памылка выканання сцэнару -Name[be@latin]=Pamyłka ŭ vykanańni skrypta -Name[bg]=Грешка при оценка на скрипт -Name[bn]=স্ক্রিপ্ট চালানোয় সমস্যা -Name[bn_IN]=স্ক্রিপ্ট বিশ্লেষণ সংক্রান্ত ত্রুটি -Name[bs]=Greška u izvršavanju skripte -Name[ca]=Error en avaluar l'script -Name[ca@valencia]=Error d'avaluació de l'script -Name[cs]=Chyba v analýze skriptu -Name[csb]=Fela ewaluacëji skriptu -Name[da]=Fejl under evaluering af script -Name[de]=Fehler bei der Auswertung des Skripts -Name[el]=Σφάλμα αποτίμησης σεναρίου -Name[en_GB]=Script Evaluation Error -Name[eo]=Eraro pri takso de skripto -Name[es]=Error de evaluación del script -Name[et]=Viga skripti hindamisel -Name[eu]=Script ebaluazioko errorea -Name[fa]=خطا در ارزیابی دست‌نوشته -Name[fi]=Skriptinsuoritusvirhe -Name[fr]=Erreur d'évaluation du script -Name[fy]=Skript beoardiel flater -Name[ga]=Earráid agus Script á Luacháil -Name[gl]=Erro na avaliación do script -Name[gu]=સ્ક્રિપ્ટ ચકાસણી ક્ષતિ -Name[he]=שגיאה בעת פענוח התסריט -Name[hi]=स्क्रिप्ट परीक्षण त्रुटि -Name[hne]=स्क्रिप्ट परीक्छन गलती -Name[hr]=Pogreška pri procjenjivanju skripte -Name[hsb]=Zmylk při wuwjedźenju skripta -Name[hu]=Szkriptkiértékelési hiba -Name[hy]=Գրի գնահատման սխալ -Name[ia]=Error de evalutation del script -Name[id]=Galat Evaluasi Skrip -Name[is]=Villa við túlkun skriftu -Name[it]=Errore di valutazione script -Name[ja]=スクリプト評価エラー -Name[kk]=Скриптті орындау қатесі -Name[km]=កំហុស​ក្នុង​ការ​វាយ​តម្លៃ​ស្គ្រីប -Name[kn]=ವಿಧಿಗುಚ್ಛ (ಸ್ಕ್ರಿಪ್ಟ್ ) ಮೌಲ್ಯಮಾಪನ ದೋಷ -Name[ko]=스크립트 계산 오류 -Name[ku]=Çewtiya Nirxandina Skrîptê -Name[lt]=Scenarijaus analizės klaida -Name[lv]=Skripta izpildes kļūda -Name[mai]=स्क्रिप्ट परीक्षण त्रुटि -Name[mk]=Грешка при евалуација на скриптата -Name[ml]=സ്ക്രിപ്റ്റിന്റെ മൂല്യനിര്‍ണ്ണയത്തില്‍ തെറ്റുണ്ടു് -Name[mr]=स्क्रिप्ट विश्लेषण त्रुटी -Name[nb]=Feil ved evaluering av skript -Name[nds]=Skript-Utföhrfehler -Name[ne]=स्क्रिप्ट मूल्याङ्कन त्रुटि -Name[nl]=Fout bij evalueren van script -Name[nn]=Feil ved skriptevaluering -Name[or]=ସ୍କ୍ରିପ୍ଟ ମୁଲ୍ୟାଙ୍କନ ତ୍ରୁଟି -Name[pa]=ਸਕ੍ਰਿਪਟ ਜਾਂਚ ਗਲਤੀ -Name[pl]=Błąd wykonywania skryptu -Name[pt]=Erro de Avaliação do Programa -Name[pt_BR]=Erro de avaliação do script -Name[ro]=Eroare de evaluare a scriptului -Name[ru]=Ошибка выполнения сценария -Name[se]=Skriptadulkonmeattáhus -Name[sk]=Chyba vykonávania skriptu -Name[sl]=Napaka med ovrednotenjem skripta -Name[sr]=Грешка у извршавању скрипте -Name[sr@ijekavian]=Грешка у извршавању скрипте -Name[sr@ijekavianlatin]=Greška u izvršavanju skripte -Name[sr@latin]=Greška u izvršavanju skripte -Name[sv]=Utvärderingsfel för skript -Name[ta]=குறுநிரல் மதிப்பீட்டுப் பிழை -Name[te]=స్క్రిప్ట్ నిర్వహణ దోషం -Name[tg]=Хатои арзёбии дастнавис -Name[th]=การเรียกใช้สคริปต์เกิดข้อผิดพลาด -Name[tr]=Betik Çalıştırma Hatası -Name[tt]=Скрипт эчтәлегендә хата -Name[ug]=قوليازما ئىجرا قىلىش خاتالىقى -Name[uk]=Помилка оцінки скрипту -Name[vi]=Lỗi thử đúng mã lệnh -Name[wa]=Aroke di préjhaedje do scripe -Name[x-test]=xxScript Evaluation Errorxx -Name[zh_CN]=脚本执行错误 -Name[zh_TW]=文稿執行錯誤 -Comment=There was an error executing the proxy configuration script -Comment[af]=Daar was 'n fout met die uitvoer van die proksie opstelskrip -Comment[ar]=يوجد خطأ في تنفيذ سكربت إعدادات الوكيل -Comment[as]=নিযুক্তক বিন্যাসৰ স্ক্ৰিপ্ট চলাওঁতে ভুল -Comment[ast]=Hebo un error executando'l guión de configuración del proxy -Comment[be]=Адбылася памылка выканання сцэнару настаўлення проксі -Comment[be@latin]=Padčas vykanańnia skrypta naładžvańnia proxy ŭźnikła pamyłka. -Comment[bg]=Възникна грешка при изпълнение на скрипта за настройка на посредник -Comment[bn]=প্রক্সি কনফিগারেশন স্ক্রিপ্ট চালাতে সমস্যা দেখা দিয়েছে -Comment[bn_IN]=প্রক্সি কনফিগারেশনের স্ক্রিপ্ট সঞ্চালনে সমস্যা -Comment[br]=Degouezhet ez eus ur fazi en ur seveniñ urzhiaoug kefluniadur ar proksi -Comment[bs]=Greška tokom izvršavanja skripte postave proksija -Comment[ca]=S'ha produït un error en executar l'script de configuració de l'intermediari -Comment[ca@valencia]=Hi ha hagut un error en executar l'script de configuració de l'intermediari -Comment[cs]=Nastala chyba při spouštění konfiguračního skriptu proxy -Comment[csb]=Wëstąpiła fela przë zrëszaniém skriptu kònfigùracëji pòstrzédnika -Comment[cy]=Digwyddodd gwall wrth weithredu'r sgript ffurfweddu'r dirprwy -Comment[da]=Der opstod en fejl ved kørslen af proxy-indstillingsscriptet -Comment[de]=Beim Ausführen des Skripts zur Proxy-Konfiguration ist ein Fehler aufgetreten. -Comment[el]=Παρουσιάστηκε σφάλμα κατά την εκτέλεση του σεναρίου ρύθμισης του διαμεσολαβητή -Comment[en_GB]=There was an error executing the proxy configuration script -Comment[eo]=Eraro okazis pri plenumo de la prokura agordoskripto -Comment[es]=Ocurrió un error al ejecutar el script de configuración del proxy -Comment[et]=Ilmnes tõsine viga puhverserveri seadistuse skripti käivitamisel -Comment[eu]=Errorea gertatu da ordezkaria konfiguratzeko script-a exekutatzerakoan -Comment[fa]=خطایی در اجرای دست‌نوشتهٔ پیکربندی پیشکار وجود داشت -Comment[fi]=Välityspalvelimen asetuskriptin suorittamisessa tapahtui virhe -Comment[fr]=Une erreur s'est produite lors de l'exécution du script de configuration du serveur mandataire (proxy) -Comment[fy]=Der wie in flater by it útfoeren fan de proxy ynstellings skript -Comment[ga]=Tharla earráid agus script chumraíocht an tseachfhreastalaí á rith -Comment[gl]=Produciuse un erro ao executar o script de configuración do proxy -Comment[gu]=પ્રોક્સી રૂપરેખાંકન સ્ક્રિપ્ટ ચલાવવામાં ક્ષતિ હતી -Comment[he]=אירעה שגיאה בעת ההפעלה של תסריט הגדרת השרת המתווך -Comment[hi]=प्रॉक्सी कॉन्फ़िगरेशन स्क्रिप्ट को चलाने के दौरान एक त्रुटि हुई -Comment[hne]=प्राक्सी कान्फिगरेसन स्क्रिप्ट ल चलाय के समय एक गलती होइस -Comment[hr]=Došlo je do pogreške pri izvršavanju skripte za konfiguraciju proxyja -Comment[hsb]=Při wuwjedźenju konfiguraciskeho skripta za proxy je so zmylk stał -Comment[hu]=Hiba történt a proxyszkript végrehajtása közben -Comment[hy]=Փոխարինող ձեւավորման գրի կատարելու ժամանակ սխալ կար -Comment[ia]=Il esseva un error durante que il executava le proxy de configuration del script -Comment[id]=Ada galat ketika mengeksekusi skrip konfigurasi proxy -Comment[is]=Það kom upp villa við keyrslu stillingaskriftu vefsels -Comment[it]=Si è verificato un errore durante l'esecuzione dello script di configurazione proxy -Comment[ja]=プロキシ設定スクリプトの実行でエラーが発生しました -Comment[kk]=Проксиді баптау скриптін орындау қатесі -Comment[km]=មាន​កំហុស​ក្នុង​ការ​ប្រតិបត្តិ​ស្គ្រីប​កំណត់​រចនា​សម្ព័ន្ធ​ប្រូកស៊ី -Comment[kn]=ಪ್ರಾತಿನಿಧಿಕದ (ಪ್ರಾಕ್ಸಿ) ಸಂರಚನಾ ವಿಧಿಗುಚ್ಛವನ್ನು (ಸ್ಕ್ರಿಪ್ಟ್) ಅನ್ನು ಚಾಲಯಿಸುವಾಗ ದೋಷ ಕಂಡುಬಂದಿತು -Comment[ko]=프록시 설정 스크립트를 실행하는 중 오류가 발생했습니다 -Comment[ku]=Di sepandina skrîpta veavakirina proxy de çewtiyek çê bû -Comment[lb]=Et gouf e Feeler beim Ausféiere vum Proxy-Konfiguratiounsskript -Comment[lt]=Paleidžiant proxy derinimo scenarijų įvyko klaida -Comment[lv]=Gadījās kļūda izpildot starpniekservera konfigurēšanas skriptu -Comment[mai]=प्राक्सी बिन्यास स्क्रिप्ट केँ चलाबै केर काले एकटा त्रुटि भेल -Comment[mk]=Имаше грешка при извршувањето на скриптата за конфигурација на прокси -Comment[ml]=പ്രോക്സി സജ്ജീകരിക്കുന്ന സ്ക്രിപ്റ്റ് പ്രവര്‍ത്തിപ്പിയ്ക്കുമ്പോള്‍ തെറ്റുണ്ടായി -Comment[mr]=प्रतिनिधि संयोजना स्क्रिप्ट चालवितेवेळी त्रुटी आढळली -Comment[ms]=Terdapat ralat melaksanakan skrip penyelarasan proksi -Comment[nb]=Det oppsto en feil ved kjøring av skriptet for mellomtjeneroppsett -Comment[nds]=Bi't Utföhren vun't Proxy-Instellskript geev dat en Fehler -Comment[ne]=त्यहाँ प्रोक्सी कन्फिगरेसन स्क्रिप्ट कार्यान्वयन गर्दा एउटा त्रुटि थियो -Comment[nl]=Er deed zich een fout voor tijdens het uitvoeren van het script met de proxyconfiguratie -Comment[nn]=Det oppstod ein feil ved køyring av skriptet for automatisk mellomtenaroppsett -Comment[or]=ଛାୟା ବିନ୍ୟାସ ସ୍କ୍ରିପ୍ଟ ନିଷ୍ପାଦନ କରିବା ସମୟରେ ତ୍ରୁଟି -Comment[pa]=ਪਰਾਕਸੀ ਸੰਰਚਨਾ ਸਕ੍ਰਿਪਟ ਚਲਾਉਣ ਦੌਰਾਨ ਗਲਤੀ ਹੈ -Comment[pl]=Wystąpił błąd w czasie wykonywania skryptu ustawień pośrednika -Comment[ps]=د ګوډاګي سازونې سکرېپټ په چلولو کې ستونزه رامنځته شوه -Comment[pt]=Ocorreu um erro ao executar o programa de configuração do 'proxy' -Comment[pt_BR]=Houve um erro ao executar o script de configuração do proxy -Comment[ro]=A apărut o eroare la execuția scriptului de configurare proxy -Comment[ru]=Ошибка при выполнении сценария настройки прокси-сервера -Comment[se]=Meattáhus čuožžilii go vujii gaskabálváheivehanskripta -Comment[sk]=Nastala chyba pri spúšťaní konfiguračného skriptu pre proxy -Comment[sl]=Prišlo je do napake med izvajanjem nastavitvenega skripta posredniškega strežnika -Comment[sr]=Грешка током извршавања скрипте поставе проксија -Comment[sr@ijekavian]=Грешка током извршавања скрипте поставе проксија -Comment[sr@ijekavianlatin]=Greška tokom izvršavanja skripte postave proksija -Comment[sr@latin]=Greška tokom izvršavanja skripte postave proksija -Comment[sv]=Fel uppstod vid körning av proxyinställningsskriptet -Comment[ta]=மாற்று வடிவமைப்பு குறுநிரலை செயல்படுத்தும்போது பிழை நேர்ந்தது -Comment[te]=ప్రాక్సీ రూపకరణపు స్క్రిప్ట్ నిర్వహణలొ దోషం వున్నది -Comment[tg]=Ҳангоми иҷрокунии дастнависи танзимшавандаи proxy хато пайдо шуд -Comment[th]=เกิดข้อผิดพลาดขึ้นในการเรียกประมวลผลสคริปต์ปรับแต่งพร็อกซี -Comment[tr]=Vekil sunucu yapılandırma dosyası çalıştırılamadı -Comment[tt]=Прокси көйләүченең скриптын җибәргәндә ялгыш килеп чыкты -Comment[ug]=ۋاكالەتچى سەپلىمە قوليازمىسىنى ئىجرا قىلغاندا خاتالىق كۆرۈلدى -Comment[uk]=Помилка запуску скрипту налаштування проксі -Comment[uz]=Proksini moslash uchun skriptni ishga tushirishda xato roʻy berdi -Comment[uz@cyrillic]=Проксини мослаш учун скриптни ишга туширишда хато рўй берди -Comment[vi]=Có lỗi khi thực thi mã lệnh cấu hình proxy -Comment[wa]=Åk n' a nén stî come dj' enondéve li scripe d' apontiaedje do procsi -Comment[x-test]=xxThere was an error executing the proxy configuration scriptxx -Comment[zh_CN]=执行代理配置脚本时出错 -Comment[zh_HK]=代理伺服器組態檔案執行錯誤 -Comment[zh_TW]=執行代理組態文稿時發生錯誤 - diff --git a/kio/misc/kpac/script.cpp b/kio/misc/kpac/script.cpp deleted file mode 100644 index a5b4eb56..00000000 --- a/kio/misc/kpac/script.cpp +++ /dev/null @@ -1,759 +0,0 @@ -/* - Copyright (c) 2003 Malte Starostik - Copyright (c) 2011 Dawit Alemayehu - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License 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 Library 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 "script.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -namespace -{ - static int findString (const QString& s, const char* const* values) - { - int index = 0; - const QString lower = s.toLower(); - for (const char* const* p = values; *p; ++p, ++index) { - if (s.compare(QLatin1String(*p), Qt::CaseInsensitive) == 0) { - return index; - } - } - return -1; - } - - static const QDateTime getTime (QScriptContext* context) - { - const QString tz = context->argument(context->argumentCount() - 1).toString(); - if (tz.compare(QLatin1String("gmt"), Qt::CaseInsensitive) == 0) { - return QDateTime::currentDateTimeUtc(); - } - return QDateTime::currentDateTime(); - } - - template - static bool checkRange (T value, T min, T max) - { - return ((min <= max && value >= min && value <= max) || - (min > max && (value <= min || value >= max))); - } - - static bool isLocalHostAddress (const QHostAddress& address) - { - if (address == QHostAddress::LocalHost) - return true; - - if (address == QHostAddress::LocalHostIPv6) - return true; - - return false; - } - - static bool isIPv6Address (const QHostAddress& address) - { - return address.protocol() == QAbstractSocket::IPv6Protocol; - } - - static bool isIPv4Address (const QHostAddress& address) - { - return (address.protocol() == QAbstractSocket::IPv4Protocol); - } - - static bool isSpecialAddress(const QHostAddress& address) - { - // Catch all the special addresses and return false. - if (address == QHostAddress::Null) - return true; - - if (address == QHostAddress::Any) - return true; - - if (address == QHostAddress::AnyIPv6) - return true; - - if (address == QHostAddress::Broadcast) - return true; - - return false; - } - - static bool addressLessThanComparison(const QHostAddress& addr1, const QHostAddress& addr2) - { - if (addr1.protocol() == QAbstractSocket::IPv4Protocol && - addr2.protocol() == QAbstractSocket::IPv4Protocol) { - return addr1.toIPv4Address() < addr2.toIPv4Address(); - } - - if (addr1.protocol() == QAbstractSocket::IPv6Protocol && - addr2.protocol() == QAbstractSocket::IPv6Protocol) { - const Q_IPV6ADDR ipv6addr1 = addr1.toIPv6Address(); - const Q_IPV6ADDR ipv6addr2 = addr2.toIPv6Address(); - for (int i=0; i < 16; ++i) { - if (ipv6addr1[i] != ipv6addr2[i]) { - return ((ipv6addr1[i] & 0xff) - (ipv6addr2[i] & 0xff)); - } - } - } - - return false; - } - - static QString addressListToString(const QList& addressList, - const QHash& actualEntryMap) - { - QString result; - Q_FOREACH(const QHostAddress& address, addressList) { - if (!result.isEmpty()) { - result += QLatin1Char(';'); - } - result += actualEntryMap.value(address.toString()); - } - return result; - } - - class Address - { - public: - struct Error {}; - static Address resolve( const QString& host ) - { - return Address( host ); - } - - QList addresses() const - { - return m_addressList; - } - - QHostAddress address() const - { - if (m_addressList.isEmpty()) - return QHostAddress(); - - return m_addressList.first(); - } - - private: - Address( const QString& host ) - { - // Always try to see if it's already an IP first, to avoid Qt doing a - // needless reverse lookup - QHostAddress address ( host ); - if ( address.isNull() ) { - QHostInfo hostInfo = QHostInfo::fromName(host); - m_addressList = hostInfo.addresses(); - } else { - m_addressList.clear(); - m_addressList.append(address); - } - } - - QList m_addressList; - }; - - - // isPlainHostName(host) - // @returns true if @p host doesn't contains a domain part - QScriptValue IsPlainHostName(QScriptContext* context, QScriptEngine* engine) - { - if (context->argumentCount() != 1) { - return engine->undefinedValue(); - } - return engine->toScriptValue(context->argument(0).toString().indexOf(QLatin1Char('.')) == -1); - } - - // dnsDomainIs(host, domain) - // @returns true if the domain part of @p host matches @p domain - QScriptValue DNSDomainIs (QScriptContext* context, QScriptEngine* engine) - { - if (context->argumentCount() != 2) { - return engine->undefinedValue(); - } - - const QString host = context->argument(0).toString(); - const QString domain = context->argument(1).toString(); - return engine->toScriptValue(host.endsWith(domain, Qt::CaseInsensitive)); - } - - // localHostOrDomainIs(host, fqdn) - // @returns true if @p host is unqualified or equals @p fqdn - QScriptValue LocalHostOrDomainIs (QScriptContext* context, QScriptEngine* engine) - { - if (context->argumentCount() != 2) { - return engine->undefinedValue(); - } - - const QString host = context->argument(0).toString(); - if (!host.contains(QLatin1Char('.'))) { - return engine->toScriptValue(true); - } - const QString fqdn = context->argument(1).toString(); - return engine->toScriptValue((host.compare(fqdn, Qt::CaseInsensitive) == 0)); - } - - // isResolvable(host) - // @returns true if host is resolvable to a IPv4 address. - QScriptValue IsResolvable (QScriptContext* context, QScriptEngine* engine) - { - if (context->argumentCount() != 1) { - return engine->undefinedValue(); - } - - try { - const Address info = Address::resolve(context->argument(0).toString()); - bool hasResolvableIPv4Address = false; - - Q_FOREACH(const QHostAddress& address, info.addresses()) { - if (!isSpecialAddress(address) && isIPv4Address(address)) { - hasResolvableIPv4Address = true; - break; - } - } - - return engine->toScriptValue(hasResolvableIPv4Address); - } - catch (const Address::Error&) { - return engine->toScriptValue(false); - } - } - - // isInNet(host, subnet, mask) - // @returns true if the IPv4 address of host is within the specified subnet - // and mask, false otherwise. - QScriptValue IsInNet (QScriptContext* context, QScriptEngine* engine) - { - if (context->argumentCount() != 3) { - return engine->undefinedValue(); - } - - try { - const Address info = Address::resolve(context->argument(0).toString()); - bool isInSubNet = false; - QString subnetStr = context->argument(1).toString(); - subnetStr += QLatin1Char('/'); - subnetStr += context->argument(2).toString(); - const QPair subnet = QHostAddress::parseSubnet(subnetStr); - Q_FOREACH(const QHostAddress& address, info.addresses()) { - if (!isSpecialAddress(address) && isIPv4Address(address) && address.isInSubnet(subnet)) { - isInSubNet = true; - break; - } - } - return engine->toScriptValue(isInSubNet); - } - catch (const Address::Error&) { - return engine->toScriptValue(false); - } - } - - // dnsResolve(host) - // @returns the IPv4 address for host or an empty string if host is not resolvable. - QScriptValue DNSResolve (QScriptContext* context, QScriptEngine* engine) - { - if (context->argumentCount() != 1) { - return engine->undefinedValue(); - } - - try { - const Address info = Address::resolve(context->argument(0).toString()); - QString resolvedAddress (QLatin1String("")); - Q_FOREACH(const QHostAddress& address, info.addresses()) { - if (!isSpecialAddress(address) && isIPv4Address(address)) { - resolvedAddress = address.toString(); - break; - } - } - return engine->toScriptValue(resolvedAddress); - } - catch (const Address::Error&) { - return engine->toScriptValue(QString(QLatin1String(""))); - } - } - - // myIpAddress() - // @returns the local machine's IPv4 address. Note that this will return - // the address for the first interfaces that match its criteria even if the - // machine has multiple interfaces. - QScriptValue MyIpAddress (QScriptContext* context, QScriptEngine* engine) - { - if (context->argumentCount()) { - return engine->undefinedValue(); - } - - QString ipAddress; - const QList addresses = QNetworkInterface::allAddresses(); - Q_FOREACH(const QHostAddress address, addresses) { - if (isIPv4Address(address) && !isSpecialAddress(address) && !isLocalHostAddress(address)) { - ipAddress = address.toString(); - break; - } - } - - return engine->toScriptValue(ipAddress); - } - - // dnsDomainLevels(host) - // @returns the number of dots ('.') in @p host - QScriptValue DNSDomainLevels (QScriptContext* context, QScriptEngine* engine) - { - if (context->argumentCount() != 1) { - return engine->undefinedValue(); - } - - const QString host = context->argument(0).toString(); - if (host.isNull()) { - return engine->toScriptValue(0); - } - - return engine->toScriptValue(host.count(QLatin1Char('.'))); - } - - // shExpMatch(str, pattern) - // @returns true if @p str matches the shell @p pattern - QScriptValue ShExpMatch (QScriptContext* context, QScriptEngine* engine) - { - if (context->argumentCount() != 2) { - return engine->undefinedValue(); - } - - QRegExp pattern(context->argument(1).toString(), Qt::CaseSensitive, QRegExp::Wildcard); - return engine->toScriptValue(pattern.exactMatch(context->argument(0).toString())); - } - - // weekdayRange(day [, "GMT" ]) - // weekdayRange(day1, day2 [, "GMT" ]) - // @returns true if the current day equals day or between day1 and day2 resp. - // If the last argument is "GMT", GMT timezone is used, otherwise local time - QScriptValue WeekdayRange (QScriptContext* context, QScriptEngine* engine) - { - if (context->argumentCount() < 1 || context->argumentCount() > 3) { - return engine->undefinedValue(); - } - - static const char* const days[] = { "sun", "mon", "tue", "wed", "thu", "fri", "sat", 0 }; - - const int d1 = findString(context->argument(0).toString(), days); - if (d1 == -1) { - return engine->undefinedValue(); - } - - int d2 = findString(context->argument(1).toString(), days); - if (d2 == -1) { - d2 = d1; - } - - // Adjust the days of week coming from QDateTime since it starts - // counting with Monday as 1 and ends with Sunday as day 7. - int dayOfWeek = getTime(context).date().dayOfWeek(); - if (dayOfWeek == 7) { - dayOfWeek = 0; - } - return engine->toScriptValue(checkRange(dayOfWeek, d1, d2)); - } - - // dateRange(day [, "GMT" ]) - // dateRange(day1, day2 [, "GMT" ]) - // dateRange(month [, "GMT" ]) - // dateRange(month1, month2 [, "GMT" ]) - // dateRange(year [, "GMT" ]) - // dateRange(year1, year2 [, "GMT" ]) - // dateRange(day1, month1, day2, month2 [, "GMT" ]) - // dateRange(month1, year1, month2, year2 [, "GMT" ]) - // dateRange(day1, month1, year1, day2, month2, year2 [, "GMT" ]) - // @returns true if the current date (GMT or local time according to - // presence of "GMT" as last argument) is within the given range - QScriptValue DateRange (QScriptContext* context, QScriptEngine* engine) - { - if (context->argumentCount() < 1 || context->argumentCount() > 7) { - return engine->undefinedValue(); - } - - static const char* const months[] = { "jan", "feb", "mar", "apr", "may", "jun", - "jul", "aug", "sep", "oct", "nov", "dec", 0 }; - - QVector values; - for (int i = 0; i < context->argumentCount(); ++i) - { - int value = -1; - if (context->argument(i).isNumber()) { - value = context->argument(i).toInt32(); - } else { - // QDate starts counting months from 1, so we add 1 here. - value = findString(context->argument(i).toString(), months) + 1; - } - - if (value > 0) { - values.append(value); - } else { - break; - } - } - - const QDate now = getTime(context).date(); - - // day1, month1, year1, day2, month2, year2 - if (values.size() == 6) { - const QDate d1 (values[2], values[1], values[0]); - const QDate d2 (values[5], values[4], values[3]); - return engine->toScriptValue(checkRange(now, d1, d2)); - } - // day1, month1, day2, month2 - else if (values.size() == 4 && values[ 1 ] < 13 && values[ 3 ] < 13) { - const QDate d1 (now.year(), values[1], values[0]); - const QDate d2 (now.year(), values[3], values[2]); - return engine->toScriptValue(checkRange(now, d1, d2)); - } - // month1, year1, month2, year2 - else if (values.size() == 4) { - const QDate d1 (values[1], values[0], now.day()); - const QDate d2 (values[3], values[2], now.day()); - return engine->toScriptValue(checkRange(now, d1, d2)); - } - // year1, year2 - else if (values.size() == 2 && values[0] >= 1000 && values[1] >= 1000) { - return engine->toScriptValue(checkRange(now.year(), values[0], values[1])); - } - // day1, day2 - else if (values.size() == 2 && context->argument(0).isNumber() && context->argument(1).isNumber()) { - return engine->toScriptValue(checkRange(now.day(), values[0], values[1])); - } - // month1, month2 - else if (values.size() == 2) { - return engine->toScriptValue(checkRange(now.month(), values[0], values[1])); - } - // year - else if (values.size() == 1 && values[ 0 ] >= 1000) { - return engine->toScriptValue(checkRange(now.year(), values[0], values[0])); - } - // day - else if (values.size() == 1 && context->argument(0).isNumber()) { - return engine->toScriptValue(checkRange(now.day(), values[0], values[0])); - } - // month - else if (values.size() == 1) { - return engine->toScriptValue(checkRange(now.month(), values[0], values[0])); - } - - return engine->undefinedValue(); - } - - // timeRange(hour [, "GMT" ]) - // timeRange(hour1, hour2 [, "GMT" ]) - // timeRange(hour1, min1, hour2, min2 [, "GMT" ]) - // timeRange(hour1, min1, sec1, hour2, min2, sec2 [, "GMT" ]) - // @returns true if the current time (GMT or local based on presence - // of "GMT" argument) is within the given range - QScriptValue TimeRange (QScriptContext* context, QScriptEngine* engine) - { - if (context->argumentCount() < 1 || context->argumentCount() > 7) { - return engine->undefinedValue(); - } - - QVector values; - for (int i = 0; i < context->argumentCount(); ++i) { - if (!context->argument(i).isNumber()) { - break; - } - values.append(context->argument(i).toNumber()); - } - - const QTime now = getTime(context).time(); - - // hour1, min1, sec1, hour2, min2, sec2 - if (values.size() == 6) { - const QTime t1 (values[0], values[1], values[2]); - const QTime t2 (values[3], values[4], values[5]); - return engine->toScriptValue(checkRange(now, t1, t2)); - } - // hour1, min1, hour2, min2 - else if (values.size() == 4) { - const QTime t1 (values[0], values[1]); - const QTime t2 (values[2], values[3]); - return engine->toScriptValue(checkRange(now, t1, t2)); - } - // hour1, hour2 - else if (values.size() == 2) { - return engine->toScriptValue(checkRange(now.hour(), values[0], values[1])); - } - // hour - else if (values.size() == 1) { - return engine->toScriptValue(checkRange(now.hour(), values[0], values[0])); - } - - return engine->undefinedValue(); - } - - - /* - * Implementation of Microsoft's IPv6 Extension for PAC - * - * Documentation: - * http://msdn.microsoft.com/en-us/library/gg308477(v=vs.85).aspx - * http://msdn.microsoft.com/en-us/library/gg308478(v=vs.85).aspx - * http://msdn.microsoft.com/en-us/library/gg308474(v=vs.85).aspx - * http://blogs.msdn.com/b/wndp/archive/2006/07/13/ipv6-pac-extensions-v0-9.aspx - */ - - // isResolvableEx(host) - // @returns true if host is resolvable to an IPv4 or IPv6 address. - QScriptValue IsResolvableEx (QScriptContext* context, QScriptEngine* engine) - { - if (context->argumentCount() != 1) { - return engine->undefinedValue(); - } - - try { - const Address info = Address::resolve(context->argument(0).toString()); - bool hasResolvableIPAddress = false; - Q_FOREACH(const QHostAddress& address, info.addresses()) { - if (isIPv4Address(address) || isIPv6Address(address)) { - hasResolvableIPAddress = true; - break; - } - } - return engine->toScriptValue(hasResolvableIPAddress); - } - catch (const Address::Error&) { - return engine->toScriptValue(false); - } - } - - // isInNetEx(ipAddress, ipPrefix ) - // @returns true if ipAddress is within the specified ipPrefix. - QScriptValue IsInNetEx (QScriptContext* context, QScriptEngine* engine) - { - if (context->argumentCount() != 2) { - return engine->undefinedValue(); - } - - try { - const Address info = Address::resolve(context->argument(0).toString()); - bool isInSubNet = false; - const QString subnetStr = context->argument(1).toString(); - const QPair subnet = QHostAddress::parseSubnet(subnetStr); - - Q_FOREACH(const QHostAddress& address, info.addresses()) { - if (isSpecialAddress(address)) { - continue; - } - - if (address.isInSubnet(subnet)) { - isInSubNet = true; - break; - } - } - return engine->toScriptValue(isInSubNet); - } - catch (const Address::Error&) { - return engine->toScriptValue(false); - } - } - - // dnsResolveEx(host) - // @returns a semi-colon delimited string containing IPv6 and IPv4 addresses - // for host or an empty string if host is not resolvable. - QScriptValue DNSResolveEx (QScriptContext* context, QScriptEngine* engine) - { - if (context->argumentCount() != 1) { - return engine->undefinedValue(); - } - - try { - const Address info = Address::resolve (context->argument(0).toString()); - - QStringList addressList; - QString resolvedAddress (QLatin1String("")); - - Q_FOREACH(const QHostAddress& address, info.addresses()) { - if (!isSpecialAddress(address)) { - addressList << address.toString(); - } - } - if (!addressList.isEmpty()) { - resolvedAddress = addressList.join(QLatin1String(";")); - } - - return engine->toScriptValue(resolvedAddress); - } - catch (const Address::Error&) { - return engine->toScriptValue(QString(QLatin1String(""))); - } - } - - // myIpAddressEx() - // @returns a semi-colon delimited string containing all IP addresses for localhost (IPv6 and/or IPv4), - // or an empty string if unable to resolve localhost to an IP address. - QScriptValue MyIpAddressEx (QScriptContext* context, QScriptEngine* engine) - { - if (context->argumentCount()) { - return engine->undefinedValue(); - } - - QStringList ipAddressList; - const QList addresses = QNetworkInterface::allAddresses(); - Q_FOREACH(const QHostAddress address, addresses) { - if (!isSpecialAddress(address) && !isLocalHostAddress(address)) { - ipAddressList << address.toString(); - } - } - - return engine->toScriptValue(ipAddressList.join(QLatin1String(";"))); - } - - // sortIpAddressList(ipAddressList) - // @returns a sorted ipAddressList. If both IPv4 and IPv6 addresses are present in - // the list. The sorted IPv6 addresses will precede the sorted IPv4 addresses. - QScriptValue SortIpAddressList(QScriptContext* context, QScriptEngine* engine) - { - if (context->argumentCount() != 1) { - return engine->undefinedValue(); - } - - QHash actualEntryMap; - QList ipV4List, ipV6List; - const QStringList ipAddressList = context->argument(0).toString().split(QLatin1Char(';')); - - Q_FOREACH(const QString& ipAddress, ipAddressList) { - QHostAddress address(ipAddress); - switch (address.protocol()) { - case QAbstractSocket::IPv4Protocol: - ipV4List << address; - actualEntryMap.insert(address.toString(), ipAddress); - break; - case QAbstractSocket::IPv6Protocol: - ipV6List << address; - actualEntryMap.insert(address.toString(), ipAddress); - break; - default: - break; - } - } - - QString sortedAddress (QLatin1String("")); - - if (!ipV6List.isEmpty()) { - qSort(ipV6List.begin(), ipV6List.end(), addressLessThanComparison); - sortedAddress += addressListToString(ipV6List, actualEntryMap); - } - - if (!ipV4List.isEmpty()) { - qSort(ipV4List.begin(), ipV4List.end(), addressLessThanComparison); - if (!sortedAddress.isEmpty()) { - sortedAddress += QLatin1Char(';'); - } - sortedAddress += addressListToString(ipV4List, actualEntryMap); - } - - return engine->toScriptValue(sortedAddress); - - } - - // getClientVersion - // @return the version number of this engine for future extension. We too start - // this at version 1.0. - QScriptValue GetClientVersion (QScriptContext* context, QScriptEngine* engine) - { - if (context->argumentCount()) { - return engine->undefinedValue(); - } - - const QString version (QLatin1String("1.0")); - return engine->toScriptValue(version); - } - - void registerFunctions(QScriptEngine* engine) - { - QScriptValue value = engine->globalObject(); - value.setProperty(QLatin1String("isPlainHostName"), engine->newFunction(IsPlainHostName)); - value.setProperty(QLatin1String("dnsDomainIs"), engine->newFunction(DNSDomainIs)); - value.setProperty(QLatin1String("localHostOrDomainIs"), engine->newFunction(LocalHostOrDomainIs)); - value.setProperty(QLatin1String("isResolvable"), engine->newFunction(IsResolvable)); - value.setProperty(QLatin1String("isInNet"), engine->newFunction(IsInNet)); - value.setProperty(QLatin1String("dnsResolve"), engine->newFunction(DNSResolve)); - value.setProperty(QLatin1String("myIpAddress"), engine->newFunction(MyIpAddress)); - value.setProperty(QLatin1String("dnsDomainLevels"), engine->newFunction(DNSDomainLevels)); - value.setProperty(QLatin1String("shExpMatch"), engine->newFunction(ShExpMatch)); - value.setProperty(QLatin1String("weekdayRange"), engine->newFunction(WeekdayRange)); - value.setProperty(QLatin1String("dateRange"), engine->newFunction(DateRange)); - value.setProperty(QLatin1String("timeRange"), engine->newFunction(TimeRange)); - - // Microsoft's IPv6 PAC Extensions... - value.setProperty(QLatin1String("isResolvableEx"), engine->newFunction(IsResolvableEx)); - value.setProperty(QLatin1String("isInNetEx"), engine->newFunction(IsInNetEx)); - value.setProperty(QLatin1String("dnsResolveEx"), engine->newFunction(DNSResolveEx)); - value.setProperty(QLatin1String("myIpAddressEx"), engine->newFunction(MyIpAddressEx)); - value.setProperty(QLatin1String("sortIpAddressList"), engine->newFunction(SortIpAddressList)); - value.setProperty(QLatin1String("getClientVersion"), engine->newFunction(GetClientVersion)); - } -} - -namespace KPAC -{ - Script::Script(const QString& code) - { - m_engine = new QScriptEngine; - registerFunctions(m_engine); - - const QScriptValue result = m_engine->evaluate(code); - if (m_engine->hasUncaughtException() || result.isError()) - throw Error(m_engine->uncaughtException().toString()); - } - - Script::~Script() - { - delete m_engine; - } - - QString Script::evaluate(const KUrl& url) - { - QScriptValue func = m_engine->globalObject().property(QLatin1String("FindProxyForURL")); - - if (!func.isValid()) { - func = m_engine->globalObject().property(QLatin1String("FindProxyForURLEx")); - if (!func.isValid()) { - throw Error(i18n("Could not find 'FindProxyForURL' or 'FindProxyForURLEx'")); - return QString(); - } - } - - QScriptValueList args; - args << url.url(); - args << url.host(); - - QScriptValue result = func.call(QScriptValue(), args); - if (result.isError()) { - throw Error(i18n("Got an invalid reply when calling %1", func.toString())); - } - - return result.toString(); - } -} - -// vim: ts=4 sw=4 et diff --git a/kio/misc/kpac/script.h b/kio/misc/kpac/script.h deleted file mode 100644 index b2c56ee5..00000000 --- a/kio/misc/kpac/script.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - Copyright (c) 2003 Malte Starostik - Copyright (c) 2011 Dawit Alemayehu - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License 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 Library 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 KPAC_SCRIPT_H -#define KPAC_SCRIPT_H - -#include - -class KUrl; -#include - -namespace KPAC -{ - class Script - { - public: - class Error - { - public: - Error( const QString& message ) - : m_message( message ) {} - const QString& message() const { return m_message; } - - private: - QString m_message; - }; - - Script( const QString& code ); - ~Script(); - QString evaluate( const KUrl& ); - - private: - QScriptEngine* m_engine; - }; -} - -#endif // KPAC_SCRIPT_H - -// vim: ts=4 sw=4 et