8 // this is why error_get_last() should return a stdClass object
9 $error = error_get_last();
10 fprintf(STDERR
, "FAILURE: %s\n", $error["message"]);
14 function file_re($file, $pattern, $all = true) {
17 $path or $path = isset($_SERVER['argv'][1]) ?
$_SERVER['argv'][1].'/include/curl/' : "/usr/local/include/curl/";
19 if ($content = file_get_contents($path . $file)) {
21 if (preg_match_all($pattern, $content, $matches, PREG_SET_ORDER
)) {
25 if (preg_match($pattern, $content, $matches)) {
29 trigger_error("no match in $file for $pattern");
35 'COOKIELIST' => '7,14,1'
38 'PRIVATE', 'LASTSOCKET', 'FTP_ENTRY_PATH'
41 'HTTP_CONNECTCODE' => "connect_code",
42 'COOKIELIST' => 'cookies',
47 ' if (CURLE_OK == curl_easy_getinfo(request->ch, %s, &c)) {
48 add_assoc_string_ex(&array, "%s", sizeof("%2$s"), c ? c : "", 1);
52 ' if (CURLE_OK == curl_easy_getinfo(request->ch, %s, &d)) {
53 add_assoc_double_ex(&array, "%s", sizeof("%2$s"), d);
57 ' if (CURLE_OK == curl_easy_getinfo(request->ch, %s, &l)) {
58 add_assoc_long_ex(&array, "%s", sizeof("%2$s"), l);
62 ' if (CURLE_OK == curl_easy_getinfo(request->ch, %s, &s)) {
63 MAKE_STD_ZVAL(subarray);
65 for (p = s; p; p = p->next) {
66 add_next_index_string(subarray, p->data, 1);
68 add_assoc_zval_ex(&array, "%s", sizeof("%2$s"), subarray);
69 curl_slist_free_all(s);
74 $infos = file_re('curl.h', '/^\s*(CURLINFO_(\w+))\s*=\s*CURLINFO_(STRING|LONG|DOUBLE|SLIST)\s*\+\s*\d+\s*,?\s*$/m');
77 foreach ($infos as $info) {
78 list(, $full, $short, $type) = $info;
79 if (in_array($short, $exclude)) continue;
80 if (isset($ifdefs[$short])) printf("#if HTTP_CURL_VERSION(%s)\n", $ifdefs[$short]);
81 printf($templates[$type], $full, strtolower((isset($translate[$short])) ?
$translate[$short] : $short));
82 if (isset($ifdefs[$short])) printf("#endif\n");
85 file_put_contents("http_request_info.c",
86 preg_replace('/(\/\* BEGIN \*\/\n).*(\/\* END \*\/)/s', '$1'. ob_get_contents() .'$2',
87 file_get_contents("http_request_info.c")));