7 fprintf(STDERR
, "FAILURE: %s\n", error_get_last());
11 function file_re($file, $pattern, $all = true) {
14 $path or $path = isset($_SERVER['argv'][1]) ?
$_SERVER['argv'][1].'/include/curl/' : "/usr/local/include/curl/";
16 if ($content = file_get_contents($path . $file)) {
18 if (preg_match_all($pattern, $content, $matches, PREG_SET_ORDER
)) {
22 if (preg_match($pattern, $content, $matches)) {
26 trigger_error("no match in $file for $pattern");
32 'COOKIELIST' => '7,14,1'
35 'PRIVATE', 'LASTSOCKET', 'FTP_ENTRY_PATH'
38 'HTTP_CONNECTCODE' => "connect_code"
43 ' if (CURLE_OK == curl_easy_getinfo(request->ch, %s, &c)) {
44 add_assoc_string_ex(&array, "%s", sizeof("%2$s"), c ? c : "", 1);
48 ' if (CURLE_OK == curl_easy_getinfo(request->ch, %s, &d)) {
49 add_assoc_double_ex(&array, "%s", sizeof("%2$s"), d);
53 ' if (CURLE_OK == curl_easy_getinfo(request->ch, %s, &l)) {
54 add_assoc_long_ex(&array, "%s", sizeof("%2$s"), l);
58 ' if (CURLE_OK == curl_easy_getinfo(request->ch, %s, &s)) {
59 MAKE_STD_ZVAL(subarray);
61 for (p = s; p; p = p->next) {
62 add_next_index_string(subarray, p->data, 1);
64 add_assoc_zval_ex(&array, "%s", sizeof("%2$s"), subarray);
65 curl_slist_free_all(s);
70 $infos = file_re('curl.h', '/^\s*(CURLINFO_(\w+))\s*=\s*CURLINFO_(STRING|LONG|DOUBLE|SLIST)\s*\+\s*\d+\s*,?\s*$/m');
73 foreach ($infos as $info) {
74 list(, $full, $short, $type) = $info;
75 if (in_array($short, $exclude)) continue;
76 if (isset($ifdefs[$short])) printf("#if HTTP_CURL_VERSION(%s)\n", $ifdefs[$short]);
77 if (isset($translate[$short])) $short = $translate[$short];
78 printf($templates[$type], $full, strtolower($short));
79 if (isset($ifdefs[$short])) printf("#endif\n");
82 file_put_contents("http_request_info.c",
83 preg_replace('/(\/\* BEGIN \*\/\n).*(\/\* END \*\/)/s', '$1'. ob_get_contents() .'$2',
84 file_get_contents("http_request_info.c")));