From: Michael Wallner Date: Wed, 9 Nov 2005 16:05:23 +0000 (+0000) Subject: * Fixed a bug which required "=" in Content-Range response message headers X-Git-Tag: RELEASE_0_18_0~17 X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=commitdiff_plain;h=953b5ac37ad4aa801c7160ca69521d6424a5f6e1 * Fixed a bug which required "=" in Content-Range response message headers --- diff --git a/http_message_api.c b/http_message_api.c index f749228..d175201 100644 --- a/http_message_api.c +++ b/http_message_api.c @@ -188,7 +188,8 @@ PHP_HTTP_API http_message *_http_message_parse_ex(http_message *msg, const char if (c = http_message_header(msg, "Content-Range")) { ulong total = 0, start = 0, end = 0, len = 0; - if (!strncasecmp(Z_STRVAL_P(c), "bytes=", lenof("bytes="))) { + if (!strncasecmp(Z_STRVAL_P(c), "bytes", lenof("bytes")) && + (Z_STRVAL_P(c)[lenof("bytes")] == '=' || Z_STRVAL_P(c)[lenof("bytes")] == ' ')) { char *total_at = NULL, *end_at = NULL; char *start_at = Z_STRVAL_P(c) + lenof("bytes="); diff --git a/package2.xml b/package2.xml index 6dd1827..c648637 100644 --- a/package2.xml +++ b/package2.xml @@ -46,6 +46,7 @@ * Fixed a bug that caused a warning about an invalid curl handle at HttpRequestPool destruction * Fixed a bug with http_get_request_headers() modifying $_SERVER array +* Fixed a bug which required "=" in Content-Range response message headers ]]> diff --git a/tests/parse_message_005.phpt b/tests/parse_message_005.phpt new file mode 100644 index 0000000..0ddeb05 --- /dev/null +++ b/tests/parse_message_005.phpt @@ -0,0 +1,60 @@ +--TEST-- +http_parse_message() content range header w/(o) = +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +%sTEST +stdClass Object +( + [type] => 2 + [httpVersion] => 1.1 + [responseCode] => 206 + [responseStatus] => + [headers] => Array + ( + [Server] => Funky/1.0 + [Content-Range] => bytes 0-0/100 + ) + + [body] => 1 + [parentMessage] => stdClass Object + ( + [type] => 2 + [httpVersion] => 1.1 + [responseCode] => 206 + [responseStatus] => + [headers] => Array + ( + [Server] => Funky/1.0 + [Content-Range] => bytes=0-0/100 + ) + + [body] => 1 + [parentMessage] => + ) + +) +Done