2020#include "ext/hash/php_hash.h" /* For php_hash_bin2hex() */
2121
2222static char * get_http_header_value_nodup (char * headers , char * type , size_t * len );
23- static char * get_http_header_value (char * headers , char * type );
23+ static char * get_http_header_value (zend_string * headers , char * type );
2424static zend_string * get_http_body (php_stream * stream , bool close , zend_string * headers );
2525static zend_string * get_http_headers (php_stream * stream );
2626
@@ -958,7 +958,7 @@ bool make_http_soap_request(
958958 /* Check to see what HTTP status was sent */
959959 http_1_1 = false;
960960 http_status = 0 ;
961- http_version = get_http_header_value (ZSTR_VAL ( http_headers ) , "HTTP/" );
961+ http_version = get_http_header_value (http_headers , "HTTP/" );
962962 if (http_version ) {
963963 char * tmp ;
964964
@@ -1084,7 +1084,7 @@ bool make_http_soap_request(
10841084 if (http_1_1 ) {
10851085 http_close = false;
10861086 if (use_proxy && !use_ssl ) {
1087- connection = get_http_header_value (ZSTR_VAL ( http_headers ) , "Proxy-Connection:" );
1087+ connection = get_http_header_value (http_headers , "Proxy-Connection:" );
10881088 if (connection ) {
10891089 if (strncasecmp (connection , "close" , sizeof ("close" )- 1 ) == 0 ) {
10901090 http_close = true;
@@ -1093,7 +1093,7 @@ bool make_http_soap_request(
10931093 }
10941094 }
10951095 if (!http_close ) {
1096- connection = get_http_header_value (ZSTR_VAL ( http_headers ) , "Connection:" );
1096+ connection = get_http_header_value (http_headers , "Connection:" );
10971097 if (connection ) {
10981098 if (strncasecmp (connection , "close" , sizeof ("close" )- 1 ) == 0 ) {
10991099 http_close = true;
@@ -1104,7 +1104,7 @@ bool make_http_soap_request(
11041104 } else {
11051105 http_close = true;
11061106 if (use_proxy && !use_ssl ) {
1107- connection = get_http_header_value (ZSTR_VAL ( http_headers ) , "Proxy-Connection:" );
1107+ connection = get_http_header_value (http_headers , "Proxy-Connection:" );
11081108 if (connection ) {
11091109 if (strncasecmp (connection , "Keep-Alive" , sizeof ("Keep-Alive" )- 1 ) == 0 ) {
11101110 http_close = false;
@@ -1113,7 +1113,7 @@ bool make_http_soap_request(
11131113 }
11141114 }
11151115 if (http_close ) {
1116- connection = get_http_header_value (ZSTR_VAL ( http_headers ) , "Connection:" );
1116+ connection = get_http_header_value (http_headers , "Connection:" );
11171117 if (connection ) {
11181118 if (strncasecmp (connection , "Keep-Alive" , sizeof ("Keep-Alive" )- 1 ) == 0 ) {
11191119 http_close = false;
@@ -1156,7 +1156,7 @@ bool make_http_soap_request(
11561156 if (http_status >= 300 && http_status < 400 ) {
11571157 char * loc ;
11581158
1159- if ((loc = get_http_header_value (ZSTR_VAL ( http_headers ) , "Location:" )) != NULL ) {
1159+ if ((loc = get_http_header_value (http_headers , "Location:" )) != NULL ) {
11601160 php_url * new_url = php_url_parse (loc );
11611161
11621162 if (new_url != NULL ) {
@@ -1206,7 +1206,7 @@ bool make_http_soap_request(
12061206 zval * digest = Z_CLIENT_DIGEST_P (this_ptr );
12071207 zval * login = Z_CLIENT_LOGIN_P (this_ptr );
12081208 zval * password = Z_CLIENT_PASSWORD_P (this_ptr );
1209- char * auth = get_http_header_value (ZSTR_VAL ( http_headers ) , "WWW-Authenticate:" );
1209+ char * auth = get_http_header_value (http_headers , "WWW-Authenticate:" );
12101210 if (auth && strstr (auth , "Digest" ) == auth && Z_TYPE_P (digest ) != IS_ARRAY
12111211 && Z_TYPE_P (login ) == IS_STRING && Z_TYPE_P (password ) == IS_STRING ) {
12121212 char * s ;
@@ -1276,7 +1276,7 @@ bool make_http_soap_request(
12761276 smart_str_free (& soap_headers_z );
12771277
12781278 /* Check and see if the server even sent a xml document */
1279- content_type = get_http_header_value (ZSTR_VAL ( http_headers ) , "Content-Type:" );
1279+ content_type = get_http_header_value (http_headers , "Content-Type:" );
12801280 if (content_type ) {
12811281 char * pos = NULL ;
12821282 int cmplen ;
@@ -1306,7 +1306,7 @@ bool make_http_soap_request(
13061306 }
13071307
13081308 /* Decompress response */
1309- content_encoding = get_http_header_value (ZSTR_VAL ( http_headers ) , "Content-Encoding:" );
1309+ content_encoding = get_http_header_value (http_headers , "Content-Encoding:" );
13101310 if (content_encoding ) {
13111311 zval retval ;
13121312 zval params [1 ];
@@ -1440,12 +1440,12 @@ static char *get_http_header_value_nodup(char *headers, char *type, size_t *len)
14401440 return NULL ;
14411441}
14421442
1443- static char * get_http_header_value (char * headers , char * type )
1443+ static char * get_http_header_value (zend_string * headers , char * type )
14441444{
14451445 size_t len ;
14461446 char * value ;
14471447
1448- value = get_http_header_value_nodup (headers , type , & len );
1448+ value = get_http_header_value_nodup (ZSTR_VAL ( headers ) , type , & len );
14491449
14501450 if (value ) {
14511451 return estrndup (value , len );
@@ -1464,22 +1464,22 @@ static zend_string* get_http_body(php_stream *stream, bool close, zend_string *h
14641464 size_t http_buf_size = 0 ;
14651465
14661466 if (!close ) {
1467- header = get_http_header_value (ZSTR_VAL ( headers ) , "Connection:" );
1467+ header = get_http_header_value (headers , "Connection:" );
14681468 if (header ) {
14691469 if (!strncasecmp (header , "close" , sizeof ("close" )- 1 )) {
14701470 header_close = true;
14711471 }
14721472 efree (header );
14731473 }
14741474 }
1475- header = get_http_header_value (ZSTR_VAL ( headers ) , "Transfer-Encoding:" );
1475+ header = get_http_header_value (headers , "Transfer-Encoding:" );
14761476 if (header ) {
14771477 if (!strncasecmp (header , "chunked" , sizeof ("chunked" )- 1 )) {
14781478 header_chunked = true;
14791479 }
14801480 efree (header );
14811481 }
1482- header = get_http_header_value (ZSTR_VAL ( headers ) , "Content-Length:" );
1482+ header = get_http_header_value (headers , "Content-Length:" );
14831483 if (header ) {
14841484 header_length = atoi (header );
14851485 efree (header );
0 commit comments