Skip to content

Commit 1ee7821

Browse files
committed
ext/soap/php_http.c: Use more appropriate smart_str API
1 parent 45c0e6b commit 1ee7821

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

ext/soap/php_http.c

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,12 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph
253253
}
254254

255255
smart_str_append_const(&soap_headers, "CONNECT ");
256-
smart_str_appends(&soap_headers, ZSTR_VAL(phpurl->host));
256+
smart_str_append(&soap_headers, phpurl->host);
257257
smart_str_appendc(&soap_headers, ':');
258258
smart_str_append_unsigned(&soap_headers, phpurl->port);
259259
smart_str_append_const(&soap_headers, " HTTP/1.1\r\n");
260260
smart_str_append_const(&soap_headers, "Host: ");
261-
smart_str_appends(&soap_headers, ZSTR_VAL(phpurl->host));
261+
smart_str_append(&soap_headers, phpurl->host);
262262
if (phpurl->port != 80) {
263263
smart_str_appendc(&soap_headers, ':');
264264
smart_str_append_unsigned(&soap_headers, phpurl->port);
@@ -584,32 +584,32 @@ int make_http_soap_request(zval *this_ptr,
584584

585585
smart_str_append_const(&soap_headers, "POST ");
586586
if (use_proxy && !use_ssl) {
587-
smart_str_appends(&soap_headers, ZSTR_VAL(phpurl->scheme));
587+
smart_str_append(&soap_headers, phpurl->scheme);
588588
smart_str_append_const(&soap_headers, "://");
589-
smart_str_appends(&soap_headers, ZSTR_VAL(phpurl->host));
589+
smart_str_append(&soap_headers, phpurl->host);
590590
smart_str_appendc(&soap_headers, ':');
591591
smart_str_append_unsigned(&soap_headers, phpurl->port);
592592
}
593593
if (phpurl->path) {
594-
smart_str_appends(&soap_headers, ZSTR_VAL(phpurl->path));
594+
smart_str_append(&soap_headers, phpurl->path);
595595
} else {
596596
smart_str_appendc(&soap_headers, '/');
597597
}
598598
if (phpurl->query) {
599599
smart_str_appendc(&soap_headers, '?');
600-
smart_str_appends(&soap_headers, ZSTR_VAL(phpurl->query));
600+
smart_str_append(&soap_headers, phpurl->query);
601601
}
602602
if (phpurl->fragment) {
603603
smart_str_appendc(&soap_headers, '#');
604-
smart_str_appends(&soap_headers, ZSTR_VAL(phpurl->fragment));
604+
smart_str_append(&soap_headers, phpurl->fragment);
605605
}
606606
if (http_1_1) {
607607
smart_str_append_const(&soap_headers, " HTTP/1.1\r\n");
608608
} else {
609609
smart_str_append_const(&soap_headers, " HTTP/1.0\r\n");
610610
}
611611
smart_str_append_const(&soap_headers, "Host: ");
612-
smart_str_appends(&soap_headers, ZSTR_VAL(phpurl->host));
612+
smart_str_append(&soap_headers, phpurl->host);
613613
if (phpurl->port != (use_ssl?443:80)) {
614614
smart_str_appendc(&soap_headers, ':');
615615
smart_str_append_unsigned(&soap_headers, phpurl->port);
@@ -625,15 +625,15 @@ int make_http_soap_request(zval *this_ptr,
625625
if (Z_TYPE_P(tmp) == IS_STRING) {
626626
if (Z_STRLEN_P(tmp) > 0) {
627627
smart_str_append_const(&soap_headers, "User-Agent: ");
628-
smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
628+
smart_str_append(&soap_headers, Z_STR_P(tmp));
629629
smart_str_append_const(&soap_headers, "\r\n");
630630
}
631631
} else if (context &&
632632
(tmp = php_stream_context_get_option(context, "http", "user_agent")) != NULL &&
633633
Z_TYPE_P(tmp) == IS_STRING) {
634634
if (Z_STRLEN_P(tmp) > 0) {
635635
smart_str_append_const(&soap_headers, "User-Agent: ");
636-
smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
636+
smart_str_append(&soap_headers, Z_STR_P(tmp));
637637
smart_str_append_const(&soap_headers, "\r\n");
638638
}
639639
} else if (FG(user_agent)) {
@@ -653,7 +653,7 @@ int make_http_soap_request(zval *this_ptr,
653653
Z_STRLEN_P(tmp) > 0
654654
) {
655655
smart_str_append_const(&soap_headers, "Content-Type: ");
656-
smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
656+
smart_str_append(&soap_headers, Z_STR_P(tmp));
657657
} else {
658658
smart_str_append_const(&soap_headers, "Content-Type: application/soap+xml; charset=utf-8");
659659
}
@@ -670,7 +670,7 @@ int make_http_soap_request(zval *this_ptr,
670670
Z_STRLEN_P(tmp) > 0
671671
) {
672672
smart_str_append_const(&soap_headers, "Content-Type: ");
673-
smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
673+
smart_str_append(&soap_headers, Z_STR_P(tmp));
674674
smart_str_append_const(&soap_headers, "\r\n");
675675
} else {
676676
smart_str_append_const(&soap_headers, "Content-Type: text/xml; charset=utf-8\r\n");
@@ -682,7 +682,7 @@ int make_http_soap_request(zval *this_ptr,
682682
}
683683
}
684684
smart_str_append_const(&soap_headers,"Content-Length: ");
685-
smart_str_append_long(&soap_headers, request->len);
685+
smart_str_append_unsigned(&soap_headers, ZSTR_LEN(request));
686686
smart_str_append_const(&soap_headers, "\r\n");
687687

688688
/* HTTP Authentication */
@@ -790,30 +790,30 @@ int make_http_soap_request(zval *this_ptr,
790790
make_digest(response, hash);
791791

792792
smart_str_append_const(&soap_headers, "Authorization: Digest username=\"");
793-
smart_str_appendl(&soap_headers, Z_STRVAL_P(login), Z_STRLEN_P(login));
793+
smart_str_append(&soap_headers, Z_STR_P(login));
794794
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "realm", sizeof("realm")-1)) != NULL &&
795795
Z_TYPE_P(tmp) == IS_STRING) {
796796
smart_str_append_const(&soap_headers, "\", realm=\"");
797-
smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
797+
smart_str_append(&soap_headers, Z_STR_P(tmp));
798798
}
799799
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "nonce", sizeof("nonce")-1)) != NULL &&
800800
Z_TYPE_P(tmp) == IS_STRING) {
801801
smart_str_append_const(&soap_headers, "\", nonce=\"");
802-
smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
802+
smart_str_append(&soap_headers, Z_STR_P(tmp));
803803
}
804804
smart_str_append_const(&soap_headers, "\", uri=\"");
805805
if (phpurl->path) {
806-
smart_str_appends(&soap_headers, ZSTR_VAL(phpurl->path));
806+
smart_str_append(&soap_headers, phpurl->path);
807807
} else {
808808
smart_str_appendc(&soap_headers, '/');
809809
}
810810
if (phpurl->query) {
811811
smart_str_appendc(&soap_headers, '?');
812-
smart_str_appends(&soap_headers, ZSTR_VAL(phpurl->query));
812+
smart_str_append(&soap_headers, phpurl->query);
813813
}
814814
if (phpurl->fragment) {
815815
smart_str_appendc(&soap_headers, '#');
816-
smart_str_appends(&soap_headers, ZSTR_VAL(phpurl->fragment));
816+
smart_str_append(&soap_headers, phpurl->fragment);
817817
}
818818
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "qop", sizeof("qop")-1)) != NULL &&
819819
Z_TYPE_P(tmp) == IS_STRING) {
@@ -829,12 +829,12 @@ int make_http_soap_request(zval *this_ptr,
829829
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "opaque", sizeof("opaque")-1)) != NULL &&
830830
Z_TYPE_P(tmp) == IS_STRING) {
831831
smart_str_append_const(&soap_headers, "\", opaque=\"");
832-
smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
832+
smart_str_append(&soap_headers, Z_STR_P(tmp));
833833
}
834834
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "algorithm", sizeof("algorithm")-1)) != NULL &&
835835
Z_TYPE_P(tmp) == IS_STRING) {
836836
smart_str_append_const(&soap_headers, "\", algorithm=\"");
837-
smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
837+
smart_str_append(&soap_headers, Z_STR_P(tmp));
838838
}
839839
smart_str_append_const(&soap_headers, "\"\r\n");
840840
} else {
@@ -886,7 +886,7 @@ int make_http_soap_request(zval *this_ptr,
886886
in_domain(phpurl->host, Z_STR_P(tmp))) &&
887887
(use_ssl || (tmp = zend_hash_index_find(Z_ARRVAL_P(data), 3)) == NULL)) {
888888
if (!first_cookie) {
889-
smart_str_appends(&soap_headers, "; ");
889+
smart_str_append_const(&soap_headers, "; ");
890890
}
891891
first_cookie = false;
892892
smart_str_append(&soap_headers, key);
@@ -909,7 +909,7 @@ int make_http_soap_request(zval *this_ptr,
909909
ZVAL_STRINGL(Z_CLIENT_LAST_REQUEST_HEADERS_P(this_ptr),
910910
ZSTR_VAL(soap_headers.s), ZSTR_LEN(soap_headers.s));
911911
}
912-
smart_str_appendl(&soap_headers, request->val, request->len);
912+
smart_str_append(&soap_headers, request);
913913
smart_str_0(&soap_headers);
914914

915915
err = php_stream_write(stream, ZSTR_VAL(soap_headers.s), ZSTR_LEN(soap_headers.s));

0 commit comments

Comments
 (0)