switch (st)
{
case ST_QUOTE:
+ quote:
if (*c == '"') {
- if (*(c-1) != '\\') {
- st = ST_ADD;
- } else {
+ if (*(c-1) == '\\') {
memmove(c-1, c, strlen(c)+1);
+ goto quote;
+ } else {
+ goto add;
}
} else {
if (!val) {
break;
case ';':
- if (!*(c+1)) {
- goto add;
- }
case '\0':
+ goto add;
st = ST_ADD;
break;
add:
if (val) {
vallen = c - val;
- if (*c) --vallen;
- while (val[vallen-1] == ' ') --vallen;
+ if (st != ST_QUOTE) {
+ while (val[vallen-1] == ' ') --vallen;
+ }
} else {
val = "";
vallen = 0;
</maintainer>
</maintainers>
<release>
- <version>0.23.0</version>
+ <version>0.23.1</version>
<date>2006-02-15</date>
<license>BSD, revised</license>
<state>beta</state>
- <notes>+ Added 'etag' request option.
-+ Added 'encodecookies' request option (defaults to true).
-+ Added missing accessors for response status text to HttpMessage and HttpRequest classes.
-+ Added HttpMessage::reverse().
-+ Added bool must_revalidate parameter to HttpResponse::setCacheControl()
-
-- Reimplemented http_parse_cookie().
-- Changed HttpRequest::getResponseCookie() to HttpRequest::getResponseCookies(),
- compliant to http_parse_cookie().
-- http_build_url() now tries to "resolve" public hostname prior falling back
- to localhost if neither HTTP_HOST nor SERVER_NAME is set.
-- Changed HttpRequest::getHistory() to return a real property.
-
-* Fixed PHP-4.4 and PHP-5.0 build.
+ <notes>* Fixed http_parse_cookie(), really.
</notes>
<deps>
<dep type="php" rel="ge" version="4.3"/>
<file role="test" name="ob_deflatehandler_001.phpt"/>
<file role="test" name="ob_inflatehandler_001.phpt"/>
<file role="test" name="parse_cookie_001.phpt"/>
+ <file role="test" name="parse_cookie_002.phpt"/>
<file role="test" name="parse_headers_001.phpt"/>
<file role="test" name="parse_message_001.phpt"/>
<file role="test" name="parse_message_002.phpt"/>
</lead>
<date>2006-00-00</date>
<version>
- <release>0.23.0</release>
+ <release>0.23.1</release>
<api>0.23.0</api>
</version>
<stability>
</stability>
<license>BSD, revised</license>
<notes><![CDATA[
-+ Added 'etag' request option.
-+ Added 'encodecookies' request option (defaults to true).
-+ Added missing accessors for response status text to HttpMessage and HttpRequest classes.
-+ Added HttpMessage::reverse().
-+ Added bool must_revalidate parameter to HttpResponse::setCacheControl()
-
-- Reimplemented http_parse_cookie().
-- Changed HttpRequest::getResponseCookie() to HttpRequest::getResponseCookies(),
- compliant to http_parse_cookie().
-- http_build_url() now tries to "resolve" public hostname prior falling back
- to localhost if neither HTTP_HOST nor SERVER_NAME is set.
-- Changed HttpRequest::getHistory() to return a real property.
-
-* Fixed PHP-4.4 and PHP-5.0 build.
+* Fixed http_parse_cookie(), really.
]]></notes>
<contents>
<dir name="/">
<file role="test" name="ob_deflatehandler_001.phpt"/>
<file role="test" name="ob_inflatehandler_001.phpt"/>
<file role="test" name="parse_cookie_001.phpt"/>
+ <file role="test" name="parse_cookie_002.phpt"/>
<file role="test" name="parse_headers_001.phpt"/>
<file role="test" name="parse_message_001.phpt"/>
<file role="test" name="parse_message_002.phpt"/>
#ifndef PHP_EXT_HTTP_H
#define PHP_EXT_HTTP_H
-#define PHP_EXT_HTTP_VERSION "0.23.0dev"
+#define PHP_EXT_HTTP_VERSION "0.23.1"
#ifdef HAVE_CONFIG_H
# include "config.h"
--- /dev/null
+--TEST--
+parse cookie
+--SKIPIF--
+<?php
+include 'skip.inc';
+?>
+--FILE--
+<?php
+echo "-TEST\n";
+
+var_dump(http_parse_cookie('foo')->cookies['foo']);
+var_dump(http_parse_cookie('foo;')->cookies['foo']);
+var_dump(http_parse_cookie('foo ')->cookies['foo']);
+var_dump(http_parse_cookie('foo ;')->cookies['foo']);
+var_dump(http_parse_cookie('foo ; ')->cookies['foo']);
+var_dump(http_parse_cookie('foo=')->cookies['foo']);
+var_dump(http_parse_cookie('foo=;')->cookies['foo']);
+var_dump(http_parse_cookie('foo =')->cookies['foo']);
+var_dump(http_parse_cookie('foo =;')->cookies['foo']);
+var_dump(http_parse_cookie('foo= ')->cookies['foo']);
+var_dump(http_parse_cookie('foo= ;')->cookies['foo']);
+
+var_dump(http_parse_cookie('foo=1')->cookies['foo']);
+var_dump(http_parse_cookie('foo=1;')->cookies['foo']);
+var_dump(http_parse_cookie('foo=1 ;')->cookies['foo']);
+var_dump(http_parse_cookie('foo= 1;')->cookies['foo']);
+var_dump(http_parse_cookie('foo = 1;')->cookies['foo']);
+var_dump(http_parse_cookie('foo = 1 ;')->cookies['foo']);
+var_dump(http_parse_cookie('foo=1')->cookies['foo']);
+var_dump(http_parse_cookie('foo= 1')->cookies['foo']);
+
+var_dump(http_parse_cookie('foo="1"')->cookies['foo']);
+var_dump(http_parse_cookie('foo="1" ')->cookies['foo']);
+var_dump(http_parse_cookie('foo="1";')->cookies['foo']);
+var_dump(http_parse_cookie('foo = "1" ;')->cookies['foo']);
+var_dump(http_parse_cookie('foo= "1" ')->cookies['foo']);
+
+var_dump(http_parse_cookie('foo=""')->cookies['foo']);
+var_dump(http_parse_cookie('foo="\""')->cookies['foo']);
+var_dump(http_parse_cookie('foo=" "')->cookies['foo']);
+var_dump(http_parse_cookie('foo= "')->cookies['foo']);
+var_dump(http_parse_cookie('foo=" ')->cookies['foo']);
+var_dump(http_parse_cookie('foo= " ')->cookies['foo']);
+
+echo "Done\n";
+?>
+--EXPECTF--
+%sTEST
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(0) ""
+string(1) """
+string(1) " "
+string(1) """
+string(1) """
+string(1) """
+Done