Re: [PATCH] Exceptions Regex

Alexander Malysh <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Hi,

few comments to the patch... 

@@ -3300,6 +3301,8 @@ static Cfg *init_smsbox(Cfg *cfg)
                                         octstr_imm("http-proxy-password"));
     http_proxy_exceptions = cfg_get_list(grp,
                                       octstr_imm("http-proxy-exceptions"));
+    http_proxy_exceptions_regex = cfg_get(grp,
+        octstr_imm("http-proxy-exceptions-regex"));

please fix indents..

@@ -250,13 +251,21 @@ static int proxy_used_for_host(Octstr *h
         }
     }
 
+    if (proxy_exceptions_regex != NULL)
+    {
+        if (gw_regex_matches(proxy_exceptions_regex, url) == MATCH) {
+            mutex_unlock(proxy_mutex);
+            return 0;
+        }
+    }

first, Kannel coding style:
if (bla) {
}

second, why not just something like this?
if (proxy_exceptions_regex != NULL &&
    gw_regex_matches(proxy_exceptions_regex, url) == MATCH) {
    mutex_unlock(proxy_mutex);
    return 0;
}

@@ -278,6 +287,9 @@ void http_use_proxy(Octstr *hostname, in
               octstr_get_cstr(e));
         gwlist_append(proxy_exceptions, octstr_duplicate(e));
     }
+    if (exceptions_regex != NULL)
+        if ((proxy_exceptions_regex = gw_regex_comp(exceptions_regex,
REG_EXTENDED)) == NULL)
+            panic(0, "Could not compile pattern '%s'",
octstr_get_cstr(exceptions_regex));

ditto...

--- gwlib/http.h        11 Feb 2005 15:35:48 -0000        1.65
+++ gwlib/http.h        11 Apr 2005 13:16:09 -0000
@@ -129,6 +129,7 @@
 
 #include "gwlib/list.h"
 #include "gwlib/octstr.h"
+#include "gwlib/regex.h"
 
You don'n need to include it here, bacsue gw_regex_t used only in .c file.
So please include it only in .c file.

Otherwise patch looks good!

Thanks!

Jonathan Houser wrote:

> 
>       This patch adds the http-proxy-exceptions-regex option to the
> wapbox and smsbox config files.  I added this to allow a regex like
> "^https" to skip the HTTP proxy for SSL connections.  Obviously it can
> also be used for more than just that, however, as it is your standard
> regex match (much like all other regex matching in Kannel).
> 
> Jon

-- 
Thanks,
Alex
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.