Wap cookies patch
"Nikos Balkanas" <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <006201c9865e$bd574230$02b2a8c0@tardis> |
Hi,
The following is a simple patch to align cookies with RFC 2068 (HTTP 1.1) & 2109 (cookie). It decreases memory requirements, processing time, and handles correctly cookies that have '=' in their values.
From RFC 2068:
token = 1*<any CHAR except CTLs or tspecials>
tspecials = "(" | ")" | "<" | ">" | "@"
| "," | ";" | ":" | "\" | <">
| "/" | "[" | "]" | "?" | "="
| "{" | "}" | SP | HT
From RFC 2109:
av-pairs = av-pair *(";" av-pair)
av-pair = attr ["=" value] ; optional value
attr = token
value = word
word = token | quoted-string
Therefore in a NAME = VALUE pair in a cookie, NAME cannot contain any of those fancy characters.
Please vote and commit.
Thanx,
Nikos
patch.diff
(application/octet-stream, 527 B)
Index: wap/cookies.c
===================================================================
RCS file: /home/cvs/gateway/wap/cookies.c,v
retrieving revision 1.22
diff -u -r1.22 cookies.c
--- wap/cookies.c 12 Jan 2009 16:46:58 -0000 1.22
+++ wap/cookies.c 4 Feb 2009 00:17:59 -0000
@@ -297,7 +297,7 @@
else { /* Name value pair - this should be first */
char *equals = NULL;
- if ((equals = strrchr(p, '=')) != NULL) {
+ if ((equals = strchr(p, '=')) != NULL) {
*equals = '\0';
c->name = octstr_create(p);