---
 libproxy/proxy.c |   36 ++++++++++++++++++++++++++++++++++--
 1 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/libproxy/proxy.c b/libproxy/proxy.c
index 641e791..e1a1f40 100644
--- a/libproxy/proxy.c
+++ b/libproxy/proxy.c
@@ -77,12 +77,12 @@ static char **extract_result(const char *str)
        result[0] = NULL;
        result[1] = NULL;
 
-       if (strcmp(str, "DIRECT") == 0) {
+       if (strcasecmp(str, "DIRECT") == 0) {
                result[0] = strdup("direct://");
                return result;
        }
 
-       if (strncmp(str, "PROXY ", 6) == 0) {
+       if (strncasecmp(str, "PROXY ", 6) == 0) {
                int len = strlen(str + 6) + 8;
                result[0] = malloc(len);
                if (result[0] != NULL)
@@ -90,6 +90,38 @@ static char **extract_result(const char *str)
                return result;
        }
 
+       if (strncasecmp(str, "SOCKS ", 6) == 0) {
+               int len = strlen(str + 6) + 9;
+               result[0] = malloc(len);
+               if (result[0] != NULL)
+                       sprintf(result[0], "socks://%s", str + 6);
+               return result;
+       }
+
+       if (strncasecmp(str, "SOCKS4 ", 7) == 0) {
+               int len = strlen(str + 7) + 10;
+               result[0] = malloc(len);
+               if (result[0] != NULL)
+                       sprintf(result[0], "socks4://%s", str + 7);
+               return result;
+       }
+
+       if (strncasecmp(str, "SOCKS5 ", 7) == 0) {
+               int len = strlen(str + 7) + 10;
+               result[0] = malloc(len);
+               if (result[0] != NULL)
+                       sprintf(result[0], "socks5://%s", str + 7);
+               return result;
+       }
+
+       if (strncasecmp(str, "SOCKS4a ", 8) == 0) {
+               int len = strlen(str + 8) + 11;
+               result[0] = malloc(len);
+               if (result[0] != NULL)
+                       sprintf(result[0], "socks4a://%s", str + 8);
+               return result;
+       }
+
        return result;
 }
 
-- 
1.7.5.4

_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to