From d7e922e6b197193fe4a2284b5e25cfb9a4fdd278 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Tue, 23 Oct 2012 15:31:20 +0200 Subject: QtNetwork: introduce configure switch to use system proxies by default This option is opt-in (default: no). When configured with "-system-proxies", Qt automatically picks up the system proxies. (backport of commit f7893223e84db86dcdd860c625663d7006fcdad6) Change-Id: I95c3b17abee0691991a60a386052b4c2989f896c Reviewed-by: Oswald Buddenhagen Reviewed-by: Shane Kearns --- configure | 21 +++++++++++++++++++++ src/network/kernel/qnetworkproxy.cpp | 3 +++ src/network/socket/socket.pri | 4 ++++ tools/configure/configureapp.cpp | 18 +++++++++++++++++- 4 files changed, 45 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 5187e51..25a27de 100755 --- a/configure +++ b/configure @@ -916,6 +916,7 @@ CFG_COREWLAN=auto CFG_ICD=auto CFG_NOPROCESS=no CFG_ICU=auto +CFG_SYSTEM_PROXIES=no # initalize variables used for installation QT_INSTALL_PREFIX= @@ -1103,6 +1104,14 @@ while [ "$#" -gt 0 ]; do VAR=`echo $1 | sed "s,^--\(.*\),\1,"` VAL=yes ;; + -system-proxies) + VAR=system-proxies + VAL=yes + ;; + -no-system-proxies) + VAR=system-proxies + VAL=no + ;; #Qt plugin options -no-*-*|-plugin-*-*|-qt-*-*) VAR=`echo $1 | sed "s,^-[^-]*-\(.*\),\1,"` @@ -2492,6 +2501,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 ;; @@ -3912,6 +3928,9 @@ Configure options: -no-largefile ...... Disables large file support. + -largefile ......... Enables Qt to access files larger than 4 GB. + * -no-system-proxies . Do not use system network proxies by default. + -system-proxies .... Use system network proxies by default. + EOF if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then EXCN="*" @@ -7312,6 +7331,7 @@ fi [ "$CFG_IWMMXT" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG iwmmxt" [ "$CFG_NEON" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG neon" [ "$PLATFORM_MAC" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG $CFG_MAC_ARCHS" +[ "$CFG_SYSTEM_PROXIES" = "yes" ] && QT_CONFIG="$QT_CONFIG system-proxies" if [ "$CFG_IPV6" = "yes" ]; then QT_CONFIG="$QT_CONFIG ipv6" fi @@ -8995,6 +9015,7 @@ if [ "$PLATFORM_MAC" = "yes" ]; then fi echo "ICD support ............ $CFG_ICD" echo "libICU support ......... $CFG_ICU" +echo "Use system proxies ..... $CFG_SYSTEM_PROXIES" echo [ "$CFG_PTMALLOC" != "no" ] && echo "Use ptmalloc ........... $CFG_PTMALLOC" diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp index 393f049..f0b973b 100644 --- a/src/network/kernel/qnetworkproxy.cpp +++ b/src/network/kernel/qnetworkproxy.cpp @@ -247,6 +247,9 @@ public: , socks5SocketEngineHandler(0) , httpSocketEngineHandler(0) { +#ifdef QT_USE_SYSTEM_PROXIES + setApplicationProxyFactory(new QSystemConfigurationProxyFactory); +#endif #ifndef QT_NO_SOCKS5 socks5SocketEngineHandler = new QSocks5SocketEngineHandler(); #endif diff --git a/src/network/socket/socket.pri b/src/network/socket/socket.pri index ac90012..bd5e866 100644 --- a/src/network/socket/socket.pri +++ b/src/network/socket/socket.pri @@ -68,3 +68,7 @@ integrity: { DEFINES += QT_LOCALSOCKET_TCP } + +contains(QT_CONFIG, system-proxies) { + DEFINES += QT_USE_SYSTEM_PROXIES +} diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 80dacb3..77174d5 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -400,6 +400,7 @@ Configure::Configure(int& argc, char** argv) dictionary[ "LTCG" ] = "no"; dictionary[ "NATIVE_GESTURES" ] = "yes"; dictionary[ "MSVC_MP" ] = "no"; + dictionary[ "SYSTEM_PROXIES" ] = "no"; } Configure::~Configure() @@ -1309,6 +1310,14 @@ void Configure::parseCmdLine() dictionary["POSIX_IPC"] = "yes"; } + else if (configCmdLine.at(i) == "-no-system-proxies") { + dictionary[ "SYSTEM_PROXIES" ] = "no"; + } + + else if (configCmdLine.at(i) == "-system-proxies") { + dictionary[ "SYSTEM_PROXIES" ] = "yes"; + } + else { dictionary[ "HELP" ] = "yes"; cout << "Unknown option " << configCmdLine.at(i) << endl; @@ -1930,6 +1939,9 @@ bool Configure::displayHelp() desc("POSIX_IPC", "yes", "-posix-ipc", "Enable POSIX IPC."); + 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."); + #if !defined(EVAL) desc( "-qtnamespace ", "Wraps all Qt library code in 'namespace name {...}"); desc( "-qtlibinfix ", "Renames all Qt* libs to Qt*\n"); @@ -3000,6 +3012,9 @@ void Configure::generateOutputVars() if (dictionary["STACK_PROTECTOR_STRONG"] == "yes") qtConfig += "stack-protector-strong"; + if (dictionary["SYSTEM_PROXIES"] == "yes") + qtConfig += "system-proxies"; + // We currently have no switch for QtConcurrent, so add it unconditionally. qtConfig += "concurrent"; @@ -3759,7 +3774,8 @@ void Configure::displayConfig() cout << "QtScriptTools support......." << dictionary[ "SCRIPTTOOLS" ] << endl; cout << "Graphics System............." << dictionary[ "GRAPHICS_SYSTEM" ] << endl; cout << "Qt3 compatibility..........." << dictionary[ "QT3SUPPORT" ] << endl; - cout << "DirectWrite support........." << dictionary[ "DIRECTWRITE" ] << endl << endl; + cout << "DirectWrite support........." << dictionary[ "DIRECTWRITE" ] << endl; + cout << "Use system proxies.........." << dictionary[ "SYSTEM_PROXIES" ] << endl << endl; cout << "Third Party Libraries:" << endl; cout << " ZLIB support............" << dictionary[ "ZLIB" ] << endl; -- cgit v0.12