X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http_request_object.c;h=73b0319b00cd3b914bb72c651e2af658afe5d84a;hp=9bcac0271098ec7e72b388c2970e1cb2cc1e312c;hb=49d78c4319400a470f70440e5ce06fc6df3245ac;hpb=8051cb5f80e8ca2d938808397fd2d9298b9a0a5d diff --git a/http_request_object.c b/http_request_object.c index 9bcac02..73b0319 100644 --- a/http_request_object.c +++ b/http_request_object.c @@ -602,7 +602,7 @@ PHP_METHOD(HttpRequest, setOptions) 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 @@ PHP_METHOD(HttpRequest, setOptions) 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); @@ -663,6 +673,7 @@ PHP_METHOD(HttpRequest, unsetOptions) FREE_PARR(obj, options); INIT_PARR(obj, options); + zend_update_property_null(http_request_object_ce, getThis(), "dbg_user_cb", lenof("dbg_user_cb") TSRMLS_CC); } /* }}} */