Update to 0.4.13
This commit is contained in:
parent
f1b46510c2
commit
6d0dfe987d
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
/libproxy-0.*.tar.gz
|
/libproxy-0.*.tar.gz
|
||||||
/0.4.12.tar.gz
|
/0.4.12.tar.gz
|
||||||
|
/0.4.13.tar.gz
|
||||||
|
@ -1,167 +0,0 @@
|
|||||||
From 28620c7aeb3d1b54c83caf84778df8e095490820 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Fabian Vogt <fabian@ritter-vogt.de>
|
|
||||||
Date: Tue, 16 Feb 2016 21:33:40 +0100
|
|
||||||
Subject: [PATCH] config_kde: Add a basic cache and invalidation
|
|
||||||
|
|
||||||
After finding out whether to use kreadconfig5 or kreadconfig,
|
|
||||||
it uses either qtpaths or kde4-config to determine the locations
|
|
||||||
of the kioslaverc config file, to be able to notice modifications
|
|
||||||
that require a cache flush.
|
|
||||||
---
|
|
||||||
libproxy/modules/config_kde.cpp | 98 ++++++++++++++++++++++++++++++++++++-----
|
|
||||||
1 file changed, 88 insertions(+), 10 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/libproxy/modules/config_kde.cpp b/libproxy/modules/config_kde.cpp
|
|
||||||
index 2211487..515aaac 100644
|
|
||||||
--- a/libproxy/modules/config_kde.cpp
|
|
||||||
+++ b/libproxy/modules/config_kde.cpp
|
|
||||||
@@ -18,9 +18,13 @@
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
******************************************************************************/
|
|
||||||
|
|
||||||
+#include <sys/stat.h>
|
|
||||||
+#include <unistd.h>
|
|
||||||
+
|
|
||||||
#include <algorithm>
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <cstdio>
|
|
||||||
+#include <sstream>
|
|
||||||
|
|
||||||
#include "../extension_config.hpp"
|
|
||||||
using namespace libproxy;
|
|
||||||
@@ -28,11 +32,18 @@ using namespace libproxy;
|
|
||||||
class kde_config_extension : public config_extension {
|
|
||||||
public:
|
|
||||||
kde_config_extension()
|
|
||||||
+ : cache_time(0)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
// Try the KF5 one first
|
|
||||||
command = "kreadconfig5";
|
|
||||||
- kde_config_val("proxyType", "-1");
|
|
||||||
+ command_output("kreadconfig5 --key nonexistant");
|
|
||||||
+
|
|
||||||
+ try {
|
|
||||||
+ parse_dir_list(command_output("qtpaths --paths GenericConfigLocation"));
|
|
||||||
+ }
|
|
||||||
+ catch(...) {}
|
|
||||||
+
|
|
||||||
return; // Worked
|
|
||||||
}
|
|
||||||
catch(...) {}
|
|
||||||
@@ -40,7 +51,13 @@ class kde_config_extension : public config_extension {
|
|
||||||
try {
|
|
||||||
// The KDE4 one next
|
|
||||||
command = "kreadconfig";
|
|
||||||
- kde_config_val("proxyType", "-1");
|
|
||||||
+ command_output(command);
|
|
||||||
+
|
|
||||||
+ try {
|
|
||||||
+ parse_dir_list(command_output("kde4-config --path config"));
|
|
||||||
+ }
|
|
||||||
+ catch(...) {}
|
|
||||||
+
|
|
||||||
return; // Worked
|
|
||||||
}
|
|
||||||
catch(...) {}
|
|
||||||
@@ -117,11 +134,7 @@ class kde_config_extension : public config_extension {
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
- // Neither key nor def must contain '
|
|
||||||
- string kde_config_val(const string &key, const string &def) throw (runtime_error) {
|
|
||||||
- string cmdline =
|
|
||||||
- command + " --file kioslaverc --group 'Proxy Settings' --key '" + key + "' --default '" + def + "'";
|
|
||||||
-
|
|
||||||
+ string command_output(const string &cmdline) throw (runtime_error) {
|
|
||||||
FILE *pipe = popen(cmdline.c_str(), "r");
|
|
||||||
if (!pipe)
|
|
||||||
throw runtime_error("Unable to run command");
|
|
||||||
@@ -129,19 +142,84 @@ class kde_config_extension : public config_extension {
|
|
||||||
char buffer[128];
|
|
||||||
string result = "";
|
|
||||||
while (!feof(pipe)) {
|
|
||||||
- if (fgets(buffer, 128, pipe) != NULL)
|
|
||||||
- result += buffer; // TODO: If this throws bad_alloc, pipe is leaked
|
|
||||||
+ if (fgets(buffer, 128, pipe) != NULL)
|
|
||||||
+ result += buffer; // TODO: If this throws bad_alloc, pipe is leaked
|
|
||||||
}
|
|
||||||
|
|
||||||
- pclose(pipe);
|
|
||||||
+ if(pclose(pipe) != 0)
|
|
||||||
+ throw runtime_error("Command failed");
|
|
||||||
|
|
||||||
// Trim newlines and whitespace at end
|
|
||||||
result.erase(result.begin() + (result.find_last_not_of(" \n\t")+1), result.end());
|
|
||||||
+
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ // Neither key nor def must contain '
|
|
||||||
+ string kde_config_val(const string &key, const string &def) throw (runtime_error) {
|
|
||||||
+ if (cache_needs_refresh())
|
|
||||||
+ cache.clear();
|
|
||||||
+ else
|
|
||||||
+ try {
|
|
||||||
+ // Already in cache?
|
|
||||||
+ return cache.at(key);
|
|
||||||
+ } catch(...) {} // Not in cache
|
|
||||||
+
|
|
||||||
+ string result = command_output(
|
|
||||||
+ command + " --file kioslaverc --group 'Proxy Settings' --key '" + key + "' --default '" + def + "'");
|
|
||||||
+
|
|
||||||
+ // Add result to cache
|
|
||||||
+ cache[key] = result;
|
|
||||||
+
|
|
||||||
+ return result;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ // Used for cache invalidation
|
|
||||||
+ struct configfile {
|
|
||||||
+ string path;
|
|
||||||
+ time_t mtime; // 0 means it doesn't exist
|
|
||||||
+ };
|
|
||||||
+
|
|
||||||
+ // Parses output of qtpaths/kde4-config to fill config_locs
|
|
||||||
+ void parse_dir_list(const string &dirs) {
|
|
||||||
+ string config_path;
|
|
||||||
+ stringstream config_paths_stream(dirs);
|
|
||||||
+
|
|
||||||
+ // Try each of the listed folders, seperated by ':'
|
|
||||||
+ while (getline(config_paths_stream, config_path, ':')) {
|
|
||||||
+ configfile config_loc; config_loc.path = config_path + "/kioslaverc";
|
|
||||||
+ config_locs.push_back(config_loc);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ // If any of the locations in config_locs changed (different mtime),
|
|
||||||
+ // update config_locs and return true.
|
|
||||||
+ bool cache_needs_refresh() {
|
|
||||||
+ // Play safe here, if we can't determine the location,
|
|
||||||
+ // don't cache at all.
|
|
||||||
+ bool needs_refresh = config_locs.empty();
|
|
||||||
+ struct stat config_info;
|
|
||||||
+
|
|
||||||
+ for (unsigned int i = 0; i < config_locs.size(); ++i) {
|
|
||||||
+ configfile &config = config_locs[i];
|
|
||||||
+ time_t current_mtime = stat(config.path.c_str(), &config_info) == 0 ? config_info.st_mtime : 0;
|
|
||||||
+ if (config.mtime != current_mtime) {
|
|
||||||
+ config.mtime = current_mtime;
|
|
||||||
+ needs_refresh = true;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return needs_refresh;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
// Whether to use kreadconfig or kreadconfig5
|
|
||||||
string command;
|
|
||||||
+ // When the cache was flushed last
|
|
||||||
+ time_t cache_time;
|
|
||||||
+ // Cache for config values
|
|
||||||
+ map<string, string> cache;
|
|
||||||
+ // State of the config files at the time of the last cache flush
|
|
||||||
+ vector<configfile> config_locs;
|
|
||||||
};
|
|
||||||
|
|
||||||
MM_MODULE_INIT_EZ(kde_config_extension, getenv("KDE_FULL_SESSION"), NULL, NULL);
|
|
@ -1,37 +0,0 @@
|
|||||||
From 76b89df0efc0fe817d320b7b34b2b0530ffd5538 Mon Sep 17 00:00:00 2001
|
|
||||||
From: David King <dking@redhat.com>
|
|
||||||
Date: Fri, 4 Mar 2016 14:19:29 +0000
|
|
||||||
Subject: [PATCH] python: Avoid a crash on 64-bit systems
|
|
||||||
|
|
||||||
Annotate the return type of px_proxy_factory_new() to be void *, as otherwise
|
|
||||||
int is assumed. This works fine on 32-bit systems, where void * and int are the
|
|
||||||
same width, but is invalid on 64-bit (Linux) systems.
|
|
||||||
|
|
||||||
Additionally, annotate the argument type of free() and px_proxy_factory_free()
|
|
||||||
to be void * to match.
|
|
||||||
|
|
||||||
https://code.google.com/archive/p/libproxy/issues/146
|
|
||||||
---
|
|
||||||
bindings/python/libproxy.py | 4 ++++
|
|
||||||
1 file changed, 4 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/bindings/python/libproxy.py b/bindings/python/libproxy.py
|
|
||||||
index cb75a4d..7bddba9 100644
|
|
||||||
--- a/bindings/python/libproxy.py
|
|
||||||
+++ b/bindings/python/libproxy.py
|
|
||||||
@@ -40,8 +40,12 @@ if platform.system() == "Windows":
|
|
||||||
else:
|
|
||||||
_libc = _load("c", 6)
|
|
||||||
|
|
||||||
+_libc.free.argtypes = ctypes.c_void_p,
|
|
||||||
+
|
|
||||||
# Load libproxy
|
|
||||||
_libproxy = _load("proxy", 1)
|
|
||||||
+_libproxy.px_proxy_factory_new.restype = ctypes.POINTER(ctypes.c_void_p)
|
|
||||||
+_libproxy.px_proxy_factory_free.argtypes = ctypes.c_void_p,
|
|
||||||
_libproxy.px_proxy_factory_get_proxies.restype = ctypes.POINTER(ctypes.c_void_p)
|
|
||||||
|
|
||||||
class ProxyFactory(object):
|
|
||||||
--
|
|
||||||
2.7.2
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
|||||||
From 00975fa11220af11398f9d89ee2ee0cf17c655d2 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Dominique Leuenberger <dimstar@opensuse.org>
|
|
||||||
Date: Mon, 18 Jan 2016 19:13:14 +0100
|
|
||||||
Subject: [PATCH] pacrunner_webkit: allow linking against javascriptcore-4.0
|
|
||||||
|
|
||||||
---
|
|
||||||
NEWS | 5 +++++
|
|
||||||
libproxy/cmake/modules/pacrunner_webkit.cmk | 9 ++++++---
|
|
||||||
2 files changed, 11 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/NEWS b/NEWS
|
|
||||||
index 89ec2c7..0676831 100644
|
|
||||||
--- a/NEWS
|
|
||||||
+++ b/NEWS
|
|
||||||
@@ -1,3 +1,8 @@
|
|
||||||
+New in Version 0.4.13
|
|
||||||
+==============================
|
|
||||||
+* Allow linking webkit pacrunner against javascriptcore-4.0
|
|
||||||
+ (webkit2)
|
|
||||||
+
|
|
||||||
New in version 0.4.12
|
|
||||||
==============================
|
|
||||||
* Move development to github.com/libproxy/libproxy
|
|
||||||
diff --git a/libproxy/cmake/modules/pacrunner_webkit.cmk b/libproxy/cmake/modules/pacrunner_webkit.cmk
|
|
||||||
index 0a99d18..c5afcc2 100644
|
|
||||||
--- a/libproxy/cmake/modules/pacrunner_webkit.cmk
|
|
||||||
+++ b/libproxy/cmake/modules/pacrunner_webkit.cmk
|
|
||||||
@@ -13,11 +13,14 @@ elseif(APPLE)
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
if(WITH_WEBKIT3)
|
|
||||||
- px_check_modules(WEBKIT "javascriptcoregtk-3.0 >= 1.5.0")
|
|
||||||
+ px_check_modules(WEBKIT "javascriptcoregtk-4.0")
|
|
||||||
if(NOT WEBKIT_LIBRARIES)
|
|
||||||
- px_check_modules(WEBKIT "webkitgtk-3.0 < 1.5.0")
|
|
||||||
+ px_check_modules(WEBKIT "javascriptcoregtk-3.0 >= 1.5.0")
|
|
||||||
+ if(NOT WEBKIT_LIBRARIES)
|
|
||||||
+ px_check_modules(WEBKIT "webkitgtk-3.0 < 1.5.0")
|
|
||||||
+ endif(NOT WEBKIT_LIBRARIES)
|
|
||||||
endif(NOT WEBKIT_LIBRARIES)
|
|
||||||
- else()
|
|
||||||
+ else(WITH_WEBKIT3)
|
|
||||||
px_check_modules(WEBKIT webkit-1.0)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
@ -1,62 +0,0 @@
|
|||||||
From 6efcbd3fa0944b499180c7bc860d38c1b18c97f1 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Fabian Vogt <fabian@ritter-vogt.de>
|
|
||||||
Date: Tue, 16 Feb 2016 22:13:56 +0100
|
|
||||||
Subject: [PATCH] Fix mismatched new[]/delete in pacrunner_natus and _webkit
|
|
||||||
|
|
||||||
---
|
|
||||||
libproxy/modules/pacrunner_natus.cpp | 4 ++--
|
|
||||||
libproxy/modules/pacrunner_webkit.cpp | 6 +++---
|
|
||||||
2 files changed, 5 insertions(+), 5 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/libproxy/modules/pacrunner_natus.cpp b/libproxy/modules/pacrunner_natus.cpp
|
|
||||||
index ce79943..72ef6ff 100644
|
|
||||||
--- a/libproxy/modules/pacrunner_natus.cpp
|
|
||||||
+++ b/libproxy/modules/pacrunner_natus.cpp
|
|
||||||
@@ -43,14 +43,14 @@ static Value dnsResolve(Value& ths, Value& fnc, vector<Value>& arg) {
|
|
||||||
NULL, 0,
|
|
||||||
NI_NUMERICHOST)) {
|
|
||||||
freeaddrinfo(info);
|
|
||||||
- delete tmp;
|
|
||||||
+ delete[] tmp;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
freeaddrinfo(info);
|
|
||||||
|
|
||||||
// Create the return value
|
|
||||||
Value ret = ths.newString(tmp);
|
|
||||||
- delete tmp;
|
|
||||||
+ delete[] tmp;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/libproxy/modules/pacrunner_webkit.cpp b/libproxy/modules/pacrunner_webkit.cpp
|
|
||||||
index c51b869..bef2056 100644
|
|
||||||
--- a/libproxy/modules/pacrunner_webkit.cpp
|
|
||||||
+++ b/libproxy/modules/pacrunner_webkit.cpp
|
|
||||||
@@ -58,7 +58,7 @@ static JSValueRef dnsResolve(JSContextRef ctx, JSObjectRef /*func*/, JSObjectRef
|
|
||||||
struct addrinfo *info;
|
|
||||||
if (getaddrinfo(tmp, NULL, NULL, &info))
|
|
||||||
return NULL;
|
|
||||||
- delete tmp;
|
|
||||||
+ delete[] tmp;
|
|
||||||
|
|
||||||
// Try for IPv4
|
|
||||||
tmp = new char[INET6_ADDRSTRLEN+1];
|
|
||||||
@@ -67,7 +67,7 @@ static JSValueRef dnsResolve(JSContextRef ctx, JSObjectRef /*func*/, JSObjectRef
|
|
||||||
NULL, 0,
|
|
||||||
NI_NUMERICHOST)) {
|
|
||||||
freeaddrinfo(info);
|
|
||||||
- delete tmp;
|
|
||||||
+ delete[] tmp;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
freeaddrinfo(info);
|
|
||||||
@@ -76,7 +76,7 @@ static JSValueRef dnsResolve(JSContextRef ctx, JSObjectRef /*func*/, JSObjectRef
|
|
||||||
JSStringRef str = JSStringCreateWithUTF8CString(tmp);
|
|
||||||
JSValueRef ret = JSValueMakeString(ctx, str);
|
|
||||||
JSStringRelease(str);
|
|
||||||
- delete tmp;
|
|
||||||
+ delete[] tmp;
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user