From: Michael Wallner Date: Wed, 8 Sep 2010 11:47:10 +0000 (+0000) Subject: fix problem when finishing a chunked encoding stream X-Git-Tag: DEV_2-before-client~142 X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=commitdiff_plain;h=b233c50a85448c251d23a1bdce3e9003c4ee03b8 fix problem when finishing a chunked encoding stream --- diff --git a/php_http_cookie.c b/php_http_cookie.c index 1ac08c2..c23b608 100644 --- a/php_http_cookie.c +++ b/php_http_cookie.c @@ -221,8 +221,6 @@ PHP_HTTP_API void php_http_cookie_list_to_struct(php_http_cookie_list_t *list, z add_assoc_string(&array, "domain", STR_PTR(list->domain), 1); } - - PHP_HTTP_API php_http_cookie_list_t *php_http_cookie_list_from_struct(php_http_cookie_list_t *list, zval *strct TSRMLS_DC) { zval **tmp, *cpy; diff --git a/php_http_encoding.c b/php_http_encoding.c index 34c6922..a300eb5 100644 --- a/php_http_encoding.c +++ b/php_http_encoding.c @@ -295,6 +295,8 @@ PHP_HTTP_API STATUS php_http_encoding_stream_update(php_http_encoding_stream_t * PHP_HTTP_API STATUS php_http_encoding_stream_flush(php_http_encoding_stream_t *s, char **out_str, size_t *out_len) { if (!s->ops->flush) { + *out_str = NULL; + *out_len = 0; return SUCCESS; } return s->ops->flush(s, out_str, out_len); @@ -311,6 +313,8 @@ PHP_HTTP_API zend_bool php_http_encoding_stream_done(php_http_encoding_stream_t PHP_HTTP_API STATUS php_http_encoding_stream_finish(php_http_encoding_stream_t *s, char **out_str, size_t *out_len) { if (!s->ops->finish) { + *out_str = NULL; + *out_len = 0; return SUCCESS; } return s->ops->finish(s, out_str, out_len); diff --git a/php_http_message_parser.c b/php_http_message_parser.c index e2751a4..312a44f 100644 --- a/php_http_message_parser.c +++ b/php_http_message_parser.c @@ -302,8 +302,8 @@ PHP_HTTP_API php_http_message_parser_state_t php_http_message_parser_parse(php_h * - body done * N: - parse ahaed */ - size_t dec_len; char *dec_str = NULL; + size_t dec_len; if (SUCCESS != php_http_encoding_stream_update(parser->dechunk, buffer->data, buffer->used, &dec_str, &dec_len TSRMLS_CC)) { return FAILURE; @@ -327,7 +327,7 @@ PHP_HTTP_API php_http_message_parser_state_t php_http_message_parser_parse(php_h php_http_message_parser_state_push(parser, 1, PHP_HTTP_MESSAGE_PARSER_STATE_DONE); if (parser->dechunk) { - char *dec_str; + char *dec_str = NULL; size_t dec_len; if (SUCCESS != php_http_encoding_stream_finish(parser->dechunk, &dec_str, &dec_len TSRMLS_CC)) {