X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http_api.c;h=5599ef5db845224961abc685fa3ad2375d56a70d;hp=4fa8c3d5b703203f92b84c083e421500bc7f8a9b;hb=34c551d43ab4fbfff88a81e545a43fbbf7a8a75d;hpb=5ba379899fb1e05ede73674dc010ce8846e051c2 diff --git a/http_api.c b/http_api.c index 4fa8c3d..5599ef5 100644 --- a/http_api.c +++ b/http_api.c @@ -6,7 +6,7 @@ | modification, are permitted provided that the conditions mentioned | | in the accompanying LICENSE file are met. | +--------------------------------------------------------------------+ - | Copyright (c) 2004-2007, Michael Wallner | + | Copyright (c) 2004-2010, Michael Wallner | +--------------------------------------------------------------------+ */ @@ -180,7 +180,10 @@ zval *_http_exception_wrap(zval *old_exception, zval *new_exception, zend_class_ copy_bt_args(old_exception, new_exception TSRMLS_CC); copy_bt_args(old_exception, sub_exception TSRMLS_CC); } - +#if PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3 + Z_ADDREF_P(old_exception); + zend_exception_set_previous(new_exception, old_exception TSRMLS_CC); +#endif zval_ptr_dtor(&old_exception); return new_exception; } @@ -357,6 +360,9 @@ PHP_HTTP_API STATUS _http_get_request_body_ex(char **body, size_t *length, zend_ memcpy(*body + *length, buf, len); *length += len; (*body)[*length] = '\0'; + if (len < (int) sizeof(buf)) { + break; + } } /* check for error */ @@ -395,6 +401,9 @@ PHP_HTTP_API php_stream *_http_get_request_body_stream(TSRMLS_D) while (0 < (len = sapi_module.read_post(buf, sizeof(buf) TSRMLS_CC))) { php_stream_write(s, buf, len); + if (len < (int) sizeof(buf)) { + break; + } } if (len < 0) {