@@ -25,9 +25,6 @@ static char *get_http_header_value(char *headers, char *type);
2525static zend_string * get_http_body (php_stream * socketd , int close , char * headers );
2626static zend_string * get_http_headers (php_stream * socketd );
2727
28- #define smart_str_append_const (str , const ) \
29- smart_str_appendl(str,const,sizeof(const)-1)
30-
3128/* Proxy HTTP Authentication */
3229int proxy_authentication (zval * this_ptr , smart_str * soap_headers )
3330{
@@ -43,9 +40,9 @@ int proxy_authentication(zval* this_ptr, smart_str* soap_headers)
4340 }
4441 smart_str_0 (& auth );
4542 zend_string * buf = php_base64_encode ((unsigned char * )ZSTR_VAL (auth .s ), ZSTR_LEN (auth .s ));
46- smart_str_append_const (soap_headers , "Proxy-Authorization: Basic " );
43+ smart_str_append_literal (soap_headers , "Proxy-Authorization: Basic " );
4744 smart_str_append (soap_headers , buf );
48- smart_str_append_const (soap_headers , "\r\n" );
45+ smart_str_append_literal (soap_headers , "\r\n" );
4946 zend_string_release_ex (buf , 0 );
5047 smart_str_free (& auth );
5148 return 1 ;
@@ -69,9 +66,9 @@ int basic_authentication(zval* this_ptr, smart_str* soap_headers)
6966 }
7067 smart_str_0 (& auth );
7168 zend_string * buf = php_base64_encode ((unsigned char * )ZSTR_VAL (auth .s ), ZSTR_LEN (auth .s ));
72- smart_str_append_const (soap_headers , "Authorization: Basic " );
69+ smart_str_append_literal (soap_headers , "Authorization: Basic " );
7370 smart_str_append (soap_headers , buf );
74- smart_str_append_const (soap_headers , "\r\n" );
71+ smart_str_append_literal (soap_headers , "\r\n" );
7572 zend_string_release_ex (buf , 0 );
7673 smart_str_free (& auth );
7774 return 1 ;
@@ -134,7 +131,7 @@ static void http_context_add_header(const char *s,
134131 strncasecmp (s , "proxy-authorization" , sizeof ("proxy-authorization" )- 1 ) != 0 )) {
135132 /* add header */
136133 smart_str_appendl (soap_headers , s , p - s );
137- smart_str_append_const (soap_headers , "\r\n" );
134+ smart_str_append_literal (soap_headers , "\r\n" );
138135 }
139136 }
140137 s = (* p ) ? (p + 1 ) : p ;
@@ -253,20 +250,20 @@ static php_stream* http_connect(zval* this_ptr, php_uri *uri, int use_ssl, php_s
253250 zval_ptr_dtor (& ssl_proxy_peer_name );
254251 }
255252
256- smart_str_append_const (& soap_headers , "CONNECT " );
253+ smart_str_append_literal (& soap_headers , "CONNECT " );
257254 smart_str_append (& soap_headers , uri -> host );
258255 smart_str_appendc (& soap_headers , ':' );
259256 smart_str_append_unsigned (& soap_headers , uri -> port );
260- smart_str_append_const (& soap_headers , " HTTP/1.1\r\n" );
261- smart_str_append_const (& soap_headers , "Host: " );
257+ smart_str_append_literal (& soap_headers , " HTTP/1.1\r\n" );
258+ smart_str_append_literal (& soap_headers , "Host: " );
262259 smart_str_append (& soap_headers , uri -> host );
263260 if (uri -> port != 80 ) {
264261 smart_str_appendc (& soap_headers , ':' );
265262 smart_str_append_unsigned (& soap_headers , uri -> port );
266263 }
267- smart_str_append_const (& soap_headers , "\r\n" );
264+ smart_str_append_literal (& soap_headers , "\r\n" );
268265 proxy_authentication (this_ptr , & soap_headers );
269- smart_str_append_const (& soap_headers , "\r\n" );
266+ smart_str_append_literal (& soap_headers , "\r\n" );
270267 if (php_stream_write (stream , ZSTR_VAL (soap_headers .s ), ZSTR_LEN (soap_headers .s )) != ZSTR_LEN (soap_headers .s )) {
271268 php_stream_close (stream );
272269 stream = NULL ;
@@ -381,7 +378,7 @@ int make_http_soap_request(
381378 if (level > 9 ) {level = 9 ;}
382379
383380 if ((Z_LVAL_P (tmp ) & SOAP_COMPRESSION_ACCEPT ) != 0 ) {
384- smart_str_append_const (& soap_headers_z ,"Accept-Encoding: gzip, deflate\r\n" );
381+ smart_str_append_literal (& soap_headers_z ,"Accept-Encoding: gzip, deflate\r\n" );
385382 }
386383 if (level > 0 ) {
387384 zval func ;
@@ -394,11 +391,11 @@ int make_http_soap_request(
394391 if (kind == SOAP_COMPRESSION_DEFLATE ) {
395392 n = 2 ;
396393 ZVAL_STRING (& func , "gzcompress" );
397- smart_str_append_const (& soap_headers_z ,"Content-Encoding: deflate\r\n" );
394+ smart_str_append_literal (& soap_headers_z ,"Content-Encoding: deflate\r\n" );
398395 } else {
399396 n = 3 ;
400397 ZVAL_STRING (& func , "gzencode" );
401- smart_str_append_const (& soap_headers_z ,"Content-Encoding: gzip\r\n" );
398+ smart_str_append_literal (& soap_headers_z ,"Content-Encoding: gzip\r\n" );
402399 ZVAL_LONG (& params [2 ], 0x1f );
403400 }
404401 if (call_user_function (CG (function_table ), (zval * )NULL , & func , & retval , n , params ) == SUCCESS &&
@@ -572,10 +569,10 @@ int make_http_soap_request(
572569 http_1_1 = 1 ;
573570 }
574571
575- smart_str_append_const (& soap_headers , "POST " );
572+ smart_str_append_literal (& soap_headers , "POST " );
576573 if (use_proxy && !use_ssl ) {
577574 smart_str_append (& soap_headers , uri -> scheme );
578- smart_str_append_const (& soap_headers , "://" );
575+ smart_str_append_literal (& soap_headers , "://" );
579576 smart_str_append (& soap_headers , uri -> host );
580577 smart_str_appendc (& soap_headers , ':' );
581578 smart_str_append_unsigned (& soap_headers , uri -> port );
@@ -594,44 +591,44 @@ int make_http_soap_request(
594591 smart_str_append (& soap_headers , uri -> fragment );
595592 }
596593 if (http_1_1 ) {
597- smart_str_append_const (& soap_headers , " HTTP/1.1\r\n" );
594+ smart_str_append_literal (& soap_headers , " HTTP/1.1\r\n" );
598595 } else {
599- smart_str_append_const (& soap_headers , " HTTP/1.0\r\n" );
596+ smart_str_append_literal (& soap_headers , " HTTP/1.0\r\n" );
600597 }
601- smart_str_append_const (& soap_headers , "Host: " );
598+ smart_str_append_literal (& soap_headers , "Host: " );
602599 smart_str_append (& soap_headers , uri -> host );
603600 if (uri -> port != (use_ssl ?443 :80 )) {
604601 smart_str_appendc (& soap_headers , ':' );
605602 smart_str_append_unsigned (& soap_headers , uri -> port );
606603 }
607604 if (!http_1_1 || Z_TYPE_P (Z_CLIENT_KEEP_ALIVE_P (this_ptr )) == IS_FALSE ) {
608- smart_str_append_const (& soap_headers , "\r\n"
605+ smart_str_append_literal (& soap_headers , "\r\n"
609606 "Connection: close\r\n" );
610607 } else {
611- smart_str_append_const (& soap_headers , "\r\n"
608+ smart_str_append_literal (& soap_headers , "\r\n"
612609 "Connection: Keep-Alive\r\n" );
613610 }
614611 tmp = Z_CLIENT_USER_AGENT_P (this_ptr );
615612 if (Z_TYPE_P (tmp ) == IS_STRING ) {
616613 if (Z_STRLEN_P (tmp ) > 0 ) {
617- smart_str_append_const (& soap_headers , "User-Agent: " );
614+ smart_str_append_literal (& soap_headers , "User-Agent: " );
618615 smart_str_append (& soap_headers , Z_STR_P (tmp ));
619- smart_str_append_const (& soap_headers , "\r\n" );
616+ smart_str_append_literal (& soap_headers , "\r\n" );
620617 }
621618 } else if (context &&
622619 (tmp = php_stream_context_get_option (context , "http" , "user_agent" )) != NULL &&
623620 Z_TYPE_P (tmp ) == IS_STRING ) {
624621 if (Z_STRLEN_P (tmp ) > 0 ) {
625- smart_str_append_const (& soap_headers , "User-Agent: " );
622+ smart_str_append_literal (& soap_headers , "User-Agent: " );
626623 smart_str_append (& soap_headers , Z_STR_P (tmp ));
627- smart_str_append_const (& soap_headers , "\r\n" );
624+ smart_str_append_literal (& soap_headers , "\r\n" );
628625 }
629626 } else if (FG (user_agent )) {
630- smart_str_append_const (& soap_headers , "User-Agent: " );
627+ smart_str_append_literal (& soap_headers , "User-Agent: " );
631628 smart_str_appends (& soap_headers , FG (user_agent ));
632- smart_str_append_const (& soap_headers , "\r\n" );
629+ smart_str_append_literal (& soap_headers , "\r\n" );
633630 } else {
634- smart_str_append_const (& soap_headers , "User-Agent: PHP-SOAP/" PHP_VERSION "\r\n" );
631+ smart_str_append_literal (& soap_headers , "User-Agent: PHP-SOAP/" PHP_VERSION "\r\n" );
635632 }
636633
637634 smart_str_append_smart_str (& soap_headers , & soap_headers_z );
@@ -642,38 +639,38 @@ int make_http_soap_request(
642639 Z_TYPE_P (tmp ) == IS_STRING &&
643640 Z_STRLEN_P (tmp ) > 0
644641 ) {
645- smart_str_append_const (& soap_headers , "Content-Type: " );
642+ smart_str_append_literal (& soap_headers , "Content-Type: " );
646643 smart_str_append (& soap_headers , Z_STR_P (tmp ));
647644 } else {
648- smart_str_append_const (& soap_headers , "Content-Type: application/soap+xml; charset=utf-8" );
645+ smart_str_append_literal (& soap_headers , "Content-Type: application/soap+xml; charset=utf-8" );
649646 }
650647 if (soapaction ) {
651- smart_str_append_const (& soap_headers ,"; action=\"" );
648+ smart_str_append_literal (& soap_headers ,"; action=\"" );
652649 smart_str_appends (& soap_headers , soapaction );
653- smart_str_append_const (& soap_headers ,"\"" );
650+ smart_str_append_literal (& soap_headers ,"\"" );
654651 }
655- smart_str_append_const (& soap_headers ,"\r\n" );
652+ smart_str_append_literal (& soap_headers ,"\r\n" );
656653 } else {
657654 if (context &&
658655 (tmp = php_stream_context_get_option (context , "http" , "content_type" )) != NULL &&
659656 Z_TYPE_P (tmp ) == IS_STRING &&
660657 Z_STRLEN_P (tmp ) > 0
661658 ) {
662- smart_str_append_const (& soap_headers , "Content-Type: " );
659+ smart_str_append_literal (& soap_headers , "Content-Type: " );
663660 smart_str_append (& soap_headers , Z_STR_P (tmp ));
664- smart_str_append_const (& soap_headers , "\r\n" );
661+ smart_str_append_literal (& soap_headers , "\r\n" );
665662 } else {
666- smart_str_append_const (& soap_headers , "Content-Type: text/xml; charset=utf-8\r\n" );
663+ smart_str_append_literal (& soap_headers , "Content-Type: text/xml; charset=utf-8\r\n" );
667664 }
668665 if (soapaction ) {
669- smart_str_append_const (& soap_headers , "SOAPAction: \"" );
666+ smart_str_append_literal (& soap_headers , "SOAPAction: \"" );
670667 smart_str_appends (& soap_headers , soapaction );
671- smart_str_append_const (& soap_headers , "\"\r\n" );
668+ smart_str_append_literal (& soap_headers , "\"\r\n" );
672669 }
673670 }
674- smart_str_append_const (& soap_headers ,"Content-Length: " );
671+ smart_str_append_literal (& soap_headers ,"Content-Length: " );
675672 smart_str_append_long (& soap_headers , request -> len );
676- smart_str_append_const (& soap_headers , "\r\n" );
673+ smart_str_append_literal (& soap_headers , "\r\n" );
677674
678675 /* HTTP Authentication */
679676 login = Z_CLIENT_LOGIN_P (this_ptr );
@@ -779,19 +776,19 @@ int make_http_soap_request(
779776 PHP_MD5Final (hash , & md5ctx );
780777 make_digest (response , hash );
781778
782- smart_str_append_const (& soap_headers , "Authorization: Digest username=\"" );
779+ smart_str_append_literal (& soap_headers , "Authorization: Digest username=\"" );
783780 smart_str_append (& soap_headers , Z_STR_P (login ));
784781 if ((tmp = zend_hash_str_find (Z_ARRVAL_P (digest ), "realm" , sizeof ("realm" )- 1 )) != NULL &&
785782 Z_TYPE_P (tmp ) == IS_STRING ) {
786- smart_str_append_const (& soap_headers , "\", realm=\"" );
783+ smart_str_append_literal (& soap_headers , "\", realm=\"" );
787784 smart_str_append (& soap_headers , Z_STR_P (tmp ));
788785 }
789786 if ((tmp = zend_hash_str_find (Z_ARRVAL_P (digest ), "nonce" , sizeof ("nonce" )- 1 )) != NULL &&
790787 Z_TYPE_P (tmp ) == IS_STRING ) {
791- smart_str_append_const (& soap_headers , "\", nonce=\"" );
788+ smart_str_append_literal (& soap_headers , "\", nonce=\"" );
792789 smart_str_append (& soap_headers , Z_STR_P (tmp ));
793790 }
794- smart_str_append_const (& soap_headers , "\", uri=\"" );
791+ smart_str_append_literal (& soap_headers , "\", uri=\"" );
795792 if (uri -> path ) {
796793 smart_str_append (& soap_headers , uri -> path );
797794 } else {
@@ -808,25 +805,25 @@ int make_http_soap_request(
808805 if ((tmp = zend_hash_str_find (Z_ARRVAL_P (digest ), "qop" , sizeof ("qop" )- 1 )) != NULL &&
809806 Z_TYPE_P (tmp ) == IS_STRING ) {
810807 /* TODO: Support for qop=auth-int */
811- smart_str_append_const (& soap_headers , "\", qop=auth" );
812- smart_str_append_const (& soap_headers , ", nc=" );
808+ smart_str_append_literal (& soap_headers , "\", qop=auth" );
809+ smart_str_append_literal (& soap_headers , ", nc=" );
813810 smart_str_appendl (& soap_headers , nc , 8 );
814- smart_str_append_const (& soap_headers , ", cnonce=\"" );
811+ smart_str_append_literal (& soap_headers , ", cnonce=\"" );
815812 smart_str_appendl (& soap_headers , cnonce , 8 );
816813 }
817- smart_str_append_const (& soap_headers , "\", response=\"" );
814+ smart_str_append_literal (& soap_headers , "\", response=\"" );
818815 smart_str_appendl (& soap_headers , response , 32 );
819816 if ((tmp = zend_hash_str_find (Z_ARRVAL_P (digest ), "opaque" , sizeof ("opaque" )- 1 )) != NULL &&
820817 Z_TYPE_P (tmp ) == IS_STRING ) {
821- smart_str_append_const (& soap_headers , "\", opaque=\"" );
818+ smart_str_append_literal (& soap_headers , "\", opaque=\"" );
822819 smart_str_append (& soap_headers , Z_STR_P (tmp ));
823820 }
824821 if ((tmp = zend_hash_str_find (Z_ARRVAL_P (digest ), "algorithm" , sizeof ("algorithm" )- 1 )) != NULL &&
825822 Z_TYPE_P (tmp ) == IS_STRING ) {
826- smart_str_append_const (& soap_headers , "\", algorithm=\"" );
823+ smart_str_append_literal (& soap_headers , "\", algorithm=\"" );
827824 smart_str_append (& soap_headers , Z_STR_P (tmp ));
828825 }
829- smart_str_append_const (& soap_headers , "\"\r\n" );
826+ smart_str_append_literal (& soap_headers , "\"\r\n" );
830827 } else {
831828 zend_string * buf ;
832829
@@ -839,9 +836,9 @@ int make_http_soap_request(
839836 }
840837 smart_str_0 (& auth );
841838 buf = php_base64_encode ((unsigned char * )ZSTR_VAL (auth .s ), ZSTR_LEN (auth .s ));
842- smart_str_append_const (& soap_headers , "Authorization: Basic " );
839+ smart_str_append_literal (& soap_headers , "Authorization: Basic " );
843840 smart_str_append (& soap_headers , buf );
844- smart_str_append_const (& soap_headers , "\r\n" );
841+ smart_str_append_literal (& soap_headers , "\r\n" );
845842 zend_string_release_ex (buf , 0 );
846843 smart_str_free (& auth );
847844 }
@@ -860,7 +857,7 @@ int make_http_soap_request(
860857 zend_string * key ;
861858 has_cookies = true;
862859 bool first_cookie = true;
863- smart_str_append_const (& soap_headers , "Cookie: " );
860+ smart_str_append_literal (& soap_headers , "Cookie: " );
864861 ZEND_HASH_MAP_FOREACH_STR_KEY_VAL (Z_ARRVAL_P (cookies ), key , data ) {
865862 if (key && Z_TYPE_P (data ) == IS_ARRAY ) {
866863 zval * value ;
@@ -886,12 +883,12 @@ int make_http_soap_request(
886883 }
887884 }
888885 } ZEND_HASH_FOREACH_END ();
889- smart_str_append_const (& soap_headers , "\r\n" );
886+ smart_str_append_literal (& soap_headers , "\r\n" );
890887 }
891888
892889 http_context_headers (context , has_authorization , has_proxy_authorization , has_cookies , & soap_headers );
893890
894- smart_str_append_const (& soap_headers , "\r\n" );
891+ smart_str_append_literal (& soap_headers , "\r\n" );
895892 smart_str_0 (& soap_headers );
896893 if (client_trace ) {
897894 zval_ptr_dtor (Z_CLIENT_LAST_REQUEST_HEADERS_P (this_ptr ));
0 commit comments