From a856e9055f2de647fdb3c7ff89238f6b17a1217e Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Sat, 19 Feb 2005 12:22:36 +0000 Subject: [PATCH] * fixed a LOAD of mem-leaks --- docs/functions.html | 313 ++++++++++++++++++++++----------------- http.c | 95 +++++++++--- http_api.c | 2 +- php_http.h | 4 +- tests/030_send_data.phpt | 2 +- 5 files changed, 260 insertions(+), 156 deletions(-) diff --git a/docs/functions.html b/docs/functions.html index 46a2028..eba8d60 100644 --- a/docs/functions.html +++ b/docs/functions.html @@ -1,162 +1,209 @@ Function Summary - +

http.c

-

string http_date([int timestamp])

-

This function returns a valid HTTP date regarding RFC 822/1123
+

void HTTPi_Response::__construct(bool cache, bool gzip)

+

+

bool HTTPi_Response::setCache(bool cache)

+

+

bool HTTPi_Response::getCache()

+

+

bool HTTPi_Response::setGzip(bool gzip)

+

+

bool HTTPi_Response::getGzip()

+

+

bool HTTPi_Response::setCacheControl(string control[, bool raw = false])

+

+

string HTTPi_Response::getCacheControl()

+

+

bool HTTPi::setContentType(string content_type)

+

+

string HTTPi_Response::getContentType()

+

+

bool HTTPi_Response::setContentDisposition(string filename[, bool inline = false])

+

+

array HTTPi_Response::getContentDisposition()

+

+

bool HTTPi_Response::setETag(string etag)

+

+

string HTTPi_Response::getETag()

+

+

bool HTTPi_Response::setData(string data)

+

+

string HTTPi_Response::getData()

+

+

bool HTTPi_Response::setStream(resource stream)

+

+

resource HTTPi_Response::getStream()

+

+

bool HTTPi_Response::setFile(string file)

+

+

string HTTPi_Response::getFile()

+

+

int HTTPi_Response::getSize()

+

+

string http_date([int timestamp])

+

This function returns a valid HTTP date regarding RFC 822/1123 looking like: "Wed, 22 Dec 2004 11:34:47 GMT"

-

string http_absolute_uri(string url[, string proto])

-

This function returns an absolute URI constructed from url.
-If the url is already abolute but a different proto was supplied,
-only the proto part of the URI will be updated. If url has no
-path specified, the path of the current REQUEST_URI will be taken.
-The host will be taken either from the Host HTTP header of the client
-the SERVER_NAME or just localhost if prior are not available.

Some examples:
-


-url = "page.php" => http://www.example.com/current/path/page.php
-url = "/page.php" => http://www.example.com/page.php
-url = "/page.php", proto = "https" => https://www.example.com/page.php
+

string http_absolute_uri(string url[, string proto])

+

This function returns an absolute URI constructed from url. +If the url is already abolute but a different proto was supplied, +only the proto part of the URI will be updated. If url has no +path specified, the path of the current REQUEST_URI will be taken. +The host will be taken either from the Host HTTP header of the client +the SERVER_NAME or just localhost if prior are not available.

Some examples: +

+url = "page.php"                    => http://www.example.com/current/path/page.php
+url = "/page.php"                   => http://www.example.com/page.php
+url = "/page.php", proto = "https"  => https://www.example.com/page.php
 

-

string http_negotiate_language(array supported[, string default = 'en-US'])

-

This function negotiates the clients preferred language based on its
-Accept-Language HTTP header. It returns the negotiated language or
-the default language if none match.

The qualifier is recognized and languages without qualifier are rated highest.

The supported parameter is expected to be an array having
-the supported languages as array values.

Example:
-


-
-<?php
$langs
= array(
        
'en-US',// default
        
'fr',
        
'fr-FR',
        
'de',
        
'de-DE',
        
'de-AT',
        
'de-CH',
);
include
'./langs/'. http_negotiate_language($langs) .'.php';
?>
-

-

+

string http_negotiate_language(array supported[, string default = 'en-US'])

+

This function negotiates the clients preferred language based on its +Accept-Language HTTP header. It returns the negotiated language or +the default language if none match.

The qualifier is recognized and languages without qualifier are rated highest.

The supported parameter is expected to be an array having +the supported languages as array values.

Example: +

+
+<?php
$langs
= array(
        
'en-US',// default
        
'fr',
        
'fr-FR',
        
'de',
        
'de-DE',
        
'de-AT',
        
'de-CH',
);
include
'./langs/'. http_negotiate_language($langs) .'.php';
?> +
+

