{
php_curl *ch = (php_curl *) ctx;
php_curl_read *t = ch->handlers->read;
- int length = -1;
+ int length = 0;
switch (t->method) {
case PHP_CURL_DIRECT:
ch->in_callback = 0;
if (error == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_READFUNCTION");
- length = -1;
+#if LIBCURL_VERSION_NUM >= 0x070c01 /* 7.12.1 */
+ length = CURL_READFUNC_ABORT;
+#endif
} else if (retval_ptr) {
if (Z_TYPE_P(retval_ptr) == IS_STRING) {
length = MIN(size * nmemb, Z_STRLEN_P(retval_ptr));