X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_curl_client.c;h=621e05b3d54b5587e388af31e7eaf03e7a480c92;hp=83640a30ef0cca30a1a880f0289d9a29ac56b4d7;hb=25f0c16244fc5f8b2c9d9bfddab8a541d2521789;hpb=ea53d5037a6b49f80c0220ff55d3e07ba14baa3b diff --git a/php_http_curl_client.c b/php_http_curl_client.c index 83640a3..621e05b 100644 --- a/php_http_curl_client.c +++ b/php_http_curl_client.c @@ -436,8 +436,8 @@ static STATUS php_http_curl_client_option_set_cookies(php_http_option_t *opt, zv } php_http_buffer_fix(&curl->options.cookies); - if (PHP_HTTP_BUFFER_LEN(&curl->options.cookies)) { - if (CURLE_OK != curl_easy_setopt(ch, CURLOPT_COOKIE, PHP_HTTP_BUFFER_VAL(&curl->options.cookies))) { + if (curl->options.cookies.used) { + if (CURLE_OK != curl_easy_setopt(ch, CURLOPT_COOKIE, curl->options.cookies.data)) { return FAILURE; } } @@ -506,7 +506,7 @@ static STATUS php_http_curl_client_option_set_etag(php_http_option_t *opt, zval php_http_buffer_init(&header); php_http_buffer_appendf(&header, is_quoted?"%s: %s":"%s: \"%s\"", curl->options.range_request?"If-Match":"If-None-Match", Z_STRVAL_P(val)); php_http_buffer_fix(&header); - curl->options.headers = curl_slist_append(curl->options.headers, PHP_HTTP_BUFFER_VAL(&header)); + curl->options.headers = curl_slist_append(curl->options.headers, header.data); php_http_buffer_dtor(&header); return SUCCESS; } @@ -526,7 +526,7 @@ static STATUS php_http_curl_client_option_set_range(php_http_option_t *opt, zval FOREACH_VAL(pos, val, rr) { if (Z_TYPE_PP(rr) == IS_ARRAY) { - if (2 == php_http_array_list(*rr TSRMLS_CC, 2, &rb, &re)) { + if (2 == php_http_array_list(Z_ARRVAL_PP(rr) TSRMLS_CC, 2, &rb, &re)) { if ( ((Z_TYPE_PP(rb) == IS_LONG) || ((Z_TYPE_PP(rb) == IS_STRING) && is_numeric_string(Z_STRVAL_PP(rb), Z_STRLEN_PP(rb), NULL, NULL, 1))) && ((Z_TYPE_PP(re) == IS_LONG) || ((Z_TYPE_PP(re) == IS_STRING) && is_numeric_string(Z_STRVAL_PP(re), Z_STRLEN_PP(re), NULL, NULL, 1)))) { zval *rbl = php_http_ztyp(IS_LONG, *rb); @@ -543,14 +543,14 @@ static STATUS php_http_curl_client_option_set_range(php_http_option_t *opt, zval } } - if (PHP_HTTP_BUFFER_LEN(&curl->options.ranges)) { + if (curl->options.ranges.used) { curl->options.range_request = 1; /* ditch last comma */ - PHP_HTTP_BUFFER_VAL(&curl->options.ranges)[PHP_HTTP_BUFFER_LEN(&curl->options.ranges)-- -1] = '\0'; + curl->options.ranges.data[curl->options.ranges.used - 1] = '\0'; } } - if (CURLE_OK != curl_easy_setopt(ch, CURLOPT_RANGE, PHP_HTTP_BUFFER_VAL(&curl->options.ranges))) { + if (CURLE_OK != curl_easy_setopt(ch, CURLOPT_RANGE, curl->options.ranges.data)) { return FAILURE; } return SUCCESS; @@ -614,7 +614,7 @@ static STATUS php_http_curl_client_option_set_portrange(php_http_option_t *opt, if (val && Z_TYPE_P(val) != IS_NULL) { zval **z_port_start, *zps_copy = NULL, **z_port_end, *zpe_copy = NULL; - switch (php_http_array_list(val TSRMLS_CC, 2, &z_port_start, &z_port_end)) { + switch (php_http_array_list(Z_ARRVAL_P(val) TSRMLS_CC, 2, &z_port_start, &z_port_end)) { case 2: zps_copy = php_http_ztyp(IS_LONG, *z_port_start); zpe_copy = php_http_ztyp(IS_LONG, *z_port_end); @@ -1198,7 +1198,7 @@ PHP_HTTP_API STATUS php_http_curl_client_prepare(php_http_client_t *h, php_http_ php_http_buffer_appendf(&header, "%s: %s", header_key.str, Z_STRVAL_P(header_cpy)); php_http_buffer_fix(&header); - curl->options.headers = curl_slist_append(curl->options.headers, PHP_HTTP_BUFFER_VAL(&header)); + curl->options.headers = curl_slist_append(curl->options.headers, header.data); php_http_buffer_reset(&header); zval_ptr_dtor(&header_cpy);