summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Wilck <mwilck@suse.com>2020-01-05 00:01:52 +0100
committerMartin Wilck <mwilck@suse.com>2020-02-14 21:26:25 +0100
commit04b818314b2a42a5d7d14e2a1138b0210df7cb31 (patch)
treed2b4b0a6f7755724eccec21eacc624ab9a1af76c
parentd117d4a474b1f19f7e184506d42770f82f88364f (diff)
downloadlibproxy-git-04b818314b2a42a5d7d14e2a1138b0210df7cb31.tar.gz
config_pacrunner: update response parsing
Use the same algorithm as pacrunner's own "shim" libproxy, and add support for socks4 and socks5.
-rw-r--r--libproxy/modules/config_pacrunner.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/libproxy/modules/config_pacrunner.cpp b/libproxy/modules/config_pacrunner.cpp
index 5e9e772..80d0432 100644
--- a/libproxy/modules/config_pacrunner.cpp
+++ b/libproxy/modules/config_pacrunner.cpp
@@ -103,12 +103,16 @@ public:
char *str = NULL;
dbus_message_get_args(reply, NULL, DBUS_TYPE_STRING, &str, DBUS_TYPE_INVALID);
- if (!str || !strlen(str) || !::strcmp(str, "DIRECT"))
+ if (!str || !strlen(str) || !strcasecmp(str, "DIRECT"))
response.push_back(url("direct://"));
- else if (!strncmp(str, "PROXY ", 6))
+ else if (!strncasecmp(str, "PROXY ", 6))
response.push_back(url("http://" + string(str + 6)));
- else if (!strncmp(str, "SOCKS ", 6))
+ else if (!strncasecmp(str, "SOCKS ", 6))
response.push_back(url("socks://" + string(str + 6)));
+ else if (!strncasecmp(str, "SOCKS4 ", 7))
+ response.push_back(url("socks4://" + string(str + 7)));
+ else if (!strncasecmp(str, "SOCKS5 ", 7))
+ response.push_back(url("socks5://" + string(str + 7)));
else {
throw runtime_error("Unrecognised proxy response from PacRunner: " + string(str));
}