fix problem when finishing a chunked encoding stream
authorMichael Wallner <mike@php.net>
Wed, 8 Sep 2010 11:47:10 +0000 (11:47 +0000)
committerMichael Wallner <mike@php.net>
Wed, 8 Sep 2010 11:47:10 +0000 (11:47 +0000)
php_http_cookie.c
php_http_encoding.c
php_http_message_parser.c

index 1ac08c218f4041aecf44a2b31ce8b036c6e02d1b..c23b608f8455c14f4acf7a6801f697b971d5dbc2 100644 (file)
@@ -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;
index 34c6922d4c9daa82f082552ca02d6dd983a5c635..a300eb561fa54048b249ca525191988ca1e31cb6 100644 (file)
@@ -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);
index e2751a415e145e6634abfe6c565e80e3054c2ce4..312a44fbc544b5717bdfd11aad96b72fa4712305 100644 (file)
@@ -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)) {