From: Michael Wallner Date: Mon, 12 Dec 2005 22:21:38 +0000 (+0000) Subject: - fix warning X-Git-Tag: RELEASE_0_20_0~17 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=cf24fb7a4a7140efa82a1ac15fac79347283d6fb;p=m6w6%2Fext-http - fix warning - improve request error messages --- diff --git a/config.w32 b/config.w32 index e18d586..cc7a938 100644 --- a/config.w32 +++ b/config.w32 @@ -95,7 +95,6 @@ if (PHP_HTTP != "no") { AC_DEFINE("HAVE_CURL_MULTI_STRERROR", 1, ""); AC_DEFINE("HAVE_CURL_EASY_STRERROR", 1, ""); AC_DEFINE("HAVE_CURL_EASY_RESET", 1, ""); - AC_DEFINE("CURL_STATICLIB", 1, ""); } else { WARNING("curl convenience functions not enabled; libraries and headers not found"); } diff --git a/http_request_api.c b/http_request_api.c index b0a845d..42a1199 100644 --- a/http_request_api.c +++ b/http_request_api.c @@ -292,6 +292,8 @@ PHP_HTTP_API void _http_request_defaults(http_request *request) #if defined(ZTS) HTTP_CURL_OPT(NOSIGNAL, 1); #endif + HTTP_CURL_OPT(PRIVATE, request); + HTTP_CURL_OPT(ERRORBUFFER, request->_error); HTTP_CURL_OPT(HEADER, 0); HTTP_CURL_OPT(FILETIME, 1); HTTP_CURL_OPT(AUTOREFERER, 1); @@ -380,7 +382,6 @@ PHP_HTTP_API STATUS _http_request_prepare(http_request *request, HashTable *opti /* set options */ HTTP_CURL_OPT(DEBUGDATA, request); HTTP_CURL_OPT(URL, request->url); - HTTP_CURL_OPT(PRIVATE, request->url); /* progress callback */ if ((zoption = http_request_option(request, options, "onprogress", 0))) { @@ -670,7 +671,7 @@ PHP_HTTP_API void _http_request_exec(http_request *request) TSRMLS_FETCH_FROM_CTX(request->tsrm_ls); if (CURLE_OK != (result = curl_easy_perform(request->ch))) { - http_error_ex(HE_WARNING, HTTP_E_REQUEST, "%s (%s)", curl_easy_strerror(result), request->url); + http_error_ex(HE_WARNING, HTTP_E_REQUEST, "%s; %s (%s)", curl_easy_strerror(result), request->_error, request->url); } } /* }}} */ diff --git a/http_request_pool_api.c b/http_request_pool_api.c index 191ab44..7c37320 100644 --- a/http_request_pool_api.c +++ b/http_request_pool_api.c @@ -256,9 +256,9 @@ PHP_HTTP_API int _http_request_pool_perform(http_request_pool *pool TSRMLS_DC) if (CURLMSG_DONE == msg->msg) { if (CURLE_OK != msg->data.result) { http_request_pool_try { - char *url = NULL; - curl_easy_getinfo(msg->easy_handle, CURLINFO_PRIVATE, &url); - http_error_ex(HE_WARNING, HTTP_E_REQUEST, "%s (%s)", curl_easy_strerror(msg->data.result), url); + http_request *r = NULL; + curl_easy_getinfo(msg->easy_handle, CURLINFO_PRIVATE, &r); + http_error_ex(HE_WARNING, HTTP_E_REQUEST, "%s; %s (%s)", curl_easy_strerror(msg->data.result), r?r->_error:"", r?r->url:""); } http_request_pool_catch(); } http_request_pool_try { diff --git a/php_http.h b/php_http.h index e646c20..dce7b59 100644 --- a/php_http.h +++ b/php_http.h @@ -22,7 +22,6 @@ #include "phpstr/phpstr.h" #include "missing.h" - #ifdef HTTP_WANT_NETDB # ifdef PHP_WIN32 # include @@ -34,6 +33,7 @@ #if defined(HTTP_WANT_CURL) && defined(HTTP_HAVE_CURL) # ifdef PHP_WIN32 # include +# define CURL_STATICLIB # endif # include #endif diff --git a/php_http_request_api.h b/php_http_request_api.h index 52be094..9608611 100644 --- a/php_http_request_api.h +++ b/php_http_request_api.h @@ -41,6 +41,7 @@ typedef struct { struct curl_slist *headers; } _cache; + char _error[CURL_ERROR_SIZE]; zval *_progress_callback; #ifdef ZTS