X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=scripts%2Fgen_curlinfo.php;fp=scripts%2Fgen_curlinfo.php;h=0000000000000000000000000000000000000000;hp=b69c96c5e2a781513fd4073e5aefb5de355ac5e7;hb=87db9817d428282792c8146d9c2ae9748ebf6f1e;hpb=7a5c865f6faf8b1b6c91735e9d3b040449ea74ba diff --git a/scripts/gen_curlinfo.php b/scripts/gen_curlinfo.php deleted file mode 100644 index b69c96c..0000000 --- a/scripts/gen_curlinfo.php +++ /dev/null @@ -1,100 +0,0 @@ -#!/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)', - 'CONDITION_UNMET' => 'HTTP_CURL_VERSION(7,19,4)', - 'PRIMARY_PORT' => 'HTTP_CURL_VERSION(7,21,0)', - 'LOCAL_PORT' => 'HTTP_CURL_VERSION(7,21,0)', - 'LOCAL_IP' => 'HTTP_CURL_VERSION(7,21,0)', -); -$exclude = array( - 'PRIVATE', 'LASTSOCKET', 'FTP_ENTRY_PATH', 'CERTINFO', - 'RTSP_SESSION_ID', 'RTSP_CLIENT_CSEQ', 'RTSP_SERVER_CSEQ', 'RTSP_CSEQ_RECV' -); - -$translate = array( - 'HTTP_CONNECTCODE' => "connect_code", - 'COOKIELIST' => 'cookies', -); - -$templates = array( -'STRING' => -' if (CURLE_OK == curl_easy_getinfo(request->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)) { - add_assoc_double_ex(&array, "%s", sizeof("%2$s"), d); - } -', -'LONG' => -' if (CURLE_OK == curl_easy_getinfo(request->ch, %s, &l)) { - add_assoc_long_ex(&array, "%s", sizeof("%2$s"), l); - } -', -'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) { - 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'); - -ob_start(); -foreach ($infos as $info) { - list(, $full, $short, $type) = $info; - if (in_array($short, $exclude)) continue; - 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"); -} - -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"))); - -?>