Commit:    4c83ecc75452a23799c39f9bbb95b617fa46bf84
Author:    Pierrick Charron <pierr...@php.net>         Fri, 24 Aug 2012 
10:16:40 -0400
Parents:   2c74536e6ec2a3c8edc25bfe84d19c9632c68a76
Branches:  PHP-5.4

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=4c83ecc75452a23799c39f9bbb95b617fa46bf84

Log:
Fixed bug #62912 (CURLINFO_PRIMARY_IP is not exposed)

CURLINFO_PRIMARY_* and CURLINFO_LOCAL_* where available in curl_getinfo
but the constant itself was not exposed to php userland

Bugs:
https://bugs.php.net/62912

Changed paths:
  M  NEWS
  M  ext/curl/interface.c


Diff:
diff --git a/NEWS b/NEWS
index b51f28e..5e482d2 100644
--- a/NEWS
+++ b/NEWS
@@ -22,6 +22,8 @@ PHP                                                           
             NEWS
     constructor). (Stas)
 
 - CURL:
+  . Fixed bug #62912 (CURLINFO_PRIMARY_* AND CURLINFO_LOCAL_* not exposed).
+       (Pierrick)
   . Fixed bug #62839 (curl_copy_handle segfault with CURLOPT_FILE). (Pierrick)
 
 - DateTime:
diff --git a/ext/curl/interface.c b/ext/curl/interface.c
index b57ce1b..d75e5c0 100644
--- a/ext/curl/interface.c
+++ b/ext/curl/interface.c
@@ -713,6 +713,14 @@ PHP_MINIT_FUNCTION(curl)
 #if LIBCURL_VERSION_NUM >= 0x071202
     REGISTER_CURL_CONSTANT(CURLINFO_REDIRECT_URL);
 #endif
+#if LIBCURL_VERSION_NUM >= 0x071300 /* 7.19.0 */
+       REGISTER_CURL_CONSTANT(CURLINFO_PRIMARY_IP);
+#endif
+#if LIBCURL_VERSION_NUM >= 0x071500 /* 7.21.0 */
+       REGISTER_CURL_CONSTANT(CURLINFO_PRIMARY_PORT);
+       REGISTER_CURL_CONSTANT(CURLINFO_LOCAL_IP);
+       REGISTER_CURL_CONSTANT(CURLINFO_LOCAL_PORT);
+#endif
 
 
        /* cURL protocol constants (curl_version) */
@@ -2447,6 +2455,8 @@ PHP_FUNCTION(curl_getinfo)
                        create_certinfo(ci, listcode TSRMLS_CC);
                        CAAZ("certinfo", listcode);
                }
+#endif
+#if LIBCURL_VERSION_NUM >= 0x071300 /* 7.19.0 */
                if (curl_easy_getinfo(ch->cp, CURLINFO_PRIMARY_IP, &s_code) == 
CURLE_OK) {
                        CAAS("primary_ip", s_code);
                }
@@ -2473,10 +2483,10 @@ PHP_FUNCTION(curl_getinfo)
        } else {
                switch (option) {
                        /* string variable types */
-#if LIBCURL_VERSION_NUM >= 0x071500
+#if LIBCURL_VERSION_NUM >= 0x071300 /* 7.19.0 */
                        case CURLINFO_PRIMARY_IP:
 #endif
-#if LIBCURL_VERSION_NUM >= 0x071500
+#if LIBCURL_VERSION_NUM >= 0x071500 /* 7.21.0 */
                        case CURLINFO_LOCAL_IP:
 #endif
                        case CURLINFO_PRIVATE:
@@ -2496,7 +2506,7 @@ PHP_FUNCTION(curl_getinfo)
                                break;
                        }
                        /* Long variable types */
-#if LIBCURL_VERSION_NUM >= 0x071500
+#if LIBCURL_VERSION_NUM >= 0x071500 /* 7.21.0 */
                        case CURLINFO_PRIMARY_PORT:
                        case CURLINFO_LOCAL_PORT:
 #endif


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to