- add "ipresolve" request option
authorMichael Wallner <mike@php.net>
Sun, 5 Nov 2006 18:22:31 +0000 (18:22 +0000)
committerMichael Wallner <mike@php.net>
Sun, 5 Nov 2006 18:22:31 +0000 (18:22 +0000)
- add HTTP_IPRESOLVE_{ANY|V4|V6} HttpRequest::IPRESOLVE_{ANY|V4|V6} constants

http_request_api.c
http_request_object.c

index b2f997bc70eb10fd2df4338e9ee7398ecbd35048..ea63dfa6df2ee4d4f35bcd0f1d793ea4b2c6864d 100644 (file)
@@ -114,6 +114,10 @@ PHP_MINIT_FUNCTION(http_request)
        HTTP_LONG_CONSTANT("HTTP_VERSION_NONE", CURL_HTTP_VERSION_NONE);
        HTTP_LONG_CONSTANT("HTTP_VERSION_1_0", CURL_HTTP_VERSION_1_0);
        HTTP_LONG_CONSTANT("HTTP_VERSION_1_1", CURL_HTTP_VERSION_1_1);
+       
+       HTTP_LONG_CONSTANT("HTTP_IPRESOLVE_V4", CURL_IPRESOLVE_V4);
+       HTTP_LONG_CONSTANT("HTTP_IPRESOLVE_V6", CURL_IPRESOLVE_V6);
+       HTTP_LONG_CONSTANT("HTTP_IPRESOLVE_ANY", CURL_IPRESOLVE_WHATEVER);
 
 #if HTTP_CURL_VERSION(7,15,2)
        HTTP_LONG_CONSTANT("HTTP_PROXY_SOCKS4", CURLPROXY_SOCKS4);
@@ -348,6 +352,7 @@ PHP_HTTP_API void _http_request_defaults(http_request *request)
                HTTP_CURL_OPT(CURLOPT_PROXYUSERPWD, NULL);
                HTTP_CURL_OPT(CURLOPT_PROXYAUTH, 0L);
                HTTP_CURL_OPT(CURLOPT_DNS_CACHE_TIMEOUT, 60L);
+               HTTP_CURL_OPT(CURLOPT_IPRESOLVE, 0);
                HTTP_CURL_OPT(CURLOPT_LOW_SPEED_LIMIT, 0L);
                HTTP_CURL_OPT(CURLOPT_LOW_SPEED_TIME, 0L);
 #if HTTP_CURL_VERSION(7,15,5)
@@ -476,6 +481,9 @@ PHP_HTTP_API STATUS _http_request_prepare(http_request *request, HashTable *opti
        if ((zoption = http_request_option(request, options, "dns_cache_timeout", IS_LONG))) {
                HTTP_CURL_OPT(CURLOPT_DNS_CACHE_TIMEOUT, Z_LVAL_P(zoption));
        }
+       if ((zoption = http_request_option(request, options, "ipresolve", IS_LONG)) && Z_LVAL_P(zoption)) {
+               HTTP_CURL_OPT(CURLOPT_IPRESOLVE, Z_LVAL_P(zoption));
+       }
        
        /* limits */
        if ((zoption = http_request_option(request, options, "low_speed_limit", IS_LONG))) {
index b9e8af7f37ace2a5434ae77ebe601af8093e22b9..7e110b9a534f76afb6c084933c30625d67ce2062 100644 (file)
@@ -397,6 +397,13 @@ PHP_MINIT_FUNCTION(http_request_object)
        DCL_CONST(long, "VERSION_1_1", CURL_HTTP_VERSION_1_1);
        DCL_CONST(long, "VERSION_NONE", CURL_HTTP_VERSION_NONE);
 
+       /*
+       * DNS IPvX resolving
+       */
+       DCL_CONST(long, "IPRESOLVE_V4", CURL_IPRESOLVE_V4);
+       DCL_CONST(long, "IPRESOLVE_V6", CURL_IPRESOLVE_V6);
+       DCL_CONST(long, "IPRESOLVE_ANY", CURL_IPRESOLVE_WHATEVER);
+
        /*
        * Auth Constants
        */