-

string http_negotiate_charset(array supported[, string default = 'iso-8859-1'])

-

This function negotiates the clients preferred charset based on its
-Accept-Charset HTTP header. It returns the negotiated charset or
-the default charset if none match.

The qualifier is recognized and charset without qualifier are rated highest.

The supported parameter is expected to be an array having
-the supported charsets as array values.

Example:
-


-
-<?php
$charsets
= array(
        
'iso-8859-1', // default
        
'iso-8859-2',
        
'iso-8859-15',
        
'utf-8'
);
$pref = http_negotiate_charset($charsets);
if (!
strcmp($pref, 'iso-8859-1')) {
        
iconv_set_encoding('internal_encoding', 'iso-8859-1');
        
iconv_set_encoding('output_encoding', $pref);
        
ob_start('ob_iconv_handler');
}
?>
-

-

+

string http_negotiate_charset(array supported[, string default = 'iso-8859-1'])

+

This function negotiates the clients preferred charset based on its +Accept-Charset HTTP header. It returns the negotiated charset or +the default charset if none match.

The qualifier is recognized and charset without qualifier are rated highest.

The supported parameter is expected to be an array having +the supported charsets as array values.

Example: +

+
+<?php
$charsets
= array(
        
'iso-8859-1', // default
        
'iso-8859-2',
        
'iso-8859-15',
        
'utf-8'
);
$pref = http_negotiate_charset($charsets);
if (!
strcmp($pref, 'iso-8859-1')) {
        
iconv_set_encoding('internal_encoding', 'iso-8859-1');
        
iconv_set_encoding('output_encoding', $pref);
        
ob_start('ob_iconv_handler');
}
?> +
+

-

bool http_send_status(int status)

+

bool http_send_status(int status)

Send HTTP status code.

-

bool http_send_last_modified([int timestamp])

-

This converts the given timestamp to a valid HTTP date and
-sends it as "Last-Modified" HTTP header. If timestamp is
+

bool http_send_last_modified([int timestamp])

+

This converts the given timestamp to a valid HTTP date and +sends it as "Last-Modified" HTTP header. If timestamp is omitted, current time is sent.

-

bool http_match_modified([int timestamp])

-

Matches the given timestamp against the clients "If-Modified-Since" resp.
+

bool http_match_modified([int timestamp])

+

Matches the given timestamp against the clients "If-Modified-Since" resp. "If-Unmodified-Since" HTTP headers.

-

bool http_match_etag(string etag)

-

This matches the given ETag against the clients
+

bool http_match_etag(string etag)

+

This matches the given ETag against the clients "If-Match" resp. "If-None-Match" HTTP headers.

-

bool http_cache_last_modified([int timestamp_or_expires]])

-

If timestamp_or_exires is greater than 0, it is handled as timestamp
-and will be sent as date of last modification. If it is 0 or omitted,
-the current time will be sent as Last-Modified date. If it's negative,
-it is handled as expiration time in seconds, which means that if the
-requested last modification date is not between the calculated timespan,
+

bool http_cache_last_modified([int timestamp_or_expires]])

+

If timestamp_or_exires is greater than 0, it is handled as timestamp +and will be sent as date of last modification. If it is 0 or omitted, +the current time will be sent as Last-Modified date. If it's negative, +it is handled as expiration time in seconds, which means that if the +requested last modification date is not between the calculated timespan, the Last-Modified header is updated and the actual body will be sent.

-

bool http_cache_etag([string etag])

-

This function attempts to cache the HTTP body based on an ETag,
-either supplied or generated through calculation of the MD5
-checksum of the output (uses output buffering).

If clients "If-None-Match" header matches the supplied/calculated
-ETag, the body is considered cached on the clients side and
+

bool http_cache_etag([string etag])

+

This function attempts to cache the HTTP body based on an ETag, +either supplied or generated through calculation of the MD5 +checksum of the output (uses output buffering).

If clients "If-None-Match" header matches the supplied/calculated +ETag, the body is considered cached on the clients side and a "304 Not Modified" status code is issued.

-

void http_redirect([string url[, array params[, bool session,[ bool permanent]]]])

-

Redirect to a given url.
-The supplied url will be expanded with http_absolute_uri(), the params array will
-be treated with http_build_query() and the session identification will be appended
-if session is true.

Depending on permanent the redirection will be issued with a permanent
-("301 Moved Permanently") or a temporary ("302 Found") redirection
-status code.

