diff options
author | Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com> | 2013-06-14 10:24:41 +0300 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2013-06-17 12:10:25 +0300 |
commit | 5e2d25966ea531b0c3d97c8e71c69d28d30a9ea6 (patch) | |
tree | 5dfe05d0d7b2fd138665f7f73b0347ad470f9327 | |
parent | 39b4f19b51819511b3d3f5890130bbe77420b696 (diff) | |
download | pacrunner-5e2d25966ea531b0c3d97c8e71c69d28d30a9ea6.tar.gz |
manual: Fix output so it provides the prefix as expected
Fixes BMC#26022
-rw-r--r-- | src/manual.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/manual.c b/src/manual.c index 43635ef..322b89b 100644 --- a/src/manual.c +++ b/src/manual.c @@ -300,9 +300,29 @@ static enum pacrunner_manual_protocol get_protocol_from_string(const char *proto return PACRUNNER_PROTOCOL_UNKNOWN; } +static const char *protocol_to_prefix_string(enum pacrunner_manual_protocol proto) +{ + switch (proto) { + case PACRUNNER_PROTOCOL_ALL: + case PACRUNNER_PROTOCOL_HTTP: + case PACRUNNER_PROTOCOL_HTTPS: + case PACRUNNER_PROTOCOL_FTP: + return "PROXY"; + case PACRUNNER_PROTOCOL_SOCKS4: + return "SOCKS4"; + case PACRUNNER_PROTOCOL_SOCKS5: + return "SOCKS5"; + case PACRUNNER_PROTOCOL_MAXIMUM_NUMBER: + case PACRUNNER_PROTOCOL_UNKNOWN: + break; + }; + + return ""; +} + GList **__pacrunner_manual_parse_servers(char **servers) { - char *host, *protocol; + char *host, *protocol, *proxy; GList **result; char **uri; int proto; @@ -326,9 +346,15 @@ GList **__pacrunner_manual_parse_servers(char **servers) if (proto == PACRUNNER_PROTOCOL_UNKNOWN) goto error; - result[proto] = g_list_append(result[proto], host); + proxy = g_strdup_printf("%s %s", + protocol_to_prefix_string(proto), host); + if (proxy == NULL) + goto error; + + result[proto] = g_list_append(result[proto], proxy); g_free(protocol); + g_free(host); } return result; |