- release 1.5.0
[m6w6/ext-http] / scripts / gen_curlinfo.php
index 129833a2a9fe87c435eabfff2ebe482a19032520..a07af2281c2f5485497814a9754e4ff3a9459d06 100644 (file)
@@ -4,7 +4,9 @@
 error_reporting(0);
 
 function failure() {
-       fprintf(STDERR, "FAILURE: %s\n", error_get_last());
+       // this is why error_get_last() should return a stdClass object
+       $error = error_get_last();
+       fprintf(STDERR, "FAILURE: %s\n", $error["message"]);
        exit(-1);
 }
 
@@ -28,14 +30,6 @@ function file_re($file, $pattern, $all = true) {
        failure();
 }
 
-function version($major, $minor, $pl) {
-       static $version;
-       
-       $version or $version = file_re('curlver.h', '/^#\s*define\s+LIBCURL_VERSION\s+"(\d+)\.(\d+)\.(\d+)(?:-\w+)?"\s*$/m', false);
-       
-       return $major <= $version[1] && $minor <= $version[2] && $pl <= $version[3];
-}
-
 $ifdefs = array(
        'COOKIELIST' => '7,14,1'
 );
@@ -43,7 +37,8 @@ $exclude = array(
        'PRIVATE', 'LASTSOCKET', 'FTP_ENTRY_PATH'
 );
 $translate = array(
-       'HTTP_CONNECTCODE' => "connect_code"
+       'HTTP_CONNECTCODE' => "connect_code",
+       'COOKIELIST' => 'cookies',
 );
 
 $templates = array(
@@ -75,7 +70,6 @@ $templates = array(
 '
 );
 
-$types = file_re('curl.h', '/^#\s*define\s+CURLINFO_(STRING|LONG|DOUBLE|SLIST|MASK|TYPEMASK)\s+(0x[0-9a-fA-F]+)\s*$/m');
 $infos = file_re('curl.h', '/^\s*(CURLINFO_(\w+))\s*=\s*CURLINFO_(STRING|LONG|DOUBLE|SLIST)\s*\+\s*\d+\s*,?\s*$/m');
 
 ob_start();
@@ -83,8 +77,7 @@ 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($translate[$short])) $short = $translate[$short];
-       printf($templates[$type], $full, strtolower($short));
+       printf($templates[$type], $full, strtolower((isset($translate[$short])) ? $translate[$short] : $short));
        if (isset($ifdefs[$short])) printf("#endif\n");
 }