Re: Nokia 7210 Problems

Vjacheslav Chekushin <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Organization LMT
Message-ID <[email protected]>
Hi,

Andreas Fink wrote:

> 
> 
> On Dienstag, Januar 14, 2003, at 12:27 Uhr, David Chkhartishvili wrote:
> 
>     Hi List,
> 
>     I have problems accessing http://mobile.club.nokia.com from Nokia
>     7210 using kannel-cvs.
>     Debug says:
> 
>     2003-01-14 15:22:38 [16] DEBUG: HTTP: Status line: <HTTP/1.1 413
>     Request Entity Too Large>
>     2003-01-14 15:22:38 [8] WARNING: WSP: Content type <text/html> not
>     supported by client, deleting body.
> 
>     In the mean time I can access that page using SonyEricsson T68i.
>     Could anyone point out what's the problem.
> 
>     Sounds very strange, that Nokia handset can't access nokia site =)
> 
> 
> the problem is the nokia site, not the nokia phone.
> I actually can not see this website from any of my nokia's over 
> Swisscom's WAP gateway either, nor over kannel.
> Their website returns a mime type of text/html which is not correct. The 
> phones cant display HTML.
> 
> 
> Andreas Fink
> Fink Consulting GmbH
> 

The problem is that kannel compose every header on its own line.
The solution for that - to pack http header
(create a comma separated list for http header values).

I can propose patch for all who is interested in it.
It eliminates <HTTP/1.1 413 Request Entity Too Large> problem for me.

(To apply this patch, go to kannel directory with Makefile and run:
patch -p0 < http_pack.patch )

-- 
Vjacheslav Chekushin                                mailto:[email protected]
Latvian Mobile Phone Company                        http://www.lmt.lv
http_pack.patch (text/plain, 1.8 KB)
--- ../devel_1.2.1_base/gwlib/http.c	Thu Jan  2 12:04:16 2003
+++ gwlib/http.c	Mon Jan  6 15:56:58 2003
@@ -2327,12 +2327,65 @@
     return new;
 }
 
+static int http_header_cmp(void *a, void *b) {
+  Octstr *header,*pat;
+  
+  header = a;
+  pat = b;
+
+  if (octstr_ncompare(header, pat, octstr_len(pat)) == 0) {
+    return 1;
+  }
+
+  return 0;
+}
 
 void http_header_pack(List *headers)
 {
-    gwlib_assert_init();
-    gw_assert(headers != NULL);
-    /* XXX not implemented yet. */
+  List *new_headers,*tmp_list;
+  Octstr *name,*name_col,*value,*curr,*raw_header;
+  int i;
+
+  gwlib_assert_init();
+  gw_assert(headers != NULL);
+  tmp_list = NULL;
+
+  new_headers = http_create_empty_headers();
+  
+  for (i = 0; i < list_len(headers); i++) {
+    http_header_get(headers, i, &name, &value);
+    name_col = octstr_duplicate(name);
+    octstr_append_cstr(name_col,":");
+    if ((curr = list_search(new_headers, name_col, http_header_cmp)) == NULL) {
+      http_header_add(new_headers, octstr_get_cstr(name), octstr_get_cstr(value));
+    } else {
+      if (octstr_len(curr) > 256) { 
+	if (tmp_list == NULL) {
+	  tmp_list = list_create();
+	}
+	raw_header = octstr_duplicate(curr);
+	list_append(tmp_list,raw_header);
+	http_header_remove_all(new_headers, octstr_get_cstr(name));
+	http_header_add(new_headers, octstr_get_cstr(name), octstr_get_cstr(value));
+      } else {
+	octstr_append_cstr(curr,", ");
+	octstr_append(curr,value);
+      }
+    }
+    octstr_destroy(name);
+    octstr_destroy(value);
+    octstr_destroy(name_col);
+    
+  }
+
+  http_header_combine(headers, new_headers);
+  http_destroy_headers(new_headers);
+  if (tmp_list != NULL) {
+    while ((curr = list_extract_first(tmp_list)) !=  NULL) {
+      list_append(headers, curr);
+    }
+    list_destroy(tmp_list,NULL);
+  }
 }
http_pack.patch.gz (application/x-gzip, 736 B) - not displayed
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.