To be RFC compliant, "Redirecting to URI." will be displayed,
+

string ob_httpetaghandler(string data, int mode)

+

For use with ob_start(). +Note that this has to be started as first output buffer. +WARNING: Don't use with http_send_*().

+

void http_redirect([string url[, array params[, bool session,[ bool permanent]]]])

+

Redirect to a given url. +The supplied url will be expanded with http_absolute_uri(), the params array will +be treated with http_build_query() and the session identification will be appended +if session is true.

Depending on permanent the redirection will be issued with a permanent +("301 Moved Permanently") or a temporary ("302 Found") redirection +status code.

To be RFC compliant, "Redirecting to URI." will be displayed, if the client doesn't redirect immediatly.

-

bool http_send_data(string data)

+

bool http_send_data(string data)

Sends raw data with support for (multiple) range requests.

-

bool http_send_file(string file)

+

bool http_send_file(string file)

Sends a file with support for (multiple) range requests.

-

bool http_send_stream(resource stream)

+

bool http_send_stream(resource stream)

Sends an already opened stream with support for (multiple) range requests.

-

bool http_content_type([string content_type = 'application/x-octetstream'])

+

bool http_content_type([string content_type = 'application/x-octetstream'])

Sets the content type.

-

bool http_content_disposition(string filename[, bool inline = false])

-

Set the Content Disposition. The Content-Disposition header is very useful
-if the data actually sent came from a file or something similar, that should
+

bool http_content_disposition(string filename[, bool inline = false])

+

Set the Content Disposition. The Content-Disposition header is very useful +if the data actually sent came from a file or something similar, that should be "saved" by the client/user (i.e. by browsers "Save as..." popup window).

-

string http_chunked_decode(string encoded)

-

This function decodes a string that was HTTP-chunked encoded.
+

string http_chunked_decode(string encoded)

+

This function decodes a string that was HTTP-chunked encoded. Returns false on failure.

-

array http_split_response(string http_response)

-

This function splits an HTTP response into an array with headers and the
-content body. The returned array may look simliar to the following example:


-array(
-0 => array(
-'Status' => '200 Ok',
-'Content-Type' => 'text/plain',
-'Content-Language' => 'en-US'
-),
-1 => "Hello World!"
-);
+

array http_split_response(string http_response)

+

This function splits an HTTP response into an array with headers and the +content body. The returned array may look simliar to the following example:

+
+<?php
array(
0 => array(
'Status' => '200 Ok',
'Content-Type' => 'text/plain',
'Content-Language' => 'en-US'
),
1 => "Hello World!\"
);
?>
+
+
+

+

array http_parse_headers(string header)

+

+

array http_get_request_headers(void)

+

+

string http_get(string url[, array options[, array &info]])

+

Performs an HTTP GET request on the supplied url.

The second parameter is expected to be an associative +array where the following keys will be recognized: +

+- redirect:         int, whether and how many redirects to follow
+- unrestrictedauth: bool, whether to continue sending credentials on
+redirects to a different host
+- proxyhost:        string, proxy host in "host[:port]" format
+- proxyport:        int, use another proxy port as specified in proxyhost
+- proxyauth:        string, proxy credentials in "user:pass" format
+- proxyauthtype:    int, HTTP_AUTH_BASIC and/or HTTP_AUTH_NTLM
+- httpauth:         string, http credentials in "user:pass" format
+- httpauthtype:     int, HTTP_AUTH_BASIC, DIGEST and/or NTLM
+- compress:         bool, whether to allow gzip/deflate content encoding
+(defaults to true)
+- port:             int, use another port as specified in the url
+- referer:          string, the referer to sends
+- useragent:        string, the user agent to send
+(defaults to PECL::HTTP/version (PHP/version)))
+- headers:          array, list of custom headers as associative array
+like array("header" => "value")
+- cookies:          array, list of cookies as associative array
+like array("cookie" => "value")
+- cookiestore:      string, path to a file where cookies are/will be stored
+

The optional third parameter will be filled with some additional information +in form af an associative array, if supplied, like the following example: +

+
+<?php
array (
'effective_url' => 'http://localhost',
'response_code' => 403,
'total_time' => 0.017,
'namelookup_time' => 0.013,
'connect_time' => 0.014,
'pretransfer_time' => 0.014,
'size_upload' => 0,
'size_download' => 202,
'speed_download' => 11882,
'speed_upload' => 0,
'header_size' => 145,
'request_size' => 62,
'ssl_verifyresult' => 0,
'filetime' => -1,
'content_length_download' => 202,
'content_length_upload' => 0,
'starttransfer_time' => 0.017,
'content_type' => 'text/html; charset=iso-8859-1',
'redirect_time' => 0,
'redirect_count' => 0,
'private' => '',
'http_connectcode' => 0,
'httpauth_avail' => 0,
'proxyauth_avail' => 0,
)
?> +
+

