[PATCH] Fix empty device_headers with request_headers == NULL and session_headers != NULL

Paul P Komkoff Jr <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Organization Department of Fish & Wildlife
Message-ID <[email protected]>
Damn it's obvious - that's the reason kannel says 
"Device doesn't support charset <windows-1251> neither UTF-8"
while device supports utf-8

P.S. I think device_headers needs to be dwlist_destroyed, no?

-- 
Paul P 'Stingray' Komkoff Jr // http://stingr.net/key <- my pgp key
 This message represents the official view of the voices in my head
fixheaders (text/plain, 1.6 KB)
Index: gateway.C5/gw/wap-appl.c
===================================================================
--- gateway.C5.orig/gw/wap-appl.c	2005-02-28 13:36:24.222086760 +0300
+++ gateway.C5/gw/wap-appl.c	2005-02-28 13:44:28.395481216 +0300
@@ -731,7 +731,7 @@
     struct content content;
     int converted;
     WSPMachine *sm;
-    List *device_headers;
+    List *device_headers, *t_headers;
     WAPAddrTuple *addr_tuple;
     Octstr *ua, *server;
 
@@ -744,12 +744,17 @@
      * request be obviously will not find any session machine entry. */
     sm = find_session_machine_by_id(session_id);
 
+    device_headers = gwlist_create();
+
     /* ensure we pass only the original headers to the convertion routine */
-    device_headers = (orig_event->type == S_MethodInvoke_Ind) ?
+    t_headers = (orig_event->type == S_MethodInvoke_Ind) ?
+        orig_event->u.S_MethodInvoke_Ind.session_headers :
+        NULL;
+    if (t_headers != NULL) http_header_combine(device_headers, t_headers);
+    t_headers = (orig_event->type == S_MethodInvoke_Ind) ?
         orig_event->u.S_MethodInvoke_Ind.request_headers :
         orig_event->u.S_Unit_MethodInvoke_Ind.request_headers;
-    if (device_headers == NULL)
-        device_headers = gwlist_create();
+    if (t_headers != NULL) http_header_combine(device_headers, t_headers);
 
     /* 
      * We are acting as a proxy. Hence ensure we log a correct HTTP response
@@ -1056,6 +1061,7 @@
     octstr_destroy(content.type); /* body was re-used above */
     octstr_destroy(content.charset);
     octstr_destroy(url);          /* same as content.url */
+    gwlist_destroy(device_headers);
 
     counter_decrease(fetches);
 }
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.