projects
/
m6w6
/
ext-http
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
- Fixed memory leak when HttpUtil::Inflate() fails
[m6w6/ext-http]
/
scripts
/
gen_curlinfo.php
diff --git
a/scripts/gen_curlinfo.php
b/scripts/gen_curlinfo.php
index 92bde38a562cbc6d7ccb8d3af923f0399b760078..f234685ea7abc8c36b4a936427e9325315b3a031 100644
(file)
--- a/
scripts/gen_curlinfo.php
+++ b/
scripts/gen_curlinfo.php
@@
-1,10
+1,13
@@
+#!/usr/bin/env php
<?php
// $Id$
error_reporting(0);
function failure() {
<?php
// $Id$
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);
}
exit(-1);
}
@@
-29,13
+32,18
@@
function file_re($file, $pattern, $all = true) {
}
$ifdefs = array(
}
$ifdefs = array(
- 'COOKIELIST' => '7,14,1'
+ 'COOKIELIST' => '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)',
);
$exclude = array(
);
$exclude = array(
- 'PRIVATE', 'LASTSOCKET', 'FTP_ENTRY_PATH'
+ 'PRIVATE', 'LASTSOCKET', 'FTP_ENTRY_PATH'
, 'CERTINFO',
);
$translate = array(
);
$translate = array(
- 'HTTP_CONNECTCODE' => "connect_code"
+ 'HTTP_CONNECTCODE' => "connect_code",
+ 'COOKIELIST' => 'cookies',
);
$templates = array(
);
$templates = array(
@@
-54,17
+62,19
@@
$templates = array(
add_assoc_long_ex(&array, "%s", sizeof("%2$s"), l);
}
',
add_assoc_long_ex(&array, "%s", sizeof("%2$s"), l);
}
',
-'SLIST' =>
+'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 (CURLE_OK == curl_easy_getinfo(request->ch, %s, &s)) {
MAKE_STD_ZVAL(subarray);
array_init(subarray);
for (p = s; p; p = p->next) {
- add_next_index_string(subarray, p->data, 1);
+ 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);
}
}
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');
);
$infos = file_re('curl.h', '/^\s*(CURLINFO_(\w+))\s*=\s*CURLINFO_(STRING|LONG|DOUBLE|SLIST)\s*\+\s*\d+\s*,?\s*$/m');
@@
-73,9
+83,8
@@
ob_start();
foreach ($infos as $info) {
list(, $full, $short, $type) = $info;
if (in_array($short, $exclude)) continue;
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));
+ 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");
}
if (isset($ifdefs[$short])) printf("#endif\n");
}