1
0
Fork 0

Attempted fix for string quouting problem!

This commit is contained in:
bagyenda 2005-07-06 05:58:16 +00:00
parent 17d3517eec
commit f6c90d2c9a
1 changed files with 46 additions and 1 deletions

View File

@ -916,7 +916,7 @@ diff -Naur gateway-1.4.0/test/test_ppg.c gateway-1.4.0-patched/test/test_ppg.c
diff -Naur gateway-1.4.0/wap/wsp_headers.c gateway-1.4.0-patched/wap/wsp_headers.c
--- gateway-1.4.0/wap/wsp_headers.c 2004-08-08 23:39:56.000000000 +0300
+++ gateway-1.4.0-patched/wap/wsp_headers.c 2005-07-05 12:19:53.000000000 +0300
+++ gateway-1.4.0-patched/wap/wsp_headers.c 2005-07-06 08:48:20.000000000 +0300
@@ -122,10 +122,9 @@
} else if (val > 127) {
*well_known_value = val - 128;
@ -930,3 +930,48 @@ diff -Naur gateway-1.4.0/wap/wsp_headers.c gateway-1.4.0-patched/wap/wsp_headers
} else {
*well_known_value = -1;
/* Un-parse the character we just read */
@@ -1487,7 +1486,7 @@
{ WSP_HEADER_X_WAP_CONTENT_URI, pack_uri, 0},
{ WSP_HEADER_X_WAP_INITIATOR_URI, pack_uri, 0},
{ WSP_HEADER_X_WAP_APPLICATION_ID, wsp_pack_integer_string, 0},
- { WSP_HEADER_CONTENT_ID, wsp_pack_text, 0},
+ { WSP_HEADER_CONTENT_ID, wsp_pack_quoted_text, 0},
{ WSP_HEADER_ENCODING_VERSION, wsp_pack_version_value, 0 }
// DAVI { WSP_HEADER_SET_COOKIE, pack_version_value, 0 }
};
@@ -1616,13 +1615,23 @@
{
/* This check catches 0-length strings as well, because
* octstr_get_char will return -1. */
- if (octstr_get_char(text, 0) >= 128 || octstr_get_char(text, 0) < 32)
+ if (octstr_get_char(text, 0) >= 128 || octstr_get_char(text, 0) < 32 ||
+ octstr_get_char(text, 0) == '"') /* quote the quote as well. */
octstr_append_char(packed, WSP_QUOTE);
octstr_append(packed, text);
octstr_append_char(packed, 0);
return 0;
}
+/* Pack a string as quoted-text WAP WSP 203, Section 8.4.2.1 */
+int wsp_pack_quoted_text(Octstr *packed, Octstr *text)
+{
+ octstr_append_char(packed, '"');
+ octstr_append(packed,text);
+ octstr_append_char(packed,0);
+ return 0;
+}
+
/* Pack text as Quoted-string if it starts with a " character.
* Pack it as Text-string otherwise. */
static void pack_quoted_string(Octstr *packed, Octstr *text)
diff -Naur gateway-1.4.0/wap/wsp_headers.h gateway-1.4.0-patched/wap/wsp_headers.h
--- gateway-1.4.0/wap/wsp_headers.h 2004-01-26 18:06:38.000000000 +0300
+++ gateway-1.4.0-patched/wap/wsp_headers.h 2005-07-06 08:19:01.000000000 +0300
@@ -141,6 +141,7 @@
int wsp_pack_date(Octstr *packet, Octstr *value);
int wsp_pack_retry_after(Octstr *packet, Octstr *value);
int wsp_pack_text(Octstr *packet, Octstr *value);
+int wsp_pack_quoted_text(Octstr *packed, Octstr *text);
int wsp_pack_integer_string(Octstr *packet, Octstr *value);
int wsp_pack_version_value(Octstr *packet, Octstr *value);
int wsp_pack_constrained_value(Octstr *packed, Octstr *text, long value);