-

array http_parse_headers(string header) */

-

-

string http_get(string url[, array options[, array &info]])

-

Performs an HTTP GET request on the supplied url.

The second parameter is expected to be an associative
-array where the following keys will be recognized:
-


-- redirect: int, whether and how many redirects to follow
-- unrestrictedauth: bool, whether to continue sending credentials on
-redirects to a different host
-- proxyhost: string, proxy host in "host[:port]" format
-- proxyport: int, use another proxy port as specified in proxyhost
-- proxyauth: string, proxy credentials in "user:pass" format
-- proxyauthtype: int, HTTP_AUTH_BASIC and/or HTTP_AUTH_NTLM
-- httpauth: string, http credentials in "user:pass" format
-- httpauthtype: int, HTTP_AUTH_BASIC, DIGEST and/or NTLM
-- compress: bool, whether to allow gzip/deflate content encoding
-(defaults to true)
-- port: int, use another port as specified in the url
-- referer: string, the referer to sends
-- useragent: string, the user agent to send
-(defaults to PECL::HTTP/version (PHP/version)))
-- headers: array, list of custom headers as associative array
-like array("header" => "value")
-- cookies: array, list of cookies as associative array
-like array("cookie" => "value")
-- cookiestore: string, path to a file where cookies are/will be stored
-

The optional third parameter will be filled with some additional information
-in form af an associative array, if supplied (don't forget to initialize it
-with NULL or array()).

-

string http_head(string url[, array options[, array &info]])

-

Performs an HTTP HEAD request on the suppied url.
-Returns the HTTP response as string.
+

string http_head(string url[, array options[, array &info]])

+

Performs an HTTP HEAD request on the suppied url. +Returns the HTTP response as string. See http_get() for a full list of available options.

-

string http_post_data(string url, string data[, array options[, &info]])

-

Performs an HTTP POST request, posting data.
-Returns the HTTP response as string.
+

string http_post_data(string url, string data[, array options[, &info]])

+

Performs an HTTP POST request, posting data. +Returns the HTTP response as string. See http_get() for a full list of available options.

-

string http_post_array(string url, array data[, array options[, array &info]])

-

Performs an HTTP POST request, posting www-form-urlencoded array data.
-Returns the HTTP response as string.
+

string http_post_array(string url, array data[, array options[, array &info]])

+

Performs an HTTP POST request, posting www-form-urlencoded array data. +Returns the HTTP response as string. See http_get() for a full list of available options.

-

bool http_auth_basic(string user, string pass[, string realm = "Restricted"])

-

Example:
-


-
-<?php
if (!http_auth_basic('mike', 's3c|r3t')) {
die(
'<h1>Authorization failed!</h1>');
}
?>
-

-

+

bool http_auth_basic(string user, string pass[, string realm = "Restricted"])

+

Example: +

+
+<?php
if (!http_auth_basic('mike', 's3c|r3t')) {
die(
'<h1>Authorization failed!</h1>');
}
?> +
+

-

bool http_auth_basic_cb(mixed callback[, string realm = "Restricted"])

-

Example:
-


