From: Michael Wallner Date: Sun, 10 Apr 2005 15:56:35 +0000 (+0000) Subject: - error workaround X-Git-Tag: RELEASE_0_8_0~94 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=5c295d7204cd8e961b5c44a54e87563df1b058dc;p=m6w6%2Fext-http - error workaround --- diff --git a/http_curl_api.c b/http_curl_api.c index b7d622e..b576b2f 100644 --- a/http_curl_api.c +++ b/http_curl_api.c @@ -25,15 +25,16 @@ #include +#include "phpstr/phpstr.h" + #include "php.h" #include "php_http.h" +#include "php_http_std_defs.h" #include "php_http_api.h" #include "php_http_curl_api.h" -#include "php_http_std_defs.h" - -#include "phpstr/phpstr.h" +#include "php_http_url_api.h" -ZEND_DECLARE_MODULE_GLOBALS(http) +ZEND_EXTERN_MODULE_GLOBALS(http) #if LIBCURL_VERSION_NUM >= 0x070c01 # define http_curl_reset(ch) curl_easy_reset(ch) @@ -42,7 +43,10 @@ ZEND_DECLARE_MODULE_GLOBALS(http) #endif #if LIBCURL_VERSION_NUM < 0x070c00 +# define http_curl_error(dummy) HTTP_G(curlerr) # define curl_easy_strerror(code) "unkown error" +#else +# define http_curl_error(code) curl_easy_strerror(code) #endif #define http_curl_startup(ch, clean_curl, URL, options) \ @@ -108,7 +112,6 @@ static inline char *_http_curl_copystr(const char *str TSRMLS_DC) static size_t http_curl_body_callback(char *buf, size_t len, size_t n, void *s) { TSRMLS_FETCH(); - phpstr_append(&HTTP_G(curlbuf), buf, len *= n); return len; } @@ -123,7 +126,6 @@ static size_t http_curl_hdrs_callback(char *buf, size_t len, size_t n, void *s) if (HTTP_G(curlbuf).used && (!strncmp(buf, "HTTP/1.", sizeof("HTTP/1.") - 1))) { phpstr_free(&HTTP_G(curlbuf)); } - phpstr_append(&HTTP_G(curlbuf), buf, len *= n); return len; } @@ -174,6 +176,9 @@ static void _http_curl_setopts(CURL *ch, const char *url, HashTable *options TSR #if defined(ZTS) && (LIBCURL_VERSION_NUM >= 0x070a00) HTTP_CURL_OPT(NOSIGNAL, 1); #endif +#if LIBCURL_VERSION_NUM < 0x070c00 + HTTP_CURL_OPT(ERRORBUFFER, HTTP_G(curlerr)); +#endif if ((!options) || (1 > zend_hash_num_elements(options))) { return;