QtNetwork: introduce configure switch to use system proxies by default

This option is opt-in (default: no). When configured with
"-proxies-system-default", Qt automatically picks up the system
proxies.

Change-Id: I8cc002f29587854f448d97117b08c43d8eedec76
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
Peter Hartmann 2012-10-23 15:31:20 +02:00 committed by The Qt Project
parent 3e52901641
commit f7893223e8
4 changed files with 42 additions and 1 deletions

21
configure vendored
View File

@ -785,6 +785,7 @@ CFG_JAVASCRIPTCORE_JIT=auto
CFG_PKGCONFIG=auto
CFG_STACK_PROTECTOR_STRONG=auto
CFG_SLOG2=auto
CFG_SYSTEM_PROXIES=no
# Target architecture
CFG_ARCH=
@ -1003,6 +1004,14 @@ while [ "$#" -gt 0 ]; do
VAR=`echo $1 | sed "s,^-\([^-]*\)-.*,\1,"`
VAL=`echo $1 | sed "s,^-[^-]*-\(.*\),\1,"`
;;
-system-proxies)
VAR=system-proxies
VAL=yes
;;
-no-system-proxies)
VAR=system-proxies
VAL=no
;;
#Qt Builtin/System style options
-no-*|-system-*|-qt-*)
VAR=`echo $1 | sed "s,^-[^-]*-\(.*\),\1,"`
@ -2090,6 +2099,13 @@ while [ "$#" -gt 0 ]; do
UNKNOWN_OPT=yes
fi
;;
system-proxies)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_SYSTEM_PROXIES="$VAL"
else
UNKNOWN_OPT=yes
fi
;;
*)
UNKNOWN_OPT=yes
;;
@ -3291,6 +3307,9 @@ Additional options:
OpenGL ES 2, or regular desktop OpenGL.
Use es2 for <api> to override auto-detection.
* -no-system-proxies .. Do not use system network proxies by default.
-system-proxies ..... Use system network proxies by default.
$GBN -no-glib ........... Do not compile Glib support.
$GBY -glib .............. Compile Glib support.
EOF
@ -5454,6 +5473,7 @@ fi
[ "$CFG_MAC_HARFBUZZ" = "yes" ] && QT_CONFIG="$QT_CONFIG harfbuzz"
[ "$CFG_XCB" = "yes" ] && QT_CONFIG="$QT_CONFIG xcb"
[ "$CFG_XINPUT2" = "yes" ] && QT_CONFIG="$QT_CONFIG xinput2"
[ "$CFG_SYSTEM_PROXIES" = "yes" ] && QT_CONFIG="$QT_CONFIG system-proxies"
[ '!' -z "$DEFINES" ] && QMakeVar add DEFINES "$DEFINES"
[ '!' -z "$L_FLAGS" ] && QMakeVar add LIBS "$L_FLAGS"
@ -6235,6 +6255,7 @@ echo "libudev support ........ $CFG_LIBUDEV"
if [ "$XPLATFORM_QNX" = "yes" ]; then
echo "SLOG2 support .......... $CFG_SLOG2"
fi
echo "Use system proxies ..... $CFG_SYSTEM_PROXIES"
if [ "$CFG_OPENGL" = "desktop" ]; then
echo "OpenGL support ......... yes (Desktop OpenGL)"

View File

@ -253,6 +253,9 @@ public:
, httpSocketEngineHandler(0)
#endif
{
#ifdef QT_USE_SYSTEM_PROXIES
setApplicationProxyFactory(new QSystemConfigurationProxyFactory);
#endif
#ifndef QT_NO_SOCKS5
socks5SocketEngineHandler = new QSocks5SocketEngineHandler();
#endif

View File

@ -60,3 +60,7 @@ integrity: {
DEFINES += QT_LOCALSOCKET_TCP
}
contains(QT_CONFIG, system-proxies) {
DEFINES += QT_USE_SYSTEM_PROXIES
}

View File

@ -236,6 +236,7 @@ Configure::Configure(int& argc, char** argv)
dictionary[ "QT_CUPS" ] = "auto";
dictionary[ "CFG_GCC_SYSROOT" ] = "yes";
dictionary[ "SLOG2" ] = "no";
dictionary[ "SYSTEM_PROXIES" ] = "no";
//Only used when cross compiling.
dictionary[ "QT_INSTALL_SETTINGS" ] = "/etc/xdg";
@ -877,6 +878,10 @@ void Configure::parseCmdLine()
dictionary[ "SLOG2" ] = "no";
} else if (configCmdLine.at(i) == "-slog2") {
dictionary[ "SLOG2" ] = "yes";
} else if (configCmdLine.at(i) == "-no-system-proxies") {
dictionary[ "SYSTEM_PROXIES" ] = "no";
} else if (configCmdLine.at(i) == "-system-proxies") {
dictionary[ "SYSTEM_PROXIES" ] = "yes";
}
// Work around compiler nesting limitation
@ -1682,6 +1687,10 @@ bool Configure::displayHelp()
desc("QT_INSTALL_SETTINGS", "auto", "-sysconfdir <dir>", "Settings used by Qt programs will be looked for in\n<dir>.\n");
desc("SYSTEM_PROXIES", "yes", "-system-proxies", "Use system network proxies by default.");
desc("SYSTEM_PROXIES", "no", "-no-system-proxies", "Do not use system network proxies by default.\n");
#if !defined(EVAL)
desc( "-qtnamespace <name>", "Wraps all Qt library code in 'namespace name {...}'.");
desc( "-qtlibinfix <infix>", "Renames all Qt* libs to Qt*<infix>.\n");
@ -2560,6 +2569,9 @@ void Configure::generateOutputVars()
if (dictionary[ "V8SNAPSHOT" ] == "yes")
qtConfig += "v8snapshot";
if (dictionary[ "SYSTEM_PROXIES" ] == "yes")
qtConfig += "system-proxies";
// Add config levels --------------------------------------------
QStringList possible_configs = QStringList()
<< "minimal"
@ -3328,7 +3340,8 @@ void Configure::displayConfig()
sout << "QtDBus support.............." << dictionary[ "DBUS" ] << endl;
sout << "QtWidgets module support...." << dictionary[ "WIDGETS" ] << endl;
sout << "QML debugging..............." << dictionary[ "QML_DEBUG" ] << endl;
sout << "DirectWrite support........." << dictionary[ "DIRECTWRITE" ] << endl << endl;
sout << "DirectWrite support........." << dictionary[ "DIRECTWRITE" ] << endl;
sout << "Use system proxies.........." << dictionary[ "SYSTEM_PROXIES" ] << endl << endl;
sout << "Third Party Libraries:" << endl;
sout << " ZLIB support............" << dictionary[ "ZLIB" ] << endl;