[PATCH] Siemens SX1 kludge
Paul P Komkoff Jr <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Organization | Department of Fish & Wildlife |
| Message-ID | <[email protected]> |
Ok well, yes I know I was offline fot _too_ _long_. I can't promise I will not do the same again :) Now, to the kannel. Guess what Siemens SX1 latest firmware sends in request headers? It sends an \0x80 \0x00! Of course kannel is unable to do anything useful, because Accept for application/...wmlc is below that line, so voila. I don't know is this handset behavior conforms to wsp spec, or not (have no time to check yet). But anyway, we have plenty of these here, and users report that they are aple to browse through our competitors. Patch attached. -- Paul P 'Stingray' Komkoff Jr // http://stingr.net/key <- my pgp key This message represents the official view of the voices in my head
sx1_kludge
(text/plain, 2.6 KB)
Index: gateway.B4/wap/wsp_headers.c
===================================================================
--- gateway.B4.orig/wap/wsp_headers.c 2005-01-18 20:55:11.644366264 +0300
+++ gateway.B4/wap/wsp_headers.c 2005-01-18 20:57:31.372124416 +0300
@@ -104,13 +104,13 @@
* WSP_FIELD_VALUE_DATA: Leave parsing position at start of data, and set
* a parse limit at the end of data.
*/
-int wsp_field_value(ParseContext *context, int *well_known_value)
+int wsp_field_value(ParseContext *context, int *well_known_value, int kludge)
{
int val;
unsigned long len;
val = parse_get_char(context);
- if (val >= 0 && val < 31) {
+ if (((val > 0) || (val == 0 && !kludge)) && val < 31) {
*well_known_value = -1;
parse_limit(context, val);
return WSP_FIELD_VALUE_DATA;
@@ -140,7 +140,7 @@
int val;
int ret;
- ret = wsp_field_value(context, &val);
+ ret = wsp_field_value(context, &val, 0);
if (ret == WSP_FIELD_VALUE_DATA) {
parse_skip_to_limit(context);
parse_pop_limit(context);
@@ -795,7 +795,7 @@
int ret;
int val;
- ret = wsp_field_value(context, &val);
+ ret = wsp_field_value(context, &val, 0);
if (parse_error(context) || ret == WSP_FIELD_VALUE_DATA) {
warning(0, "Bad field-name encoding");
return NULL;
@@ -827,7 +827,7 @@
int ret;
int val;
- ret = wsp_field_value(context, &val);
+ ret = wsp_field_value(context, &val, 0);
if (parse_error(context) || ret == WSP_FIELD_VALUE_DATA) {
warning(0, "Bad cache-directive");
goto error;
@@ -1035,7 +1035,7 @@
unsigned char *ch = NULL;
Octstr *decoded = NULL;
- ret = wsp_field_value(context, &val);
+ ret = wsp_field_value(context, &val, (field_type == WSP_HEADER_ACCEPT) ? 1 : 0);
if (parse_error(context)) {
warning(0, "Faulty header, skipping remaining headers.");
parse_skip_to_limit(context);
Index: gateway.B4/wap/wsp_headers.h
===================================================================
--- gateway.B4.orig/wap/wsp_headers.h 2005-01-18 20:55:11.646365960 +0300
+++ gateway.B4/wap/wsp_headers.h 2005-01-18 20:56:48.327668168 +0300
@@ -123,7 +123,7 @@
/* All WSP packing/unpacking routines that are exported for use within
* external modules, ie. MMS encoding/decoding.
*/
-int wsp_field_value(ParseContext *context, int *well_known_value);
+int wsp_field_value(ParseContext *context, int *well_known_value, int kludge);
void wsp_skip_field_value(ParseContext *context);
int wsp_secondary_field_value(ParseContext *context, long *result);
void parm_destroy_item(void *parm);