diff options
author | Dmitry Stogov <dmitry@zend.com> | 2018-05-28 16:27:12 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2018-05-28 16:27:12 +0300 |
commit | 5eb1f92f31cafc48384f9096012f421b37f6d425 (patch) | |
tree | 4ed67b92229407e7b5cbab37b96428fe80eb3f94 /ext/soap/php_http.c | |
parent | 925f05dd1a35eafa71eb29abb69cdfc31a23a75d (diff) | |
download | php-git-5eb1f92f31cafc48384f9096012f421b37f6d425.tar.gz |
Use zend_string_release_ex() instread of zend_string_release() in places, where we sure about string persistence.
Diffstat (limited to 'ext/soap/php_http.c')
-rw-r--r-- | ext/soap/php_http.c | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c index 3be02235a6..e2095621d0 100644 --- a/ext/soap/php_http.c +++ b/ext/soap/php_http.c @@ -52,7 +52,7 @@ int proxy_authentication(zval* this_ptr, smart_str* soap_headers) smart_str_append_const(soap_headers, "Proxy-Authorization: Basic "); smart_str_appendl(soap_headers, (char*)ZSTR_VAL(buf), ZSTR_LEN(buf)); smart_str_append_const(soap_headers, "\r\n"); - zend_string_release(buf); + zend_string_release_ex(buf, 0); smart_str_free(&auth); return 1; } @@ -81,7 +81,7 @@ int basic_authentication(zval* this_ptr, smart_str* soap_headers) smart_str_append_const(soap_headers, "Authorization: Basic "); smart_str_appendl(soap_headers, (char*)ZSTR_VAL(buf), ZSTR_LEN(buf)); smart_str_append_const(soap_headers, "\r\n"); - zend_string_release(buf); + zend_string_release_ex(buf, 0); smart_str_free(&auth); return 1; } @@ -408,7 +408,7 @@ int make_http_soap_request(zval *this_ptr, zval_ptr_dtor(¶ms[0]); zval_ptr_dtor(&func); if (request != buf) { - zend_string_release(request); + zend_string_release_ex(request, 0); } smart_str_free(&soap_headers_z); return FALSE; @@ -446,7 +446,7 @@ try_again: if (phpurl == NULL || phpurl->host == NULL) { if (phpurl != NULL) {php_url_free(phpurl);} if (request != buf) { - zend_string_release(request); + zend_string_release_ex(request, 0); } add_soap_fault(this_ptr, "HTTP", "Unable to parse URL", NULL, NULL); smart_str_free(&soap_headers_z); @@ -459,7 +459,7 @@ try_again: } else if (phpurl->scheme == NULL || !zend_string_equals_literal(phpurl->scheme, "http")) { php_url_free(phpurl); if (request != buf) { - zend_string_release(request); + zend_string_release_ex(request, 0); } add_soap_fault(this_ptr, "HTTP", "Unknown protocol. Only http and https are allowed.", NULL, NULL); smart_str_free(&soap_headers_z); @@ -471,7 +471,7 @@ try_again: if (use_ssl && php_stream_locate_url_wrapper("https://", NULL, STREAM_LOCATE_WRAPPERS_ONLY) == NULL) { php_url_free(phpurl); if (request != buf) { - zend_string_release(request); + zend_string_release_ex(request, 0); } add_soap_fault(this_ptr, "HTTP", "SSL support is not available in this build", NULL, NULL); PG(allow_url_fopen) = old_allow_url_fopen; @@ -524,7 +524,7 @@ try_again: } else { php_url_free(phpurl); if (request != buf) { - zend_string_release(request); + zend_string_release_ex(request, 0); } add_soap_fault(this_ptr, "HTTP", "Could not connect to host", NULL, NULL); PG(allow_url_fopen) = old_allow_url_fopen; @@ -800,7 +800,7 @@ try_again: smart_str_append_const(&soap_headers, "Authorization: Basic "); smart_str_appendl(&soap_headers, (char*)ZSTR_VAL(buf), ZSTR_LEN(buf)); smart_str_append_const(&soap_headers, "\r\n"); - zend_string_release(buf); + zend_string_release_ex(buf, 0); smart_str_free(&auth); } } @@ -867,7 +867,7 @@ try_again: err = php_stream_write(stream, ZSTR_VAL(soap_headers.s), ZSTR_LEN(soap_headers.s)); if (err != ZSTR_LEN(soap_headers.s)) { if (request != buf) { - zend_string_release(request); + zend_string_release_ex(request, 0); } php_stream_close(stream); zend_hash_str_del(Z_OBJPROP_P(this_ptr), "httpurl", sizeof("httpurl")-1); @@ -896,7 +896,7 @@ try_again: http_headers = get_http_headers(stream); if (!http_headers) { if (request != buf) { - zend_string_release(request); + zend_string_release_ex(request, 0); } php_stream_close(stream); zend_hash_str_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket")-1); @@ -939,7 +939,7 @@ try_again: /* Try and get headers again */ if (http_status == 100) { - zend_string_release(http_headers); + zend_string_release_ex(http_headers, 0); } } } while (http_status == 100); @@ -1072,10 +1072,10 @@ try_again: http_body = get_http_body(stream, http_close, ZSTR_VAL(http_headers)); if (!http_body) { if (request != buf) { - zend_string_release(request); + zend_string_release_ex(request, 0); } php_stream_close(stream); - zend_string_release(http_headers); + zend_string_release_ex(http_headers, 0); zend_hash_str_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket")-1); zend_hash_str_del(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy")-1); add_soap_fault(this_ptr, "HTTP", "Error Fetching http body, No Content-Length, connection closed or chunked data", NULL, NULL); @@ -1087,7 +1087,7 @@ try_again: } if (request != buf) { - zend_string_release(request); + zend_string_release_ex(request, 0); } if (http_close) { @@ -1105,8 +1105,8 @@ try_again: php_url *new_url = php_url_parse(loc); if (new_url != NULL) { - zend_string_release(http_headers); - zend_string_release(http_body); + zend_string_release_ex(http_headers, 0); + zend_string_release_ex(http_body, 0); efree(loc); if (new_url->scheme == NULL && new_url->path != NULL) { new_url->scheme = phpurl->scheme ? zend_string_copy(phpurl->scheme) : NULL; @@ -1121,7 +1121,7 @@ try_again: strncpy(ZSTR_VAL(s), t, (p - t) + 1); ZSTR_VAL(s)[(p - t) + 1] = 0; strcat(ZSTR_VAL(s), ZSTR_VAL(new_url->path)); - zend_string_release(new_url->path); + zend_string_release_ex(new_url->path, 0); new_url->path = s; } } else { @@ -1129,7 +1129,7 @@ try_again: ZSTR_VAL(s)[0] = '/'; ZSTR_VAL(s)[1] = 0; strcat(ZSTR_VAL(s), ZSTR_VAL(new_url->path)); - zend_string_release(new_url->path); + zend_string_release_ex(new_url->path, 0); new_url->path = s; } } @@ -1214,8 +1214,8 @@ try_again: phpurl = new_url; efree(auth); - zend_string_release(http_headers); - zend_string_release(http_body); + zend_string_release_ex(http_headers, 0); + zend_string_release_ex(http_body, 0); goto try_again; } @@ -1245,7 +1245,7 @@ try_again: ZVAL_STRINGL(err, http_body, http_body_size, 1); add_soap_fault(this_ptr, "HTTP", "Didn't receive an xml document", NULL, err); efree(content_type); - zend_string_release(http_headers); + zend_string_release_ex(http_headers, 0); efree(http_body); return FALSE; } @@ -1272,8 +1272,8 @@ try_again: ZVAL_STR_COPY(¶ms[0], http_body); } else { efree(content_encoding); - zend_string_release(http_headers); - zend_string_release(http_body); + zend_string_release_ex(http_headers, 0); + zend_string_release_ex(http_body, 0); if (http_msg) { efree(http_msg); } @@ -1284,14 +1284,14 @@ try_again: Z_TYPE(retval) == IS_STRING) { zval_ptr_dtor(¶ms[0]); zval_ptr_dtor(&func); - zend_string_release(http_body); + zend_string_release_ex(http_body, 0); ZVAL_COPY_VALUE(return_value, &retval); } else { zval_ptr_dtor(¶ms[0]); zval_ptr_dtor(&func); efree(content_encoding); - zend_string_release(http_headers); - zend_string_release(http_body); + zend_string_release_ex(http_headers, 0); + zend_string_release_ex(http_body, 0); add_soap_fault(this_ptr, "HTTP", "Can't uncompress compressed response", NULL, NULL); if (http_msg) { efree(http_msg); @@ -1303,7 +1303,7 @@ try_again: ZVAL_STR(return_value, http_body); } - zend_string_release(http_headers); + zend_string_release_ex(http_headers, 0); if (http_status >= 400) { int error = 0; @@ -1420,7 +1420,7 @@ static zend_string* get_http_body(php_stream *stream, int close, char *headers) if (http_buf_size + buf_size + 1 < 0) { if (http_buf) { - zend_string_release(http_buf); + zend_string_release_ex(http_buf, 0); } return NULL; } @@ -1450,7 +1450,7 @@ static zend_string* get_http_body(php_stream *stream, int close, char *headers) if (ch != '\n') { /* Somthing wrong in chunked encoding */ if (http_buf) { - zend_string_release(http_buf); + zend_string_release_ex(http_buf, 0); } return NULL; } @@ -1458,7 +1458,7 @@ static zend_string* get_http_body(php_stream *stream, int close, char *headers) } else { /* Somthing wrong in chunked encoding */ if (http_buf) { - zend_string_release(http_buf); + zend_string_release_ex(http_buf, 0); } return NULL; } |