logo       

cvs: pecl /http http_request_object.c http_url_api.c: msg#00204

php.pecl.cvs

Subject: cvs: pecl /http http_request_object.c http_url_api.c

mike Tue Jul 26 12:44:27 2005 EDT

Modified files:
/pecl/http http_request_object.c http_url_api.c
Log:
- fix possible mem-leak in http_absolute_uri()
- make url and request method configurable through HttpRequest::setOptions()

http://cvs.php.net/diff.php/pecl/http/http_request_object.c?r1=1.24&r2=1.25&ty=u
Index: pecl/http/http_request_object.c
diff -u pecl/http/http_request_object.c:1.24
pecl/http/http_request_object.c:1.25
--- pecl/http/http_request_object.c:1.24 Tue Jul 26 11:23:04 2005
+++ pecl/http/http_request_object.c Tue Jul 26 12:44:27 2005
@@ -13,7 +13,7 @@
+----------------------------------------------------------------------+
*/

-/* $Id: http_request_object.c,v 1.24 2005/07/26 15:23:04 mike Exp $ */
+/* $Id: http_request_object.c,v 1.25 2005/07/26 16:44:27 mike Exp $ */


#ifdef HAVE_CONFIG_H
@@ -602,7 +602,7 @@

old_opts = GET_PROP(obj, options);

- /* headers and cookies need extra attention -- thus cannot use
array_merge() directly */
+ /* some options need extra attention -- thus cannot use array_merge()
directly */
FOREACH_KEYVAL(opts, key, idx, opt) {
if (key) {
if (!strcmp(key, "headers")) {
@@ -615,6 +615,16 @@
if (SUCCESS ==
zend_hash_find(Z_ARRVAL_P(old_opts), "cookies", sizeof("cookies"), (void **)
&cookies)) {
array_merge(*opt, *cookies);
}
+ } else if ((!strcasecmp(key, "url")) ||
(!strcasecmp(key, "uri"))) {
+ if (Z_TYPE_PP(opt) != IS_STRING) {
+ convert_to_string_ex(opt);
+ }
+ UPD_PROP(obj, string, url, Z_STRVAL_PP(opt));
+ } else if (!strcmp(key, "method")) {
+ if (Z_TYPE_PP(opt) != IS_LONG) {
+ convert_to_long_ex(opt);
+ }
+ UPD_PROP(obj, long, method, Z_LVAL_PP(opt));
} else {
if (!strcmp(key, "ondebug")) {
SET_PROP(obj, dbg_user_cb, *opt);
http://cvs.php.net/diff.php/pecl/http/http_url_api.c?r1=1.6&r2=1.7&ty=u
Index: pecl/http/http_url_api.c
diff -u pecl/http/http_url_api.c:1.6 pecl/http/http_url_api.c:1.7
--- pecl/http/http_url_api.c:1.6 Sun Jul 24 06:30:45 2005
+++ pecl/http/http_url_api.c Tue Jul 26 12:44:27 2005
@@ -13,7 +13,7 @@
+----------------------------------------------------------------------+
*/

-/* $Id: http_url_api.c,v 1.6 2005/07/24 10:30:45 mike Exp $ */
+/* $Id: http_url_api.c,v 1.7 2005/07/26 16:44:27 mike Exp $ */

#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -53,7 +53,7 @@
php_url *purl = NULL, furl;
size_t full_len = 0;
zval *zhost = NULL;
- char *scheme = NULL, *uri, *URL = ecalloc(1, HTTP_URI_MAXLEN + 1);
+ char *scheme = NULL, *uri, *URL;

if ((!url || !url_len) && (
(!(url = SG(request_info).request_uri)) ||
@@ -62,6 +62,7 @@
return NULL;
}

+ URL = ecalloc(1, HTTP_URI_MAXLEN + 1);
uri = estrndup(url, url_len);
if (!(purl = php_url_parse(uri))) {
http_error_ex(E_WARNING, HTTP_E_PARSE, "Could not parse
supplied URL: %s", url);



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise