summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierrick Charron <pierrick@php.net>2012-08-24 10:16:40 -0400
committerPierrick Charron <pierrick@php.net>2012-08-24 10:16:40 -0400
commit4c83ecc75452a23799c39f9bbb95b617fa46bf84 (patch)
tree7a3cd9c16d907e250564add0e3a53de7754a6726
parent2c74536e6ec2a3c8edc25bfe84d19c9632c68a76 (diff)
downloadphp-git-4c83ecc75452a23799c39f9bbb95b617fa46bf84.tar.gz
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
-rw-r--r--NEWS2
-rw-r--r--ext/curl/interface.c16
2 files changed, 15 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index b51f28e821..5e482d2b2b 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 b57ce1bd07..d75e5c058b 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