- add "@" to allowed token characters
authorMichael Wallner <mike@php.net>
Sat, 11 Feb 2006 12:19:10 +0000 (12:19 +0000)
committerMichael Wallner <mike@php.net>
Sat, 11 Feb 2006 12:19:10 +0000 (12:19 +0000)
- add general error message on failure

http_api.c

index 1d3f657dd9b5f5ada83dd5469bb54150aff2d90f..a17c608cf991d9f280106515447b5b4cda26122b 100644 (file)
@@ -137,21 +137,16 @@ PHP_HTTP_API STATUS _http_parse_cookie(const char *list, HashTable *items TSRMLS
                switch (st)
                {
                        case ST_QUOTE:
-                               switch (*c)
-                               {
-                                       case '"':
-                                               if (*(c-1) != '\\') {
-                                                       st = ST_ADD;
-                                               } else {
-                                                       memmove(c-1, c, strlen(c)+1);
-                                               }
-                                       break;
-                                       
-                                       default:
-                                               if (!val) {
-                                                       val = c;
-                                               }
-                                       break;
+                               if (*c == '"') {
+                                       if (*(c-1) != '\\') {
+                                               st = ST_ADD;
+                                       } else {
+                                               memmove(c-1, c, strlen(c)+1);
+                                       }
+                               } else {
+                                       if (!val) {
+                                               val = c;
+                                       }
                                }
                        break;
                                
@@ -190,6 +185,7 @@ PHP_HTTP_API STATUS _http_parse_cookie(const char *list, HashTable *items TSRMLS
                                        case '.':
                                        case '_':
                                        case '$':
+                                       case '@':
                                                if (!key) {
                                                        key = c;
                                                }
@@ -264,6 +260,7 @@ PHP_HTTP_API STATUS _http_parse_cookie(const char *list, HashTable *items TSRMLS
        return SUCCESS;
        
 failure:
+       http_error_ex(HE_WARNING, HTTP_E_INVALID_PARAM, "Unexpected character (%c) at pos %tu of %zu", *c, c-s, strlen(s));
        efree(s);
        return FAILURE;
 }