diff options
author | Daniel Molkentin <daniel@molkentin.de> | 2015-01-27 18:41:32 +0100 |
---|---|---|
committer | Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> | 2015-02-05 14:29:03 +0000 |
commit | 3430e7ce7787cf1c1b1472a0ce0e8770dbff0a7c (patch) | |
tree | 60c0f6ef5b2c56a59d349eb48fcbea850ce1b762 /config.tests/common | |
parent | eb4f183127cb5c73fe84adc296fbc03fa8d61523 (diff) |
Add libproxy backend for QNetworkProxyFactory
It will be used on Unix systems if the required dev package is
present. (Detected by a configure compile test.)
You can configure with -no-libproxy to avoid the dependency.
It will not be used on OS X or Windows, as we already implement
the native API for getting proxies there.
Currently we use whatever PAC runner is provided by the distro
for running PAC scripts - if we want to run PAC scripts using
Qt, then we would have to implement a pacrunner plugin to libproxy.
Note that their webkit pacrunner is using javascriptcore already.
Tested using the libproxy 0.4.7 that is included in Ubuntu 12.04.
Re-tested using Ubuntu 14.04 which ships libproxy 0.4.11.
It works except when both socks and http proxies are configured in
the manual settings - in that case libproxy returns only the socks
proxy. This seems to be covered by libproxy issue 119.
[ChangeLog][QtNetwork] Introduce libproxy backend for Unix platforms,
enabled automatically if the required dev package is present
Task-number: QTBUG-26295
Change-Id: I521c0a198fcf482386ea8a189114a0077778265c
Reviewed-by: Richard J. Moore <rich@kde.org>
Diffstat (limited to 'config.tests/common')
-rw-r--r-- | config.tests/common/libproxy/libproxy.cpp | 59 | ||||
-rw-r--r-- | config.tests/common/libproxy/libproxy.pro | 4 |
2 files changed, 63 insertions, 0 deletions
diff --git a/config.tests/common/libproxy/libproxy.cpp b/config.tests/common/libproxy/libproxy.cpp new file mode 100644 index 0000000000..cd366f52ee --- /dev/null +++ b/config.tests/common/libproxy/libproxy.cpp @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <stdio.h> +#include <stdlib.h> +#include <proxy.h> + +int main(int, char **) +{ + pxProxyFactory *factory = px_proxy_factory_new(); + char **proxies = px_proxy_factory_get_proxies(factory, "http://qt-project.org"); + if (proxies) { + for (int i = 0; proxies[i]; i++) { + printf("%s\n", proxies[i]); + free(proxies[i]); + } + free(proxies); + } + px_proxy_factory_free(factory); + return 0; +} diff --git a/config.tests/common/libproxy/libproxy.pro b/config.tests/common/libproxy/libproxy.pro new file mode 100644 index 0000000000..51de2021ff --- /dev/null +++ b/config.tests/common/libproxy/libproxy.pro @@ -0,0 +1,4 @@ +SOURCES = libproxy.cpp +CONFIG -= qt dylib +mac:CONFIG -= app_bundle +LIBS += -lproxy |