X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=http_request_api.c;h=260b1f4a89fa065f02a674fc0bf2c4e11d9ffbeb;hb=0c20f7c9ead5ddda3f386361932438fe96283da0;hp=c3e612835cdf5789a7927e6f025c9be0479f3edd;hpb=a19f558421040b5396b3d76e6c4878d7eda85aba;p=m6w6%2Fext-http diff --git a/http_request_api.c b/http_request_api.c index c3e6128..260b1f4 100644 --- a/http_request_api.c +++ b/http_request_api.c @@ -471,14 +471,16 @@ PHP_HTTP_API STATUS _http_request_prepare(http_request *request, HashTable *opti zval **header_val; if (SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_P(zoption), (void **) &header_val, &pos)) { char header[1024] = {0}; - zval *cpy, *val = convert_to_type_ex(IS_STRING, *header_val, &cpy); + zval val; - snprintf(header, 1023, "%s: %s", header_key, Z_STRVAL_P(val)); - request->_cache.headers = curl_slist_append(request->_cache.headers, header); + val = **header_val; + zval_copy_ctor(&val); + INIT_PZVAL(&val); + convert_to_string(&val); - if (cpy) { - zval_ptr_dtor(&cpy); - } + snprintf(header, 1023, "%s: %s", header_key, Z_STRVAL(val)); + request->_cache.headers = curl_slist_append(request->_cache.headers, header); + zval_dtor(&val); } /* reset */