-
-<?php
function auth_cb($user, $pass)
{
global
$db;
$query = 'SELECT pass FROM users WHERE user='. $db->quoteSmart($user);
if (
strlen($realpass = $db->getOne($query)) {
return
$pass === $realpass;
}
return
false;
}

if (!
http_auth_basic_cb('auth_cb')) {
die(
'<h1>Authorization failed</h1>');
}
?>
-

-

+

bool http_auth_basic_cb(mixed callback[, string realm = "Restricted"])

+

Example: +

+
+<?php
function auth_cb($user, $pass)
{
global
$db;
$query = 'SELECT pass FROM users WHERE user='. $db->quoteSmart($user);
if (
strlen($realpass = $db->getOne($query)) {
return
$pass === $realpass;
}
return
false;
}

if (!
http_auth_basic_cb('auth_cb')) {
die(
'<h1>Authorization failed</h1>');
}
?> +
+

-

Generated at: Thu, 10 Feb 2005 19:51:45 +0100

+

Generated at: Thu, 17 Feb 2005 22:42:18 +0100

diff --git a/http.c b/http.c index ff61116..1fddaa4 100644 --- a/http.c +++ b/http.c @@ -155,6 +155,22 @@ function_entry http_functions[] = { # define SET_PROP(o, n, z) zend_update_property(o->zo.ce, getThis(), (#n), sizeof(#n), (z) TSRMLS_CC) # define GET_PROP(o, n) zend_read_property(o->zo.ce, getThis(), (#n), sizeof(#n), 0 TSRMLS_CC) +# define INIT_PARR(o, n) \ + { \ + zval *__tmp; \ + MAKE_STD_ZVAL(__tmp); \ + array_init(__tmp); \ + SET_PROP(o, n, __tmp); \ + o->n = __tmp; \ + } + +# define FREE_PARR(p) \ + if (p) { \ + zval_dtor(p); \ + FREE_ZVAL(p); \ + (p) = NULL; \ + } + /* {{{ HTTPi */ zend_class_entry *httpi_ce; @@ -718,8 +734,12 @@ zend_class_entry *httpi_request_ce; static zend_object_handlers httpi_request_object_handlers; typedef struct { - zend_object zo; + zend_object zo; CURL *ch; + + zval *options; + zval *responseInfo; + zval *responseData; } httpi_request_object; #define httpi_request_declare_default_properties(ce) _httpi_request_declare_default_properties(ce TSRMLS_CC) @@ -741,12 +761,18 @@ static inline void _httpi_request_declare_default_properties(zend_class_entry *c void _httpi_request_destroy_object(void *object, zend_object_handle handle TSRMLS_DC) { httpi_request_object *o = object; + + FREE_PARR(o->options); + FREE_PARR(o->responseInfo); + FREE_PARR(o->responseData); + if (OBJ_PROP(o)) { zend_hash_destroy(OBJ_PROP(o)); FREE_HASHTABLE(OBJ_PROP(o)); } if (o->ch) { curl_easy_cleanup(o->ch); + o->ch = NULL; } efree(o); } @@ -773,8 +799,8 @@ zend_object_value _httpi_request_new_object(zend_class_entry *ce TSRMLS_DC) zend_function_entry httpi_request_class_methods[] = { PHP_ME(HTTPi_Request, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) -/* PHP_ME(HTTPi_Request, __destruct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_DTOR) -*/ + PHP_ME(HTTPi_Request, __destruct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_DTOR) + PHP_ME(HTTPi_Request, setOptions, NULL, ZEND_ACC_PUBLIC) PHP_ME(HTTPi_Request, getOptions, NULL, ZEND_ACC_PUBLIC) @@ -823,10 +849,10 @@ PHP_METHOD(HTTPi_Request, __construct) return; } - MAKE_STD_ZVAL(opts); array_init(opts); SET_PROP(obj, options, opts); - MAKE_STD_ZVAL(info); array_init(info); SET_PROP(obj, responseInfo, info); - MAKE_STD_ZVAL(resp); array_init(resp); SET_PROP(obj, responseData, resp); - + INIT_PARR(obj, options); + INIT_PARR(obj, responseInfo); + INIT_PARR(obj, responseData); + if (URL) { UPD_PROP(obj, string, url, URL); } @@ -836,6 +862,30 @@ PHP_METHOD(HTTPi_Request, __construct) } /* }}} */ +PHP_METHOD(HTTPi_Request, __destruct) +{ + zval *opts, *info, *resp; + getObject(httpi_request_object, obj); + + /* + * this never happens ??? + */ + + fprintf(stderr, "\n\n\nYAY, DESTRCUTOR CALLED!\n\n\n"); + + opts = GET_PROP(obj, options); + zval_dtor(opts); + FREE_ZVAL(opts); + + info = GET_PROP(obj, reeponseInfo); + zval_dtor(info); + FREE_ZVAL(info); + + resp = GET_PROP(obj, responseData); + zval_dtor(resp); + FREE_ZVAL(resp); +} + /* {{{ proto bool HTTPi_Request::setOptions(array options) * */ @@ -870,11 +920,10 @@ PHP_METHOD(HTTPi_Request, setOptions) continue; } } - zval_add_ref(opt); - add_assoc_zval(old_opts, key, *opt); + zval_add_ref(opt); + add_assoc_zval(old_opts, key, *opt); } } - RETURN_TRUE; } /* }}} */ @@ -1176,8 +1225,9 @@ PHP_METHOD(HTTPi_Request, getResponseInfo) */ PHP_METHOD(HTTPi_Request, send) { + STATUS status = FAILURE; zval *meth, *URL, *qdata, *opts, *info, *resp; - char *response_data, *request_uri; + char *response_data, *request_uri, *uri; size_t response_len; getObject(httpi_request_object, obj); @@ -1195,7 +1245,11 @@ PHP_METHOD(HTTPi_Request, send) info = GET_PROP(obj, responseInfo); resp = GET_PROP(obj, responseData); - request_uri = http_absolute_uri(Z_STRVAL_P(URL), NULL); + uri = http_absolute_uri(Z_STRVAL_P(URL), NULL); + request_uri = ecalloc(HTTP_URI_MAXLEN + 1, 1); + strcpy(request_uri, uri); + efree(uri); + if (Z_STRLEN_P(qdata) && (strlen(request_uri) < HTTP_URI_MAXLEN)) { if (!strchr(request_uri, '?')) { strcat(request_uri, "?"); @@ -1208,15 +1262,11 @@ PHP_METHOD(HTTPi_Request, send) switch (Z_LVAL_P(meth)) { case HTTP_GET: - if (SUCCESS != http_get_ex(obj->ch, request_uri, Z_ARRVAL_P(opts), Z_ARRVAL_P(info), &response_data, &response_len)) { - RETURN_FALSE; - } + status = http_get_ex(obj->ch, request_uri, Z_ARRVAL_P(opts), Z_ARRVAL_P(info), &response_data, &response_len); break; case HTTP_HEAD: - if (SUCCESS != http_head_ex(obj->ch, request_uri, Z_ARRVAL_P(opts), Z_ARRVAL_P(info), &response_data, &response_len)) { - RETURN_FALSE; - } + status = http_head_ex(obj->ch, request_uri, Z_ARRVAL_P(opts), Z_ARRVAL_P(info), &response_data, &response_len); break; case HTTP_POST: @@ -1226,8 +1276,12 @@ PHP_METHOD(HTTPi_Request, send) break; } + efree(request_uri); + /* final data handling */ - { + if (status != SUCCESS) { + RETURN_FALSE; + } else { zval *zheaders, *zbody; MAKE_STD_ZVAL(zbody); @@ -1238,11 +1292,14 @@ PHP_METHOD(HTTPi_Request, send) zval_dtor(zheaders); efree(zheaders), efree(zbody); + efree(response_data); RETURN_FALSE; } add_assoc_zval(resp, "headers", zheaders); add_assoc_zval(resp, "body", zbody); + + efree(response_data); RETURN_TRUE; } diff --git a/http_api.c b/http_api.c index a5b898d..b16da00 100644 --- a/http_api.c +++ b/http_api.c @@ -563,7 +563,7 @@ static inline void _http_curl_setopts(CURL *ch, const char *url, HashTable *opti /* {{{ static inline char *http_curl_getinfoname(CURLINFO) */ static inline char *_http_curl_getinfoname(CURLINFO i TSRMLS_DC) { -#define CASE(I) case CURLINFO_ ##I : return pretty_key(estrdup( #I ), strlen(#I), 0, 0) +#define CASE(I) case CURLINFO_ ##I : { static char I[] = #I; return pretty_key(I, sizeof(#I)-1, 0, 0); } switch (i) { /* CURLINFO_EFFECTIVE_URL = CURLINFO_STRING +1, */ diff --git a/php_http.h b/php_http.h index 6251c98..b2bdbe2 100644 --- a/php_http.h +++ b/php_http.h @@ -110,8 +110,8 @@ PHP_METHOD(HTTPi_Response, send); #ifdef HTTP_HAVE_CURL -PHP_METHOD(HTTPi_Request, __construct);/* -PHP_METHOD(HTTPi_Request, __destruct);*/ +PHP_METHOD(HTTPi_Request, __construct); +PHP_METHOD(HTTPi_Request, __destruct); PHP_METHOD(HTTPi_Request, setOptions); PHP_METHOD(HTTPi_Request, getOptions); PHP_METHOD(HTTPi_Request, setMethod); diff --git a/tests/030_send_data.phpt b/tests/030_send_data.phpt index 301d45f..8db55cf 100644 --- a/tests/030_send_data.phpt +++ b/tests/030_send_data.phpt @@ -7,7 +7,7 @@ strncasecmp(PHP_SAPI, 'CLI', 3) or die('cannot run tests with CLI'); ?> --FILE-- --EXPECTREGEX-- -- 2.30.2