summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Linton <jlinton@users.noreply.github.com>2017-04-26 15:58:14 -0500
committerJeremy Linton <jeremy.linton@arm.com>2017-04-26 16:09:22 -0500
commit2324c07a6d8574890f258dc816708321cc4d2732 (patch)
treeda255d73f060c2f42771583768d7730f8e726fc9
parente6c993a1baa04b0bd2c4194f6e3b6fa69d901656 (diff)
parent5734b5c86f278823e3c6d5d8ff4193383031ff37 (diff)
downloadlibproxy-git-2324c07a6d8574890f258dc816708321cc4d2732.tar.gz
Merge branch 'master' into master
-rw-r--r--.travis.yml6
-rw-r--r--CMakeLists.txt3
-rw-r--r--INSTALL4
-rw-r--r--NEWS12
-rw-r--r--bindings/CMakeLists.txt11
-rw-r--r--bindings/python/CMakeLists.txt25
-rw-r--r--bindings/python/python2/CMakeLists.txt25
-rw-r--r--bindings/python/python3/CMakeLists.txt25
-rw-r--r--cmake/FindMono.cmake2
-rw-r--r--cmake/FindPython2Interp.cmake145
-rw-r--r--cmake/FindPython3Interp.cmake145
-rw-r--r--cmake/paths.cmk6
-rw-r--r--libproxy/CMakeLists.txt2
-rw-r--r--libproxy/cmake/devfiles.cmk4
-rw-r--r--libproxy/cmake/modules.cmk5
-rw-r--r--libproxy/cmake/modules/network_networkmanager.cmk2
-rw-r--r--libproxy/modules/network_networkmanager.cpp2
-rw-r--r--libproxy/modules/pxgsettings.cpp10
-rw-r--r--libproxy/modules/wpad_dns_alias.cpp1
-rw-r--r--libproxy/proxy.cpp2
-rw-r--r--libproxy/test/get-pac-test.cpp50
-rw-r--r--libproxy/url.cpp33
-rw-r--r--libproxy/url.hpp2
23 files changed, 465 insertions, 57 deletions
diff --git a/.travis.yml b/.travis.yml
index 01f0312..5ab2a02 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,10 +8,6 @@ compiler:
- clang
- gcc
-matrix:
- allow_failures:
- - os: osx
-
install:
# create /etc/sysconfig so that the build process enables this module (build test)
- |
@@ -25,7 +21,7 @@ script:
- |
cmake . \
-DWITH_PERL=ON \
- -DWITH_PYTHON=ON \
+ -DWITH_PYTHON2=ON \
-DWITH_GNOME3=ON \
-DWITH_KDE=ON \
-DWITH_WEBKIT3=ON \
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5313787..451e7a6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,6 +3,9 @@ cmake_minimum_required(VERSION 2.6)
if(POLICY CMP0011)
cmake_policy(SET CMP0011 NEW)
endif(POLICY CMP0011)
+if(POLICY CMP0054)
+ cmake_policy(SET CMP0054 NEW)
+endif(POLICY CMP0054)
# Make sure we look in our cmake folder for additional definitions
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake )
diff --git a/INSTALL b/INSTALL
index 8fc0c1a..bf04881 100644
--- a/INSTALL
+++ b/INSTALL
@@ -110,7 +110,9 @@ WITH_NM: Default to ON. Enable NetworkManager bindings.
WITH_PERL: Default to ON. Enable Perl bindings.
-WITH_PYTHON: Default to ON. Enable Python bindings.
+WITH_PYTHON2: Default to ON. Enable Python bindings.
+
+WITH_PYTHON3: Default to ON. Enable Python bindings.
WITH_VALA: Default to OFF. Enable Vala bindings.
diff --git a/NEWS b/NEWS
index f822bbd..cc8bd35 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,15 @@
+New in Version 0.4.14:
+==============================
+* Parallel build support for python2 and python3.
+ -DWITH_PYTHON has been replaced with -DWITH_PYTHON2 and
+ -DWITH_PYTHON3 to have full control over this. Default is
+ ON for both (issue#22)
+* Minor fixes to the PAC retriever code (issue#40)
+* Fallback to mcs instead of gmcs for the mono bindings (issue#37)
+* Fix build using cmake 3.7
+* Fix deprecation warnings of pxgsettings with glib 2.46
+* Improve the get-pac test suite (issue#47)
+
New in Version 0.4.13
==============================
* Allow linking webkit pacrunner against javascriptcore-4.0
diff --git a/bindings/CMakeLists.txt b/bindings/CMakeLists.txt
index 28bad03..2b0ede4 100644
--- a/bindings/CMakeLists.txt
+++ b/bindings/CMakeLists.txt
@@ -1,6 +1,11 @@
-option(WITH_PYTHON "Enables Python bindings" ON)
-if (WITH_PYTHON)
- add_subdirectory(python)
+option(WITH_PYTHON2 "Enables Python 2 bindings" ON)
+if (WITH_PYTHON2)
+ add_subdirectory(python/python2)
+endif()
+
+option(WITH_PYTHON3 "Enables Python 3 bindings" ON)
+if (WITH_PYTHON3)
+ add_subdirectory(python/python3)
endif()
option(WITH_DOTNET "Enables C# bindings" OFF)
diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt
deleted file mode 100644
index aca852f..0000000
--- a/bindings/python/CMakeLists.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-find_package(PythonInterp)
-
-if(PYTHONINTERP_FOUND)
- set(PYTHON_SITEPKG_DIR "${PYTHON_SITEPKG_DIR}" CACHE PATH "Python site-package directory.")
-
- if(NOT PYTHON_SITEPKG_DIR)
- execute_process(COMMAND
- ${PYTHON_EXECUTABLE}
- -c "import sys; print sys.version[0:3]"
- OUTPUT_VARIABLE PYTHON_VERSION
- OUTPUT_STRIP_TRAILING_WHITESPACE)
-
- message(STATUS "Found python version ${PYTHON_VERSION}")
-
- execute_process(COMMAND
- ${PYTHON_EXECUTABLE}
- -c "import distutils.sysconfig ; print distutils.sysconfig.get_python_lib(plat_specific=0)"
- OUTPUT_VARIABLE PYTHON_SITEPKG_DIR
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- endif()
-
- message(STATUS "Using PYTHON_SITEPKG_DIR=${PYTHON_SITEPKG_DIR}")
-
- install(FILES libproxy.py DESTINATION ${PYTHON_SITEPKG_DIR})
-endif()
diff --git a/bindings/python/python2/CMakeLists.txt b/bindings/python/python2/CMakeLists.txt
new file mode 100644
index 0000000..00df551
--- /dev/null
+++ b/bindings/python/python2/CMakeLists.txt
@@ -0,0 +1,25 @@
+find_package(Python2Interp)
+
+if(PYTHON2INTERP_FOUND)
+ set(PYTHON2_SITEPKG_DIR "${PYTHON2_SITEPKG_DIR}" CACHE PATH "Python 2 site-package directory.")
+
+ if(NOT PYTHON2_SITEPKG_DIR)
+ execute_process(COMMAND
+ ${PYTHON2_EXECUTABLE}
+ -c "import sys; print (sys.version[0:3])"
+ OUTPUT_VARIABLE PYTHON2_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ message(STATUS "Found python 2 version ${PYTHON2_VERSION}")
+
+ execute_process(COMMAND
+ ${PYTHON2_EXECUTABLE}
+ -c "import distutils.sysconfig ; print (distutils.sysconfig.get_python_lib(plat_specific=0))"
+ OUTPUT_VARIABLE PYTHON2_SITEPKG_DIR
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ endif()
+
+ message(STATUS "Using PYTHON2_SITEPKG_DIR=${PYTHON2_SITEPKG_DIR}")
+
+ install(FILES ../libproxy.py DESTINATION ${PYTHON2_SITEPKG_DIR})
+endif()
diff --git a/bindings/python/python3/CMakeLists.txt b/bindings/python/python3/CMakeLists.txt
new file mode 100644
index 0000000..bf87dfc
--- /dev/null
+++ b/bindings/python/python3/CMakeLists.txt
@@ -0,0 +1,25 @@
+find_package(Python3Interp)
+
+if(PYTHON3INTERP_FOUND)
+ set(PYTHON3_SITEPKG_DIR "${PYTHON3_SITEPKG_DIR}" CACHE PATH "Python 3 site-package directory.")
+
+ if(NOT PYTHON3_SITEPKG_DIR)
+ execute_process(COMMAND
+ ${PYTHON3_EXECUTABLE}
+ -c "import sys; print (sys.version[0:3])"
+ OUTPUT_VARIABLE PYTHON3_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ message(STATUS "Found python 3 version ${PYTHON3_VERSION}")
+
+ execute_process(COMMAND
+ ${PYTHON3_EXECUTABLE}
+ -c "import distutils.sysconfig ; print (distutils.sysconfig.get_python_lib(plat_specific=0))"
+ OUTPUT_VARIABLE PYTHON3_SITEPKG_DIR
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ endif()
+
+ message(STATUS "Using PYTHON3_SITEPKG_DIR=${PYTHON3_SITEPKG_DIR}")
+
+ install(FILES ../libproxy.py DESTINATION ${PYTHON3_SITEPKG_DIR})
+endif()
diff --git a/cmake/FindMono.cmake b/cmake/FindMono.cmake
index 95930b0..d4aa0ca 100644
--- a/cmake/FindMono.cmake
+++ b/cmake/FindMono.cmake
@@ -12,7 +12,7 @@
# Redistribution and use is allowed according to the terms of the GPL license.
FIND_PROGRAM (MONO_EXECUTABLE mono)
-FIND_PROGRAM (GMCS_EXECUTABLE gmcs)
+FIND_PROGRAM (GMCS_EXECUTABLE NAMES gmcs mcs)
FIND_PROGRAM (GACUTIL_EXECUTABLE gacutil)
SET (MONO_FOUND FALSE CACHE INTERNAL "")
diff --git a/cmake/FindPython2Interp.cmake b/cmake/FindPython2Interp.cmake
new file mode 100644
index 0000000..fbece44
--- /dev/null
+++ b/cmake/FindPython2Interp.cmake
@@ -0,0 +1,145 @@
+#.rst:
+# FindPython2Interp
+# ----------------
+#
+# Find python 3 interpreter (based on original FindPythonInterp from cmake)
+#
+# This module finds if Python interpreter is installed and determines
+# where the executables are. This code sets the following variables:
+#
+# ::
+#
+# PYTHON2INTERP_FOUND - Was the Python executable found
+# PYTHON2_EXECUTABLE - path to the Python interpreter
+#
+#
+#
+# ::
+#
+# PYTHON2_VERSION_STRING - Python version found e.g. 2.5.1
+# PYTHON2_VERSION_MAJOR - Python major version found e.g. 1
+# PYTHON2_VERSION_MINOR - Python minor version found e.g. 5
+# PYTHON2_VERSION_PATCH - Python patch version found e.g. 1
+#
+#=============================================================================
+# Copyright 2005-2010 Kitware, Inc.
+# Copyright 2011 Bjoern Ricks <bjoern.ricks@gmail.com>
+# Copyright 2012 Rolf Eike Beer <eike@sf-mail.de>
+# Copyright 2016 Dominique Leuenberger <dimstar@opensuse.org>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+unset(_Python2_NAMES)
+
+set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
+
+if(Python2Interp_FIND_VERSION)
+ if(Python2Interp_FIND_VERSION_COUNT GREATER 1)
+ set(_PYTHON2_FIND_MAJ_MIN "${Python2Interp_FIND_VERSION_MAJOR}.${Python2Interp_FIND_VERSION_MINOR}")
+ list(APPEND _Python2_NAMES
+ python${_PYTHON2_FIND_MAJ_MIN}
+ python${Python2Interp_FIND_VERSION_MAJOR})
+ unset(_PYTHON2_FIND_OTHER_VERSIONS)
+ if(NOT Python2Interp_FIND_VERSION_EXACT)
+ foreach(_PYTHON2_V ${_PYTHON${Python2Interp_FIND_VERSION_MAJOR}_VERSIONS})
+ if(NOT _PYTHON2_V VERSION_LESS _PYTHON2_FIND_MAJ_MIN)
+ list(APPEND _PYTHON2_FIND_OTHER_VERSIONS ${_PYTHON2_V})
+ endif()
+ endforeach()
+ endif()
+ unset(_PYTHON2_FIND_MAJ_MIN)
+ else()
+ list(APPEND _Python2_NAMES python${Python2Interp_FIND_VERSION_MAJOR})
+ set(_PYTHON2_FIND_OTHER_VERSIONS ${_PYTHON${Python2Interp_FIND_VERSION_MAJOR}_VERSIONS})
+ endif()
+else()
+ set(_PYTHON2_FIND_OTHER_VERSIONS ${_PYTHON2_VERSIONS})
+endif()
+find_program(PYTHON2_EXECUTABLE NAMES ${_Python2_NAMES})
+
+# If FindPythonInterp has already found the major and minor version,
+# insert that version next to get consistent versions of the interpreter and
+# library.
+if(DEFINED PYTHON2LIBS_VERSION_STRING)
+ string(REPLACE "." ";" _PYTHON2LIBS_VERSION "${PYTHON2LIBS_VERSION_STRING}")
+ list(GET _PYTHON2LIBS_VERSION 0 _PYTHON2LIBS_VERSION_MAJOR)
+ list(GET _PYTHON2LIBS_VERSION 1 _PYTHON2LIBS_VERSION_MINOR)
+ list(APPEND _Python2_VERSIONS ${_PYTHON2LIBS_VERSION_MAJOR}.${_PYTHON2LIBS_VERSION_MINOR})
+endif()
+# Search for the current active python version first
+list(APPEND _Python2_VERSIONS ";")
+
+unset(_PYTHON2_VERSIONS)
+
+# Search for newest python version if python executable isn't found
+if(NOT PYTHON2_EXECUTABLE)
+ foreach(_CURRENT_VERSION IN LISTS _Python2_VERSIONS)
+ set(_Python2_NAMES python${_CURRENT_VERSION})
+ if(WIN32)
+ list(APPEND _Python2_NAMES python)
+ endif()
+ find_program(PYTHON2_EXECUTABLE
+ NAMES ${_Python2_NAMES}
+ PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]
+ )
+ endforeach()
+endif()
+
+# determine python version string
+if(PYTHON2_EXECUTABLE)
+ execute_process(COMMAND "${PYTHON2_EXECUTABLE}" -c
+ "import sys; sys.stdout.write(';'.join([str(x) for x in sys.version_info[:3]]))"
+ OUTPUT_VARIABLE _VERSION
+ RESULT_VARIABLE _PYTHON2_VERSION_RESULT
+ ERROR_QUIET)
+ if(NOT _PYTHON2_VERSION_RESULT)
+ string(REPLACE ";" "." PYTHON2_VERSION_STRING "${_VERSION}")
+ list(GET _VERSION 0 PYTHON2_VERSION_MAJOR)
+ list(GET _VERSION 1 PYTHON2_VERSION_MINOR)
+ list(GET _VERSION 2 PYTHON2_VERSION_PATCH)
+ if(PYTHON2_VERSION_PATCH EQUAL 0)
+ # it's called "Python 3.1", not "3.1.0"
+ string(REGEX REPLACE "\\.0$" "" PYTHON2_VERSION_STRING "${PYTHON2_VERSION_STRING}")
+ endif()
+ else()
+ # sys.version predates sys.version_info, so use that
+ execute_process(COMMAND "${PYTHON2_EXECUTABLE}" -c "import sys; sys.stdout.write(sys.version)"
+ OUTPUT_VARIABLE _VERSION
+ RESULT_VARIABLE _PYTHON2_VERSION_RESULT
+ ERROR_QUIET)
+ if(NOT _PYTHON2_VERSION_RESULT)
+ string(REGEX REPLACE " .*" "" PYTHON2_VERSION_STRING "${_VERSION}")
+ string(REGEX REPLACE "^([0-9]+)\\.[0-9]+.*" "\\1" PYTHON2_VERSION_MAJOR "${PYTHON2_VERSION_STRING}")
+ string(REGEX REPLACE "^[0-9]+\\.([0-9])+.*" "\\1" PYTHON2_VERSION_MINOR "${PYTHON2_VERSION_STRING}")
+ if(PYTHON2_VERSION_STRING MATCHES "^[0-9]+\\.[0-9]+\\.([0-9]+)")
+ set(PYTHON2_VERSION_PATCH "${CMAKE_MATCH_1}")
+ else()
+ set(PYTHON2_VERSION_PATCH "0")
+ endif()
+ else()
+ # sys.version was first documented for Python 1.5, so assume
+ # this is older.
+ set(PYTHON2_VERSION_STRING "1.4")
+ set(PYTHON2_VERSION_MAJOR "1")
+ set(PYTHON2_VERSION_MINOR "4")
+ set(PYTHON2_VERSION_PATCH "0")
+ endif()
+ endif()
+ unset(_PYTHON2_VERSION_RESULT)
+ unset(_VERSION)
+endif()
+
+# handle the QUIETLY and REQUIRED arguments and set PYTHON2INTERP_FOUND to TRUE if
+# all listed variables are TRUE
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Python2Interp REQUIRED_VARS PYTHON2_EXECUTABLE VERSION_VAR PYTHON2_VERSION_STRING)
+
+mark_as_advanced(PYTHON2_EXECUTABLE)
diff --git a/cmake/FindPython3Interp.cmake b/cmake/FindPython3Interp.cmake
new file mode 100644
index 0000000..c6cbe3d
--- /dev/null
+++ b/cmake/FindPython3Interp.cmake
@@ -0,0 +1,145 @@
+#.rst:
+# FindPython3Interp
+# ----------------
+#
+# Find python 3 interpreter (based on original FindPythonInterp from cmake)
+#
+# This module finds if Python interpreter is installed and determines
+# where the executables are. This code sets the following variables:
+#
+# ::
+#
+# PYTHON3INTERP_FOUND - Was the Python executable found
+# PYTHON3_EXECUTABLE - path to the Python interpreter
+#
+#
+#
+# ::
+#
+# PYTHON3_VERSION_STRING - Python version found e.g. 3.5.1
+# PYTHON3_VERSION_MAJOR - Python major version found e.g. 3
+# PYTHON3_VERSION_MINOR - Python minor version found e.g. 5
+# PYTHON3_VERSION_PATCH - Python patch version found e.g. 1
+#
+#=============================================================================
+# Copyright 2005-2010 Kitware, Inc.
+# Copyright 2011 Bjoern Ricks <bjoern.ricks@gmail.com>
+# Copyright 2012 Rolf Eike Beer <eike@sf-mail.de>
+# Copyright 2016 Dominique Leuenberger <dimstar@opensuse.org>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+unset(_Python3_NAMES)
+
+set(_Python3_VERSIONS 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
+
+if(Python3Interp_FIND_VERSION)
+ if(Python3Interp_FIND_VERSION_COUNT GREATER 1)
+ set(_PYTHON3_FIND_MAJ_MIN "${Python3Interp_FIND_VERSION_MAJOR}.${Python3Interp_FIND_VERSION_MINOR}")
+ list(APPEND _Python3_NAMES
+ python${_PYTHON3_FIND_MAJ_MIN}
+ python${Python3Interp_FIND_VERSION_MAJOR})
+ unset(_PYTHON3_FIND_OTHER_VERSIONS)
+ if(NOT Python3Interp_FIND_VERSION_EXACT)
+ foreach(_PYTHON3_V ${_PYTHON${Python3Interp_FIND_VERSION_MAJOR}_VERSIONS})
+ if(NOT _PYTHON3_V VERSION_LESS _PYTHON3_FIND_MAJ_MIN)
+ list(APPEND _PYTHON3_FIND_OTHER_VERSIONS ${_PYTHON3_V})
+ endif()
+ endforeach()
+ endif()
+ unset(_PYTHON3_FIND_MAJ_MIN)
+ else()
+ list(APPEND _Python3_NAMES python${Python3Interp_FIND_VERSION_MAJOR})
+ set(_PYTHON3_FIND_OTHER_VERSIONS ${_PYTHON${Python3Interp_FIND_VERSION_MAJOR}_VERSIONS})
+ endif()
+else()
+ set(_PYTHON3_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS})
+endif()
+find_program(PYTHON3_EXECUTABLE NAMES ${_Python3_NAMES})
+
+# If FindPythonInterp has already found the major and minor version,
+# insert that version next to get consistent versions of the interpreter and
+# library.
+if(DEFINED PYTHON3LIBS_VERSION_STRING)
+ string(REPLACE "." ";" _PYTHON3LIBS_VERSION "${PYTHON3LIBS_VERSION_STRING}")
+ list(GET _PYTHON3LIBS_VERSION 0 _PYTHON3LIBS_VERSION_MAJOR)
+ list(GET _PYTHON3LIBS_VERSION 1 _PYTHON3LIBS_VERSION_MINOR)
+ list(APPEND _Python3_VERSIONS ${_PYTHON3LIBS_VERSION_MAJOR}.${_PYTHON3LIBS_VERSION_MINOR})
+endif()
+# Search for the current active python version first
+list(APPEND _Python3_VERSIONS ";")
+
+unset(_PYTHON3_VERSIONS)
+
+# Search for newest python version if python executable isn't found
+if(NOT PYTHON3_EXECUTABLE)
+ foreach(_CURRENT_VERSION IN LISTS _Python3_VERSIONS)
+ set(_Python3_NAMES python${_CURRENT_VERSION})
+ if(WIN32)
+ list(APPEND _Python3_NAMES python3)
+ endif()
+ find_program(PYTHON3_EXECUTABLE
+ NAMES ${_Python3_NAMES}
+ PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]
+ )
+ endforeach()
+endif()
+
+# determine python version string
+if(PYTHON3_EXECUTABLE)
+ execute_process(COMMAND "${PYTHON3_EXECUTABLE}" -c
+ "import sys; sys.stdout.write(';'.join([str(x) for x in sys.version_info[:3]]))"
+ OUTPUT_VARIABLE _VERSION3
+ RESULT_VARIABLE _PYTHON3_VERSION_RESULT
+ ERROR_QUIET)
+ if(NOT _PYTHON3_VERSION_RESULT)
+ string(REPLACE ";" "." PYTHON3_VERSION_STRING "${_VERSION3}")
+ list(GET _VERSION3 0 PYTHON3_VERSION_MAJOR)
+ list(GET _VERSION3 1 PYTHON3_VERSION_MINOR)
+ list(GET _VERSION3 2 PYTHON3_VERSION_PATCH)
+ if(PYTHON3_VERSION_PATCH EQUAL 0)
+ # it's called "Python 3.1", not "3.1.0"
+ string(REGEX REPLACE "\\.0$" "" PYTHON3_VERSION_STRING "${PYTHON3_VERSION_STRING}")
+ endif()
+ else()
+ # sys.version predates sys.version_info, so use that
+ execute_process(COMMAND "${PYTHON3_EXECUTABLE}" -c "import sys; sys.stdout.write(sys.version)"
+ OUTPUT_VARIABLE _VERSION3
+ RESULT_VARIABLE _PYTHON3_VERSION_RESULT
+ ERROR_QUIET)
+ if(NOT _PYTHON3_VERSION_RESULT)
+ string(REGEX REPLACE " .*" "" PYTHON3_VERSION_STRING "${_VERSION3}")
+ string(REGEX REPLACE "^([0-9]+)\\.[0-9]+.*" "\\1" PYTHON3_VERSION_MAJOR "${PYTHON3_VERSION_STRING}")
+ string(REGEX REPLACE "^[0-9]+\\.([0-9])+.*" "\\1" PYTHON3_VERSION_MINOR "${PYTHON3_VERSION_STRING}")
+ if(PYTHON3_VERSION_STRING MATCHES "^[0-9]+\\.[0-9]+\\.([0-9]+)")
+ set(PYTHON3_VERSION_PATCH "${CMAKE_MATCH_1}")
+ else()
+ set(PYTHON3_VERSION_PATCH "0")
+ endif()
+ else()
+ # sys.version was first documented for Python 1.5, so assume
+ # this is older.
+ set(PYTHON3_VERSION_STRING "1.4")
+ set(PYTHON3_VERSION_MAJOR "1")
+ set(PYTHON3_VERSION_MINOR "4")
+ set(PYTHON3_VERSION_PATCH "0")
+ endif()
+ endif()
+ unset(_PYTHON3_VERSION_RESULT)
+ unset(_VERSION3)
+endif()
+
+# handle the QUIETLY and REQUIRED arguments and set PYTHON3INTERP_FOUND to TRUE if
+# all listed variables are TRUE
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Python3Interp REQUIRED_VARS PYTHON3_EXECUTABLE PYTHON3_VERSION_STRING)
+
+mark_as_advanced(PYTHON3_EXECUTABLE)
diff --git a/cmake/paths.cmk b/cmake/paths.cmk
index 6b614fe..593ebc1 100644
--- a/cmake/paths.cmk
+++ b/cmake/paths.cmk
@@ -1,4 +1,4 @@
-if(WIN32)
+if(WIN32 AND NOT MINGW)
set(CMAKE_INSTALL_PREFIX "" CACHE PATH "Install prefix")
set(BIN_INSTALL_DIR . CACHE PATH "Binary install dir")
set(LIB_INSTALL_DIR . CACHE PATH "Library install dir")
@@ -6,7 +6,7 @@ if(WIN32)
set(INCLUDE_INSTALL_DIR include CACHE PATH "Include install dir")
set(SYSCONF_INSTALL_DIR . CACHE PATH "Configuration install dir")
set(SHARE_INSTALL_DIR . CACHE PATH "Data install dir")
-else(WIN32)
+else(WIN32 AND NOT MINGW)
set(CMAKE_INSTALL_PREFIX /usr/local CACHE PATH "Install prefix")
set(BIN_INSTALL_DIR bin CACHE PATH "Binary install dir")
set(LIB_INSTALL_DIR lib${LIB_SUFFIX} CACHE PATH "Library install dir")
@@ -14,4 +14,4 @@ else(WIN32)
set(INCLUDE_INSTALL_DIR include CACHE PATH "Include install dir")
set(SYSCONF_INSTALL_DIR /etc CACHE PATH "Configuration install dir")
set(SHARE_INSTALL_DIR share CACHE PATH "Data install dir")
-endif(WIN32)
+endif(WIN32 AND NOT MINGW)
diff --git a/libproxy/CMakeLists.txt b/libproxy/CMakeLists.txt
index 7386e10..f1d34ec 100644
--- a/libproxy/CMakeLists.txt
+++ b/libproxy/CMakeLists.txt
@@ -1,6 +1,6 @@
### Project info
project(libproxy)
-set_project_version(0 4 13)
+set_project_version(0 4 14)
### Add a global compilation stuff
if (WIN32)
diff --git a/libproxy/cmake/devfiles.cmk b/libproxy/cmake/devfiles.cmk
index 97c4281..0301dce 100644
--- a/libproxy/cmake/devfiles.cmk
+++ b/libproxy/cmake/devfiles.cmk
@@ -1,4 +1,4 @@
-if(NOT WIN32)
+if(NOT WIN32 OR MINGW)
# PkgConfig file
set (PKGCONFIG_PREFIX ${CMAKE_INSTALL_PREFIX})
@@ -20,4 +20,4 @@ if(NOT WIN32)
# CMake Find helper
configure_file(${CMAKE_SOURCE_DIR}/libproxy/Findlibproxy.cmake.in ${CMAKE_BINARY_DIR}/Findlibproxy.cmake @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/Findlibproxy.cmake DESTINATION ${SHARE_INSTALL_DIR}/cmake/Modules)
-endif()
+endif(NOT WIN32 OR MINGW)
diff --git a/libproxy/cmake/modules.cmk b/libproxy/cmake/modules.cmk
index 017d428..b3211f2 100644
--- a/libproxy/cmake/modules.cmk
+++ b/libproxy/cmake/modules.cmk
@@ -38,7 +38,10 @@ px_module(config_w32reg "${WIN32}" 1)
px_module(ignore_domain 1 1)
px_module(ignore_hostname 1 1)
px_module(ignore_ip 1 1)
-px_module(network_networkmanager "${NM_FOUND}" 0 ${NM_LIBRARIES})
+if(NM_FOUND OR NMold_FOUND)
+ set(NM_BUILD 1)
+endif(NM_FOUND OR NMold_FOUND)
+px_module(network_networkmanager "${NM_BUILD}" 0 ${NM_LIBRARIES}${NMold_LIBRARIES})
px_module(pacrunner_mozjs "${MOZJS_FOUND}" ${BIPR} ${MOZJS_LIBRARIES})
px_module(pacrunner_natus "${NATUS_FOUND}" ${BIPR} ${NATUS_LIBRARIES})
px_module(pacrunner_webkit "${WEBKIT_FOUND}" ${BIPR} ${WEBKIT_LIBRARIES})
diff --git a/libproxy/cmake/modules/network_networkmanager.cmk b/libproxy/cmake/modules/network_networkmanager.cmk
index 4399557..6ef6ead 100644
--- a/libproxy/cmake/modules/network_networkmanager.cmk
+++ b/libproxy/cmake/modules/network_networkmanager.cmk
@@ -1,6 +1,6 @@
if (NOT WIN32 AND NOT APPLE)
px_check_modules(NM libnm dbus-1)
if (NOT NM_FOUND)
- px_check_modules(NM NetworkManager dbus-1)
+ px_check_modules(NMold NetworkManager dbus-1)
endif (NOT NM_FOUND)
endif()
diff --git a/libproxy/modules/network_networkmanager.cpp b/libproxy/modules/network_networkmanager.cpp
index 5198860..546a8ee 100644
--- a/libproxy/modules/network_networkmanager.cpp
+++ b/libproxy/modules/network_networkmanager.cpp
@@ -62,7 +62,7 @@ public:
// If connection was successful, set it up
dbus_connection_set_exit_on_disconnect(conn, false);
- dbus_bus_add_match(conn, "type='signal',interface='" NM_DBUS_INTERFACE "',member='StateChange'", NULL);
+ dbus_bus_add_match(conn, "type='signal',interface='" NM_DBUS_INTERFACE "',member='StateChanged'", NULL);
dbus_connection_flush(conn);
}
diff --git a/libproxy/modules/pxgsettings.cpp b/libproxy/modules/pxgsettings.cpp
index 68783be..9ed4333 100644
--- a/libproxy/modules/pxgsettings.cpp
+++ b/libproxy/modules/pxgsettings.cpp
@@ -128,7 +128,9 @@ int main(int argc, char **argv) {
}
// Init
+#if !GLIB_CHECK_VERSION(2,36,0)
g_type_init();
+#endif
// Get the main loop
loop = g_main_loop_new(NULL, false);
@@ -148,9 +150,17 @@ int main(int argc, char **argv) {
for (int i=1; i<argc; i++) {
settings = g_settings_new(argv[i]);
+#if GLIB_CHECK_VERSION(2,46,0)
+ GSettingsSchema *schema;
+ g_object_get (settings, "settings-schema", &schema, NULL);
+ gchar** keys = g_settings_schema_list_keys(schema);
+ g_settings_schema_unref(schema);
+#else
gchar** keys = g_settings_list_keys(settings);
+#endif
g_signal_connect(settings, "changed::", G_CALLBACK (on_value_change), argv[i]);
for (int j=0; keys[j]; on_value_change(settings, keys[j++],argv[i] ));
+ g_strfreev(keys);
}
g_main_loop_run(loop);
diff --git a/libproxy/modules/wpad_dns_alias.cpp b/libproxy/modules/wpad_dns_alias.cpp
index 669dccf..5b8c2e0 100644
--- a/libproxy/modules/wpad_dns_alias.cpp
+++ b/libproxy/modules/wpad_dns_alias.cpp
@@ -39,6 +39,7 @@ public:
lastpac = *pac = lasturl->get_pac();
if (!lastpac) {
delete lasturl;
+ lasturl = NULL;
return NULL;
}
diff --git a/libproxy/proxy.cpp b/libproxy/proxy.cpp
index 6d048db..17e330b 100644
--- a/libproxy/proxy.cpp
+++ b/libproxy/proxy.cpp
@@ -266,7 +266,7 @@ void proxy_factory::get_config(url &realurl, vector<url> &config, string &ignore
if (debug) {
if (configurator) {
cerr << "Configuration extension is: " << typeid(*configurator).name() << endl;
- cerr << "Ingored list is: " << ignore << endl;
+ cerr << "Ignored list is: " << ignore << endl;
} else {
cerr << "No configuration extension found." << endl;
}
diff --git a/libproxy/test/get-pac-test.cpp b/libproxy/test/get-pac-test.cpp
index 2b514e4..00b4564 100644
--- a/libproxy/test/get-pac-test.cpp
+++ b/libproxy/test/get-pac-test.cpp
@@ -16,6 +16,11 @@
#include "url.hpp"
+// macOS does not define MSG_NOSIGNAL, but uses the SO_NOSIGPIPE option instead
+#ifndef MSG_NOSIGNAL
+#define MSG_NOSIGNAL 0
+#endif
+
using namespace libproxy;
class TestServer {
@@ -123,6 +128,11 @@ class TestServer {
#endif
#endif
+#ifdef SO_NOSIGPIPE
+ int i = 1;
+ setsockopt(c_sock, SOL_SOCKET, SO_NOSIGPIPE, &i, sizeof(i));
+#endif
+
// Read request
ptr = buffer;
do {
@@ -151,6 +161,11 @@ class TestServer {
sendOverflow(csock);
} else if (strstr(buffer, "chunked")) {
sendChunked(csock);
+ } else if (strstr(buffer, "without_content_length")) {
+ sendWithoutContentLength(csock);
+ } else if (strstr(buffer, "parameterized")) {
+ assert(strstr(buffer, "?arg1=foo&arg2=bar") != NULL);
+ sendBasic(csock);
} else {
assert(!"Unsupported request");
}
@@ -193,20 +208,20 @@ done:
void sendOverflow(int csock)
{
int ret;
- int size = 500000;
+ int size = 50000000; // Must be larger than the kernel TCP receive buffer
char *buf = new char[size];
memset(buf, 1, size);
const char *basic =
"HTTP/1.1 200 OK\n" \
"Content-Type: text/plain\n" \
- "Content-Length: 500000\n" \
+ "Content-Length: 50000000\n" \
"\n";
- ret = send(csock, (void*)basic, strlen(basic), 0);
+ ret = send(csock, (void*)basic, strlen(basic), MSG_NOSIGNAL);
assert(ret == strlen(basic));
ret = send(csock, (void*)buf, size, MSG_NOSIGNAL);
- if ( (errno != EBADF) && (errno != EPIPE) )
- abort(); // Test failed... the socket did not close on us
+ if (ret == size)
+ abort(); // Test failed... the socket should not accept the whole buffer
delete[] buf;
shutdown(csock, SHUT_RDWR);
close(csock);
@@ -232,6 +247,20 @@ done:
close(csock);
}
+ void sendWithoutContentLength(int csock)
+ {
+ int ret;
+ const char *basic =
+ "HTTP/1.1 200 OK\n" \
+ "Content-Type: text/plain\n" \
+ "\n" \
+ "0123456789";
+ ret = send(csock, (void*)basic, strlen(basic), 0);
+ assert(ret == strlen(basic));
+ shutdown(csock, SHUT_RDWR);
+ close(csock);
+ }
+
in_port_t m_port;
int m_sock;
int m_pipe[2];
@@ -249,6 +278,8 @@ int main()
url truncated("http://localhost:1983/truncated.js");
url overflow("http://localhost:1983/overflow.js");
url chunked("http://localhost:1983/chunked.js");
+ url without_content_length("http://localhost:1983/without_content_length.js");
+ url parameterized("http://localhost:1983/parameterized.js?arg1=foo&arg2=bar");
server.start();
@@ -268,6 +299,15 @@ int main()
pac = chunked.get_pac();
if (!(pac != NULL && strlen(pac) == 10 && !strcmp("0123456789", pac)))
return 4; // Test failed, exit with error code
+
+ pac = without_content_length.get_pac();
+ if (!(pac != NULL && strlen(pac) == 10 && !strcmp("0123456789", pac)))
+ return 5; // Test failed, exit with error code
+ delete[] pac;
+
+ pac = parameterized.get_pac();
+ if (!(pac != NULL && strlen(pac) == 10 && !strcmp("0123456789", pac)))
+ return 5; // Test failed, exit with error code
delete[] pac;
server.stop();
diff --git a/libproxy/url.cpp b/libproxy/url.cpp
index 9c69917..b61a9bc 100644
--- a/libproxy/url.cpp
+++ b/libproxy/url.cpp
@@ -53,6 +53,8 @@ using namespace std;
// This is the maximum pac size (to avoid memory attacks)
#define PAC_MAX_SIZE 102400
+// This is the default block size to use when receiving via HTTP
+#define PAC_HTTP_BLOCK_SIZE 512
static inline int get_default_port(string scheme) {
struct servent *serv;
@@ -117,6 +119,7 @@ url::url(const string &url) throw(parse_error)
: m_orig(url), m_port(0), m_ips(NULL) {
size_t idx = 0;
size_t hier_part_start, hier_part_end;
+ size_t query_part_start;
size_t path_start, path_end;
string hier_part;
@@ -149,9 +152,17 @@ url::url(const string &url) throw(parse_error)
transform(m_scheme.begin(), m_scheme.end(), m_scheme.begin(), ::tolower);
hier_part_start = idx;
- hier_part_end = url.find('?', idx);
- if (hier_part_end == string::npos)
- hier_part_end = url.find('#', idx);
+ hier_part_end = url.find('#', idx);
+ query_part_start = url.find('?', idx);
+ if (query_part_start != string::npos)
+ {
+ if (hier_part_end == string::npos)
+ m_query = url.substr(query_part_start);
+ else {
+ m_query = url.substr(query_part_start, hier_part_end - query_part_start);
+ }
+ hier_part_end = query_part_start;
+ }
hier_part = url.substr(hier_part_start,
hier_part_end == string::npos ?
@@ -267,6 +278,7 @@ url& url::operator=(const url& url) {
m_orig = url.m_orig;
m_pass = url.m_pass;
m_path = url.m_path;
+ m_query = url.m_query;
m_port = url.m_port;
m_scheme = url.m_scheme;
m_user = url.m_user;
@@ -354,6 +366,10 @@ string url::get_path() const {
return m_path;
}
+string url::get_query() const {
+ return m_query;
+}
+
uint16_t url::get_port() const {
return m_port;
}
@@ -432,7 +448,7 @@ char* url::get_pac() {
if (sock < 0) return NULL;
// Build the request string
- request = "GET " + (m_path.size() > 0 ? m_path : "/") + " HTTP/1.1\r\n";
+ request = "GET " + (m_path.size() > 0 ? m_path : "/") + m_query + " HTTP/1.1\r\n";
request += "Host: " + m_host + "\r\n";
request += "Accept: " + string(PAC_MIME_TYPE) + "\r\n";
request += "Connection: close\r\n";
@@ -448,6 +464,7 @@ char* url::get_pac() {
string line = recvline(sock);
if (sscanf(line.c_str(), "HTTP/1.%*d %lu", &status) == 1 && status == 200) {
/* Check for correct mime type and content length */
+ content_length = 0;
for (line = recvline(sock) ; line != "\r" && line != "" ; line = recvline(sock)) {
// Check for chunked encoding
if (line.find("Content-Transfer-Encoding: chunked") == 0 || line.find("Transfer-Encoding: chunked") == 0)
@@ -479,8 +496,10 @@ char* url::get_pac() {
if (content_length >= PAC_MAX_SIZE) break;
- while (recvd != content_length) {
- int r = recv(sock, buffer + recvd, content_length - recvd, 0);
+ while (content_length == 0 || recvd != content_length) {
+ int r = recv(sock, buffer + recvd,
+ content_length == 0 ? PAC_HTTP_BLOCK_SIZE
+ : content_length - recvd, 0);
if (r <= 0) {
chunked = false;
break;
@@ -489,7 +508,7 @@ char* url::get_pac() {
}
} while (chunked);
- if (string(buffer).size() != content_length) {
+ if (content_length != 0 && string(buffer).size() != content_length) {
delete[] buffer;
buffer = NULL;
}
diff --git a/libproxy/url.hpp b/libproxy/url.hpp
index 2fd6c34..33ac256 100644
--- a/libproxy/url.hpp
+++ b/libproxy/url.hpp
@@ -59,6 +59,7 @@ public:
sockaddr const* const* get_ips(bool usedns);
string get_password() const;
string get_path() const;
+ string get_query() const;
uint16_t get_port() const;
string get_scheme() const;
string get_username() const;
@@ -75,6 +76,7 @@ private:
string m_host;
uint16_t m_port;
string m_path;
+ string m_query;
sockaddr** m_ips;
};