Daily patch: gateway

kannel at kannel.org kannel at kannel.org
Tue Jan 25 06:30:02 CET 2011


Index: ChangeLog
===================================================================
--- ChangeLog	(revision 4876)
+++ ChangeLog	(revision 4878)
@@ -1,3 +1,7 @@
+2011-01-24 Alexander Malysh <amalysh at kannel.org>
+    * gw/bearerbox.c: Added support for HTTP-Proxy.
+      Thanks to Christoph Gysin <christoph.gysin at fr33z3.org> for this patch.
+
 2011-01-10 Alejandro Guerrieri <aguerrieri at kannel.org>
     * doc/userguide/userguide.xml: documentation parts for the syslog.
     * gw/[bearer|sms|wap]box.c, gwlib/cfg.def, gwlib/log.[ch]: Extended the 
Index: gw/bearerbox.c
===================================================================
--- gw/bearerbox.c	(revision 4876)
+++ gw/bearerbox.c	(revision 4878)
@@ -377,6 +377,13 @@
     Octstr *ssl_server_key_file;
     int ssl_enabled = 0;
 #endif /* HAVE_LIBSSL */
+    Octstr *http_proxy_host = NULL;
+    long http_proxy_port = -1;
+    int http_proxy_ssl = 0;
+    List *http_proxy_exceptions = NULL;
+    Octstr *http_proxy_username = NULL;
+    Octstr *http_proxy_password = NULL;
+    Octstr *http_proxy_exceptions_regex = NULL;
 
     /* defaults: use localtime and markers for access-log */
     lf = m = 1;
@@ -449,6 +456,22 @@
     octstr_destroy(val);
     octstr_destroy(log);
 
+    cfg_get_integer(&http_proxy_port, grp, octstr_imm("http-proxy-port"));
+#ifdef HAVE_LIBSSL
+    cfg_get_bool(&http_proxy_ssl, grp, octstr_imm("http-proxy-ssl"));
+#endif /* HAVE_LIBSSL */
+
+    http_proxy_host = cfg_get(grp, 
+    	    	    	octstr_imm("http-proxy-host"));
+    http_proxy_username = cfg_get(grp, 
+    	    	    	    octstr_imm("http-proxy-username"));
+    http_proxy_password = cfg_get(grp, 
+    	    	    	    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"));
+
     conn_config_ssl (grp);
 
     /*
@@ -563,7 +586,19 @@
     if (cfg_get_single_group(cfg, octstr_imm("wapbox")) != NULL)
         start_wap(cfg);
 #endif
-    
+
+    if (http_proxy_host != NULL && http_proxy_port > 0) {
+    	http_use_proxy(http_proxy_host, http_proxy_port, http_proxy_ssl,
+		       http_proxy_exceptions, http_proxy_username,
+                       http_proxy_password, http_proxy_exceptions_regex);
+    }
+
+    octstr_destroy(http_proxy_host);
+    octstr_destroy(http_proxy_username);
+    octstr_destroy(http_proxy_password);
+    octstr_destroy(http_proxy_exceptions_regex);
+    gwlist_destroy(http_proxy_exceptions, octstr_destroy_item);
+
     return cfg;
 }
 
Index: gw/smsbox.c
===================================================================
--- gw/smsbox.c	(revision 4876)
+++ gw/smsbox.c	(revision 4878)
@@ -908,11 +908,10 @@
     }
 
     if (validity != SMS_PARAM_UNDEFINED) {
-	if (urltrans_accept_x_kannel_headers(trans))
-	    msg->sms.validity = validity;
-	else
-	    warning(0, "Tried to change validity to '%d', denied.",
-		    validity);
+        if (urltrans_accept_x_kannel_headers(trans))
+            msg->sms.validity = validity;
+        else
+            warning(0, "Tried to change validity to '%d', denied.", validity);
     }
     if (deferred != SMS_PARAM_UNDEFINED) {
 	if (urltrans_accept_x_kannel_headers(trans))
@@ -1367,9 +1366,8 @@
 	}
 	if (msg->sms.validity != SMS_PARAM_UNDEFINED) {
 	    Octstr *os;
-	    os = octstr_format("%d",msg->sms.validity);
-	    http_header_add(request_headers, "X-Kannel-Validity",
-	    	octstr_get_cstr(os));
+	    os = octstr_format("%d", msg->sms.validity);
+	    http_header_add(request_headers, "X-Kannel-Validity", octstr_get_cstr(os));
 	    octstr_destroy(os);
 	}
 	if (msg->sms.deferred != SMS_PARAM_UNDEFINED) {






More information about the devel-reports mailing list