a07af2281c2f5485497814a9754e4ff3a9459d06
7 // this is why error_get_last() should return a stdClass object
8 $error = error_get_last();
9 fprintf(STDERR
, "FAILURE: %s\n", $error["message"]);
13 function file_re($file, $pattern, $all = true) {
16 $path or $path = isset($_SERVER['argv'][1]) ?
$_SERVER['argv'][1].'/include/curl/' : "/usr/local/include/curl/";
18 if ($content = file_get_contents($path . $file)) {
20 if (preg_match_all($pattern, $content, $matches, PREG_SET_ORDER
)) {
24 if (preg_match($pattern, $content, $matches)) {
28 trigger_error("no match in $file for $pattern");
34 'COOKIELIST' => '7,14,1'
37 'PRIVATE', 'LASTSOCKET', 'FTP_ENTRY_PATH'
40 'HTTP_CONNECTCODE' => "connect_code",
41 'COOKIELIST' => 'cookies',
46 ' if (CURLE_OK == curl_easy_getinfo(request->ch, %s, &c)) {
47 add_assoc_string_ex(&array, "%s", sizeof("%2$s"), c ? c : "", 1);
51 ' if (CURLE_OK == curl_easy_getinfo(request->ch, %s, &d)) {
52 add_assoc_double_ex(&array, "%s", sizeof("%2$s"), d);
56 ' if (CURLE_OK == curl_easy_getinfo(request->ch, %s, &l)) {
57 add_assoc_long_ex(&array, "%s", sizeof("%2$s"), l);
61 ' if (CURLE_OK == curl_easy_getinfo(request->ch, %s, &s)) {
62 MAKE_STD_ZVAL(subarray);
64 for (p = s; p; p = p->next) {
65 add_next_index_string(subarray, p->data, 1);
67 add_assoc_zval_ex(&array, "%s", sizeof("%2$s"), subarray);
68 curl_slist_free_all(s);
73 $infos = file_re('curl.h', '/^\s*(CURLINFO_(\w+))\s*=\s*CURLINFO_(STRING|LONG|DOUBLE|SLIST)\s*\+\s*\d+\s*,?\s*$/m');
76 foreach ($infos as $info) {
77 list(, $full, $short, $type) = $info;
78 if (in_array($short, $exclude)) continue;
79 if (isset($ifdefs[$short])) printf("#if HTTP_CURL_VERSION(%s)\n", $ifdefs[$short]);
80 printf($templates[$type], $full, strtolower((isset($translate[$short])) ?
$translate[$short] : $short));
81 if (isset($ifdefs[$short])) printf("#endif\n");
84 file_put_contents("http_request_info.c",
85 preg_replace('/(\/\* BEGIN \*\/\n).*(\/\* END \*\/)/s', '$1'. ob_get_contents() .'$2',
86 file_get_contents("http_request_info.c")));