- enable dns data sharing for the global request datashare by default
authorMichael Wallner <mike@php.net>
Sat, 16 Sep 2006 11:57:32 +0000 (11:57 +0000)
committerMichael Wallner <mike@php.net>
Sat, 16 Sep 2006 11:57:32 +0000 (11:57 +0000)
- ensure request objects easy handle is initialized
- use curl_easy_strerror() for rc of curl_easy_setopt()

http.c
http_request_datashare_api.c

diff --git a/http.c b/http.c
index be8ccd788dcde37ca829c3c8da35b00461c11d83..b50682fa8d33ac370d457b50e121acf63b0bdc12 100644 (file)
--- a/http.c
+++ b/http.c
@@ -240,7 +240,7 @@ PHP_INI_BEGIN()
        HTTP_PHP_INI_ENTRY("http.request.methods.custom", "", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateString, request.methods.custom.ini)
 #if defined(ZEND_ENGINE_2) && defined(HTTP_HAVE_CURL)
        HTTP_PHP_INI_ENTRY("http.request.datashare.cookie", "0", PHP_INI_SYSTEM, OnUpdateBool, request.datashare.cookie)
-       HTTP_PHP_INI_ENTRY("http.request.datashare.dns", "0", PHP_INI_SYSTEM, OnUpdateBool, request.datashare.dns)
+       HTTP_PHP_INI_ENTRY("http.request.datashare.dns", "1", PHP_INI_SYSTEM, OnUpdateBool, request.datashare.dns)
        HTTP_PHP_INI_ENTRY("http.request.datashare.ssl", "0", PHP_INI_SYSTEM, OnUpdateBool, request.datashare.ssl)
        HTTP_PHP_INI_ENTRY("http.request.datashare.connect", "0", PHP_INI_SYSTEM, OnUpdateBool, request.datashare.connect)
 #endif
index 870e103382f58c39c67f9f515d4d1de1697aaf6a..2bf05632daa71b2d9312eda6831b657765c56b20 100644 (file)
@@ -25,6 +25,9 @@
 #ifndef HAVE_CURL_SHARE_STRERROR
 #      define curl_share_strerror(dummy) "unknown error"
 #endif
+#ifndef HAVE_CURL_EASY_STRERROR
+#      define curl_easy_strerror(dummy) "unknown error"
+#endif
 
 static HashTable http_request_datashare_options;
 static http_request_datashare http_request_datashare_global;
@@ -130,8 +133,9 @@ PHP_HTTP_API STATUS _http_request_datashare_attach(http_request_datashare *share
                }
        }
        
+       HTTP_CHECK_CURL_INIT(obj->request->ch, http_curl_init_ex(obj->request->ch, obj->request), return FAILURE);
        if (CURLE_OK != (rc = curl_easy_setopt(obj->request->ch, CURLOPT_SHARE, share->ch))) {
-               http_error_ex(HE_WARNING, HTTP_E_REQUEST, "Could not attach HttpRequest object(#%d) to the HttpRequestDataShare: %s", Z_OBJ_HANDLE_P(request), curl_share_strerror(rc));
+               http_error_ex(HE_WARNING, HTTP_E_REQUEST, "Could not attach HttpRequest object(#%d) to the HttpRequestDataShare: %s", Z_OBJ_HANDLE_P(request), curl_easy_strerror(rc));
                return FAILURE;
        }