From: Michael Wallner Date: Fri, 23 Feb 2018 07:18:44 +0000 (+0100) Subject: update curl info X-Git-Tag: RELEASE_3_2_0_RC1~34 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=02db4df1bc8a7a6fef41297c082ecfe5d259ca96;p=m6w6%2Fext-http update curl info --- diff --git a/scripts/gen_curlinfo.php b/scripts/gen_curlinfo.php index 376a7e5..9fae4cb 100755 --- a/scripts/gen_curlinfo.php +++ b/scripts/gen_curlinfo.php @@ -10,9 +10,9 @@ function failure() { function file_re($file, $pattern, $all = true) { static $path; - + $path or $path = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1].'/include/curl/' : "/usr/local/include/curl/"; - + if ($content = file_get_contents($path . $file)) { if ($all) { if (preg_match_all($pattern, $content, $matches, PREG_SET_ORDER)) { @@ -35,7 +35,10 @@ $ifdefs = array( 'PRIMARY_PORT' => 'PHP_HTTP_CURL_VERSION(7,21,0)', 'LOCAL_PORT' => 'PHP_HTTP_CURL_VERSION(7,21,0)', 'LOCAL_IP' => 'PHP_HTTP_CURL_VERSION(7,21,0)', - 'HTTP_VERSION' => 'PHP_HTTP_CURL_VERSION(7,50,0)' + 'HTTP_VERSION' => 'PHP_HTTP_CURL_VERSION(7,50,0)', + 'PROXY_SSL_VERIFYRESULT' => 'PHP_HTTP_CURL_VERSION(7,52,0)', + 'PROTOCOL' => 'PHP_HTTP_CURL_VERSION(7,52,0)', + 'SCHEME' => 'PHP_HTTP_CURL_VERSION(7,52,0)', ); $exclude = array( 'ACTIVESOCKET', @@ -58,19 +61,19 @@ $translate = array( ); $templates = array( -'STRING' => +'STRING' => ' if (CURLE_OK == curl_easy_getinfo(ch, %s, &c)) { ZVAL_STRING(&tmp, STR_PTR(c)); zend_hash_str_update(info, "%s", lenof("%2$s"), &tmp); } ', -'DOUBLE' => +'DOUBLE' => ' if (CURLE_OK == curl_easy_getinfo(ch, %s, &d)) { ZVAL_DOUBLE(&tmp, d); zend_hash_str_update(info, "%s", lenof("%2$s"), &tmp); } ', -'LONG' => +'LONG' => ' if (CURLE_OK == curl_easy_getinfo(ch, %s, &l)) { ZVAL_LONG(&tmp, l); zend_hash_str_update(info, "%s", lenof("%2$s"), &tmp); @@ -101,7 +104,7 @@ foreach ($infos as $info) { if (isset($ifdefs[$short])) printf("#endif\n"); } -file_put_contents("src/php_http_client_curl.c", +file_put_contents("src/php_http_client_curl.c", preg_replace('/(\/\* BEGIN::CURLINFO \*\/\n).*(\n\s*\/\* END::CURLINFO \*\/)/s', '$1'. ob_get_contents() .'$2', file_get_contents("src/php_http_client_curl.c"))); diff --git a/src/php_http_client_curl.c b/src/php_http_client_curl.c index f07bb8f..f07b5b8 100644 --- a/src/php_http_client_curl.c +++ b/src/php_http_client_curl.c @@ -480,6 +480,24 @@ static ZEND_RESULT_CODE php_http_curle_get_info(CURL *ch, HashTable *info) zend_hash_str_update(info, "http_version", lenof("http_version"), &tmp); } #endif +#if PHP_HTTP_CURL_VERSION(7,52,0) + if (CURLE_OK == curl_easy_getinfo(ch, CURLINFO_PROXY_SSL_VERIFYRESULT, &l)) { + ZVAL_LONG(&tmp, l); + zend_hash_str_update(info, "proxy_ssl_verifyresult", lenof("proxy_ssl_verifyresult"), &tmp); + } +#endif +#if PHP_HTTP_CURL_VERSION(7,52,0) + if (CURLE_OK == curl_easy_getinfo(ch, CURLINFO_PROTOCOL, &l)) { + ZVAL_LONG(&tmp, l); + zend_hash_str_update(info, "protocol", lenof("protocol"), &tmp); + } +#endif +#if PHP_HTTP_CURL_VERSION(7,52,0) + if (CURLE_OK == curl_easy_getinfo(ch, CURLINFO_SCHEME, &c)) { + ZVAL_STRING(&tmp, STR_PTR(c)); + zend_hash_str_update(info, "scheme", lenof("scheme"), &tmp); + } +#endif /* END::CURLINFO */