fix #68
authorMichael Wallner <mike@php.net>
Tue, 4 Apr 2017 19:05:21 +0000 (21:05 +0200)
committerMichael Wallner <mike@php.net>
Mon, 3 Jul 2017 07:56:08 +0000 (09:56 +0200)
src/php_http_client_request.c

index de7c0ff2535322bf685f157f0e1301e959bbf297..71a9129e3f994f6513c64c023c88ae66afcafb26 100644 (file)
@@ -59,7 +59,12 @@ static PHP_METHOD(HttpClientRequest, __construct)
                PHP_HTTP_INFO(obj->message).request.method = estrndup(meth_str, meth_len);
        }
        if (zurl) {
-               PHP_HTTP_INFO(obj->message).request.url = php_http_url_from_zval(zurl, PHP_HTTP_URL_STDFLAGS);
+               php_http_url_t *url = php_http_url_from_zval(zurl, PHP_HTTP_URL_STDFLAGS);
+
+               if (url) {
+                       PHP_HTTP_INFO(obj->message).request.url = php_http_url_mod(url, NULL, PHP_HTTP_URL_STDFLAGS);
+                       php_http_url_free(&url);
+               }
        }
        if (zheaders) {
                array_copy(Z_ARRVAL_P(zheaders), &obj->message->hdrs);