From e33c13f52c027e18fccbf47daa817f7d72518dfd Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Wed, 5 Apr 2006 14:48:39 +0000 Subject: [PATCH] - fix errenous bailout of http_parse_headers() introduced with last commit --- http_headers_api.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) 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; } -- 2.30.2