X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=scripts%2Fgen_curlinfo.php;h=f234685ea7abc8c36b4a936427e9325315b3a031;hp=a07af2281c2f5485497814a9754e4ff3a9459d06;hb=ad5f896b03adaa073134a00108a9cdf00720673a;hpb=dd07cdeb2ed9752a82c9d052b42af2d639a785fd diff --git a/scripts/gen_curlinfo.php b/scripts/gen_curlinfo.php index a07af22..f234685 100644 --- a/scripts/gen_curlinfo.php +++ b/scripts/gen_curlinfo.php @@ -1,3 +1,4 @@ +#!/usr/bin/env php '7,14,1' + 'COOKIELIST' => '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)', + 'CONDITION_UNMET' => 'HTTP_CURL_VERSION(7,19,4)', ); $exclude = array( - 'PRIVATE', 'LASTSOCKET', 'FTP_ENTRY_PATH' + 'PRIVATE', 'LASTSOCKET', 'FTP_ENTRY_PATH', 'CERTINFO', ); $translate = array( 'HTTP_CONNECTCODE' => "connect_code", @@ -57,17 +62,19 @@ $templates = array( add_assoc_long_ex(&array, "%s", sizeof("%2$s"), l); } ', -'SLIST' => +'SLIST' => ' if (CURLE_OK == curl_easy_getinfo(request->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'); @@ -76,7 +83,7 @@ ob_start(); foreach ($infos as $info) { list(, $full, $short, $type) = $info; if (in_array($short, $exclude)) continue; - if (isset($ifdefs[$short])) printf("#if HTTP_CURL_VERSION(%s)\n", $ifdefs[$short]); + if (isset($ifdefs[$short])) printf("#if %s\n", $ifdefs[$short]); printf($templates[$type], $full, strtolower((isset($translate[$short])) ? $translate[$short] : $short)); if (isset($ifdefs[$short])) printf("#endif\n"); }