From: Michael Wallner Date: Wed, 14 Sep 2016 07:54:24 +0000 (+0200) Subject: Merge branch 'v2.6.x' X-Git-Tag: RELEASE_3_1_0_RC1~27 X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=commitdiff_plain;h=e7f3c1766222862532aadbfbafdb6017fef2747c Merge branch 'v2.6.x' --- e7f3c1766222862532aadbfbafdb6017fef2747c diff --cc src/php_http_buffer.c index b214f1d,64e559a..d7cfd56 --- a/src/php_http_buffer.c +++ b/src/php_http_buffer.c @@@ -32,12 -30,15 +32,16 @@@ PHP_HTTP_BUFFER_API php_http_buffer_t * return buf; } -PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_from_string_ex(php_http_buffer_t *buf, const char *string, size_t length) +PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_from_string_ex( + php_http_buffer_t *buf, const char *str, size_t len) { + int free_buf = !!buf; + if ((buf = php_http_buffer_init(buf))) { - if (PHP_HTTP_BUFFER_NOMEM == php_http_buffer_append(buf, string, length)) { + if (PHP_HTTP_BUFFER_NOMEM == php_http_buffer_append(buf, str, len)) { - pefree(buf, buf->pmem); + if (free_buf) { + pefree(buf, buf->pmem); + } buf = NULL; } } diff --cc src/php_http_env_response.c index 6324698,b4927a1..3a5a8e8 --- a/src/php_http_env_response.c +++ b/src/php_http_env_response.c @@@ -339,24 -362,21 +339,20 @@@ static ZEND_RESULT_CODE php_http_env_re return ret; } - if ((zoption = get_option(options, ZEND_STRL("headers") TSRMLS_CC))) { + if ((zoption = get_option(options, ZEND_STRL("headers"), &zoption_tmp))) { if (Z_TYPE_P(zoption) == IS_ARRAY) { - php_http_header_to_callback(Z_ARRVAL_P(zoption), 0, (php_http_pass_format_callback_t) r->ops->set_header, r TSRMLS_CC); + php_http_header_to_callback(Z_ARRVAL_P(zoption), 0, (php_http_pass_format_callback_t) r->ops->set_header, r); } - zval_ptr_dtor(&zoption); + zval_ptr_dtor(zoption); } - if (ret != SUCCESS) { - return ret; - } - - if ((zoption = get_option(options, ZEND_STRL("responseCode") TSRMLS_CC))) { - zval *zoption_copy = php_http_ztyp(IS_LONG, zoption); + if ((zoption = get_option(options, ZEND_STRL("responseCode"), &zoption_tmp))) { + zend_long rc = zval_get_long(zoption); - zval_ptr_dtor(&zoption); - if (Z_LVAL_P(zoption_copy) > 0) { - ret = r->ops->set_status(r, Z_LVAL_P(zoption_copy)); + zval_ptr_dtor(zoption); + if (rc > 0) { + ret = r->ops->set_status(r, rc); } - zval_ptr_dtor(&zoption_copy); } if (ret != SUCCESS) { diff --cc src/php_http_filter.c index f145f02,9b39104..92bfd15 --- a/src/php_http_filter.c +++ b/src/php_http_filter.c @@@ -301,8 -301,10 +301,10 @@@ static PHP_HTTP_FILTER_FUNCTION(zlib #endif nxt = ptr->next; - php_stream_bucket_unlink(ptr TSRMLS_CC); + php_stream_bucket_unlink(ptr); - php_http_encoding_stream_update(buffer, ptr->buf, ptr->buflen, &encoded, &encoded_len); + if (SUCCESS != php_http_encoding_stream_update(buffer, ptr->buf, ptr->buflen, &encoded, &encoded_len)) { + return PSFS_ERR_FATAL; + } #if DBG_FILTER fprintf(stderr, "update: deflate (-> %zu) (w: %zu, r: %zu)\n", encoded_len, stream->writepos, stream->readpos);