X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=scripts%2Fgen_curlinfo.php;h=076a10d10f86bd34e1a354ea5a34b028bb9dc6ed;hp=54137ba2c9e3b528aa1f1a5b09d8fe0b59a22cb1;hb=refs%2Fheads%2Fv2.5.x;hpb=c52642ccff4fe2887c9d5581816a7cae55766df4 diff --git a/scripts/gen_curlinfo.php b/scripts/gen_curlinfo.php old mode 100644 new mode 100755 index 54137ba..076a10d --- a/scripts/gen_curlinfo.php +++ b/scripts/gen_curlinfo.php @@ -1,6 +1,6 @@ #!/usr/bin/env php 'HTTP_CURL_VERSION(7,14,1)', - 'PRIMARY_IP' => 'HTTP_CURL_VERSION(7,19,0)', - 'APPCONNECT_TIME' => 'HTTP_CURL_VERSION(7,19,0)', - 'REDIRECT_URL' => 'HTTP_CURL_VERSION(7,18,2)', - 'CERTINFO' => 'HTTP_CURL_VERSION(7,19,1) && defined(HTTP_HAVE_OPENSSL)' + 'PRIMARY_IP' => 'PHP_HTTP_CURL_VERSION(7,19,0)', + 'APPCONNECT_TIME' => 'PHP_HTTP_CURL_VERSION(7,19,0)', + 'CONDITION_UNMET' => 'PHP_HTTP_CURL_VERSION(7,19,4)', + '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)', ); $exclude = array( - 'PRIVATE', 'LASTSOCKET', 'FTP_ENTRY_PATH' + 'PRIVATE', 'LASTSOCKET', 'FTP_ENTRY_PATH', 'CERTINFO', 'TLS_SESSION', + 'RTSP_SESSION_ID', 'RTSP_CLIENT_CSEQ', 'RTSP_SERVER_CSEQ', 'RTSP_CSEQ_RECV', + 'COOKIELIST' ); + $translate = array( 'HTTP_CONNECTCODE' => "connect_code", 'COOKIELIST' => 'cookies', @@ -48,31 +52,33 @@ $translate = array( $templates = array( 'STRING' => -' if (CURLE_OK == curl_easy_getinfo(request->ch, %s, &c)) { +' if (CURLE_OK == curl_easy_getinfo(ch, %s, &c)) { add_assoc_string_ex(&array, "%s", sizeof("%2$s"), c ? c : "", 1); } ', 'DOUBLE' => -' if (CURLE_OK == curl_easy_getinfo(request->ch, %s, &d)) { +' if (CURLE_OK == curl_easy_getinfo(ch, %s, &d)) { add_assoc_double_ex(&array, "%s", sizeof("%2$s"), d); } ', 'LONG' => -' if (CURLE_OK == curl_easy_getinfo(request->ch, %s, &l)) { +' if (CURLE_OK == curl_easy_getinfo(ch, %s, &l)) { add_assoc_long_ex(&array, "%s", sizeof("%2$s"), l); } ', -'SLIST' => -' if (CURLE_OK == curl_easy_getinfo(request->ch, %s, &s)) { +'SLIST' => +' if (CURLE_OK == curl_easy_getinfo(ch, %s, &s)) { MAKE_STD_ZVAL(subarray); array_init(subarray); for (p = s; p; p = p->next) { - add_next_index_string(subarray, p->data, 1); + if (p->data) { + add_next_index_string(subarray, p->data, 1); + } } add_assoc_zval_ex(&array, "%s", sizeof("%2$s"), subarray); curl_slist_free_all(s); } -' +', ); $infos = file_re('curl.h', '/^\s*(CURLINFO_(\w+))\s*=\s*CURLINFO_(STRING|LONG|DOUBLE|SLIST)\s*\+\s*\d+\s*,?\s*$/m'); @@ -86,8 +92,8 @@ foreach ($infos as $info) { if (isset($ifdefs[$short])) printf("#endif\n"); } -file_put_contents("http_request_info.c", - preg_replace('/(\/\* BEGIN \*\/\n).*(\/\* END \*\/)/s', '$1'. ob_get_contents() .'$2', - file_get_contents("http_request_info.c"))); +file_put_contents("php_http_client_curl.c", + preg_replace('/(\/\* BEGIN::CURLINFO \*\/\n).*(\n\s*\/\* END::CURLINFO \*\/)/s', '$1'. ob_get_contents() .'$2', + file_get_contents("php_http_client_curl.c"))); ?>