From: Michael Wallner Date: Wed, 5 Apr 2006 14:48:39 +0000 (+0000) Subject: - fix errenous bailout of http_parse_headers() introduced with last commit X-Git-Tag: RELEASE_1_0_0RC3~16 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=e33c13f52c027e18fccbf47daa817f7d72518dfd;p=m6w6%2Fext-http - fix errenous bailout of http_parse_headers() introduced with last commit --- diff --git a/http_headers_api.c b/http_headers_api.c index 7ac4756..a5448a9 100644 --- a/http_headers_api.c +++ b/http_headers_api.c @@ -328,9 +328,10 @@ PHP_HTTP_API STATUS _http_parse_headers_ex(const char *header, HashTable *header { const char *colon = NULL, *line = header; zval array; - + INIT_ZARR(array, headers); +#define MORE_HEADERS (*(line-1) && !(*(line-1) == '\n' && (*line == '\n' || *line == '\r'))) do { int value_len = 0; @@ -353,11 +354,8 @@ PHP_HTTP_API STATUS _http_parse_headers_ex(const char *header, HashTable *header callback_func(callback_data, &headers, &i TSRMLS_CC); http_info_dtor(&i); Z_ARRVAL(array) = headers; - } else - - /* "header: value" pair */ - if (colon) { - + } else if (colon) { + /* "header: value" pair */ /* skip empty key */ if (header != colon) { zval **previous = NULL; @@ -395,7 +393,7 @@ PHP_HTTP_API STATUS _http_parse_headers_ex(const char *header, HashTable *header } efree(key); } - } else { + } else if (MORE_HEADERS) { return FAILURE; } colon = NULL; @@ -404,7 +402,7 @@ PHP_HTTP_API STATUS _http_parse_headers_ex(const char *header, HashTable *header } break; } - } while (*(line-1) && !(*(line-1) == '\n' && (*line == '\n' || *line == '\r'))); + } while (MORE_HEADERS); return SUCCESS; }