From: Michael Wallner Date: Sat, 11 Feb 2006 13:59:07 +0000 (+0000) Subject: - fix 'a=b ;' X-Git-Tag: RELEASE_0_23_0~18 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=10723276d6fc8e7a57f24038a2854342ebe3f23b;p=m6w6%2Fext-http - fix 'a=b ;' - fix 'c=".*' --- diff --git a/http_api.c b/http_api.c index a17c608..d85b923 100644 --- a/http_api.c +++ b/http_api.c @@ -101,7 +101,7 @@ PHP_HTTP_API STATUS _http_parse_cookie(const char *list, HashTable *items TSRMLS c = s = estrdup(list); for(;;) { -#if 0 +#if char *tk = NULL, *tv = NULL; if (key) { @@ -147,6 +147,10 @@ PHP_HTTP_API STATUS _http_parse_cookie(const char *list, HashTable *items TSRMLS if (!val) { val = c; } + if (!*c) { + --val; + st = ST_ADD; + } } break; @@ -162,8 +166,11 @@ PHP_HTTP_API STATUS _http_parse_cookie(const char *list, HashTable *items TSRMLS case ' ': break; - case '\0': case ';': + goto add; + break; + + case '\0': st = ST_ADD; break; @@ -208,8 +215,10 @@ PHP_HTTP_API STATUS _http_parse_cookie(const char *list, HashTable *items TSRMLS break; case '\0': - keylen = c - key; - st = ST_ADD; + if (key) { + keylen = c - key; + st = ST_ADD; + } break; } break; @@ -228,6 +237,7 @@ PHP_HTTP_API STATUS _http_parse_cookie(const char *list, HashTable *items TSRMLS add: if (val) { vallen = c - val - (*c?1:0); + while (val[vallen-1] == ' ') --vallen; } else { val = ""; vallen = 0;