#!/usr/bin/env php
<?php
-// $Id$
+// $Id: gen_curlinfo.php 323304 2012-02-17 21:13:24Z mike $
error_reporting(0);
function failure() {
- // this is why error_get_last() should return a stdClass object
- $error = error_get_last();
- fprintf(STDERR, "FAILURE: %s\n", $error["message"]);
+ fprintf(STDERR, "FAILURE: %s\n", error_get_last()["message"]);
exit(-1);
}
}
$ifdefs = array(
- '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)',
- 'PRIMARY_PORT' => 'HTTP_CURL_VERSION(7,21,0)',
- 'LOCAL_PORT' => 'HTTP_CURL_VERSION(7,21,0)',
- 'LOCAL_IP' => 'HTTP_CURL_VERSION(7,21,0)',
+ 'PRIMARY_IP' => 'PHP_HTTP_CURL_VERSION(7,19,0)',
+ 'APPCONNECT_TIME' => 'PHP_HTTP_CURL_VERSION(7,19,0)',
+ 'CONDITION_UNMET' => 'PHP_HTTP_CURL_VERSION(7,19,4)',
+ 'PRIMARY_PORT' => 'PHP_HTTP_CURL_VERSION(7,21,0)',
+ 'LOCAL_PORT' => 'PHP_HTTP_CURL_VERSION(7,21,0)',
+ 'LOCAL_IP' => 'PHP_HTTP_CURL_VERSION(7,21,0)',
+ 'HTTP_VERSION' => 'PHP_HTTP_CURL_VERSION(7,50,0)'
);
$exclude = array(
- 'PRIVATE', 'LASTSOCKET', 'FTP_ENTRY_PATH', 'CERTINFO',
- 'RTSP_SESSION_ID', 'RTSP_CLIENT_CSEQ', 'RTSP_SERVER_CSEQ', 'RTSP_CSEQ_RECV'
+ 'ACTIVESOCKET',
+ 'CERTINFO',
+ 'COOKIELIST',
+ 'FTP_ENTRY_PATH',
+ 'LASTSOCKET',
+ 'PRIVATE',
+ 'RTSP_CLIENT_CSEQ',
+ 'RTSP_CSEQ_RECV',
+ 'RTSP_SERVER_CSEQ',
+ 'RTSP_SESSION_ID',
+ 'TLS_SESSION',
+ 'TLS_SSL_PTR',
);
$translate = array(
$templates = array(
'STRING' =>
-' if (CURLE_OK == curl_easy_getinfo(request->ch, %s, &c)) {
+' if (CURLE_OK == curl_easy_getinfo(ch, %s, &c)) {
add_assoc_string_ex(&array, "%s", sizeof("%2$s"), c ? c : "", 1);
}
',
'DOUBLE' =>
-' if (CURLE_OK == curl_easy_getinfo(request->ch, %s, &d)) {
+' if (CURLE_OK == curl_easy_getinfo(ch, %s, &d)) {
add_assoc_double_ex(&array, "%s", sizeof("%2$s"), d);
}
',
'LONG' =>
-' if (CURLE_OK == curl_easy_getinfo(request->ch, %s, &l)) {
+' if (CURLE_OK == curl_easy_getinfo(ch, %s, &l)) {
add_assoc_long_ex(&array, "%s", sizeof("%2$s"), l);
}
',
'SLIST' =>
-' if (CURLE_OK == curl_easy_getinfo(request->ch, %s, &s)) {
+' if (CURLE_OK == curl_easy_getinfo(ch, %s, &s)) {
MAKE_STD_ZVAL(subarray);
array_init(subarray);
for (p = s; p; p = p->next) {
if (isset($ifdefs[$short])) printf("#endif\n");
}
-file_put_contents("http_request_info.c",
- preg_replace('/(\/\* BEGIN \*\/\n).*(\/\* END \*\/)/s', '$1'. ob_get_contents() .'$2',
- file_get_contents("http_request_info.c")));
+file_put_contents("src/php_http_client_curl.c",
+ preg_replace('/(\/\* BEGIN::CURLINFO \*\/\n).*(\n\s*\/\* END::CURLINFO \*\/)/s', '$1'. ob_get_contents() .'$2',
+ file_get_contents("src/php_http_client_curl.c")));
?>