20
20
#include "ext/hash/php_hash.h" /* For php_hash_bin2hex() */
21
21
22
22
static 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 );
24
24
static zend_string * get_http_body (php_stream * stream , bool close , zend_string * headers );
25
25
static zend_string * get_http_headers (php_stream * stream );
26
26
@@ -958,7 +958,7 @@ bool make_http_soap_request(
958
958
/* Check to see what HTTP status was sent */
959
959
http_1_1 = false;
960
960
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/" );
962
962
if (http_version ) {
963
963
char * tmp ;
964
964
@@ -1084,7 +1084,7 @@ bool make_http_soap_request(
1084
1084
if (http_1_1 ) {
1085
1085
http_close = false;
1086
1086
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:" );
1088
1088
if (connection ) {
1089
1089
if (strncasecmp (connection , "close" , sizeof ("close" )- 1 ) == 0 ) {
1090
1090
http_close = true;
@@ -1093,7 +1093,7 @@ bool make_http_soap_request(
1093
1093
}
1094
1094
}
1095
1095
if (!http_close ) {
1096
- connection = get_http_header_value (ZSTR_VAL ( http_headers ) , "Connection:" );
1096
+ connection = get_http_header_value (http_headers , "Connection:" );
1097
1097
if (connection ) {
1098
1098
if (strncasecmp (connection , "close" , sizeof ("close" )- 1 ) == 0 ) {
1099
1099
http_close = true;
@@ -1104,7 +1104,7 @@ bool make_http_soap_request(
1104
1104
} else {
1105
1105
http_close = true;
1106
1106
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:" );
1108
1108
if (connection ) {
1109
1109
if (strncasecmp (connection , "Keep-Alive" , sizeof ("Keep-Alive" )- 1 ) == 0 ) {
1110
1110
http_close = false;
@@ -1113,7 +1113,7 @@ bool make_http_soap_request(
1113
1113
}
1114
1114
}
1115
1115
if (http_close ) {
1116
- connection = get_http_header_value (ZSTR_VAL ( http_headers ) , "Connection:" );
1116
+ connection = get_http_header_value (http_headers , "Connection:" );
1117
1117
if (connection ) {
1118
1118
if (strncasecmp (connection , "Keep-Alive" , sizeof ("Keep-Alive" )- 1 ) == 0 ) {
1119
1119
http_close = false;
@@ -1156,7 +1156,7 @@ bool make_http_soap_request(
1156
1156
if (http_status >= 300 && http_status < 400 ) {
1157
1157
char * loc ;
1158
1158
1159
- if ((loc = get_http_header_value (ZSTR_VAL ( http_headers ) , "Location:" )) != NULL ) {
1159
+ if ((loc = get_http_header_value (http_headers , "Location:" )) != NULL ) {
1160
1160
php_url * new_url = php_url_parse (loc );
1161
1161
1162
1162
if (new_url != NULL ) {
@@ -1206,7 +1206,7 @@ bool make_http_soap_request(
1206
1206
zval * digest = Z_CLIENT_DIGEST_P (this_ptr );
1207
1207
zval * login = Z_CLIENT_LOGIN_P (this_ptr );
1208
1208
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:" );
1210
1210
if (auth && strstr (auth , "Digest" ) == auth && Z_TYPE_P (digest ) != IS_ARRAY
1211
1211
&& Z_TYPE_P (login ) == IS_STRING && Z_TYPE_P (password ) == IS_STRING ) {
1212
1212
char * s ;
@@ -1276,7 +1276,7 @@ bool make_http_soap_request(
1276
1276
smart_str_free (& soap_headers_z );
1277
1277
1278
1278
/* 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:" );
1280
1280
if (content_type ) {
1281
1281
char * pos = NULL ;
1282
1282
int cmplen ;
@@ -1306,7 +1306,7 @@ bool make_http_soap_request(
1306
1306
}
1307
1307
1308
1308
/* 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:" );
1310
1310
if (content_encoding ) {
1311
1311
zval retval ;
1312
1312
zval params [1 ];
@@ -1440,12 +1440,12 @@ static char *get_http_header_value_nodup(char *headers, char *type, size_t *len)
1440
1440
return NULL ;
1441
1441
}
1442
1442
1443
- static char * get_http_header_value (char * headers , char * type )
1443
+ static char * get_http_header_value (zend_string * headers , char * type )
1444
1444
{
1445
1445
size_t len ;
1446
1446
char * value ;
1447
1447
1448
- value = get_http_header_value_nodup (headers , type , & len );
1448
+ value = get_http_header_value_nodup (ZSTR_VAL ( headers ) , type , & len );
1449
1449
1450
1450
if (value ) {
1451
1451
return estrndup (value , len );
@@ -1464,22 +1464,22 @@ static zend_string* get_http_body(php_stream *stream, bool close, zend_string *h
1464
1464
size_t http_buf_size = 0 ;
1465
1465
1466
1466
if (!close ) {
1467
- header = get_http_header_value (ZSTR_VAL ( headers ) , "Connection:" );
1467
+ header = get_http_header_value (headers , "Connection:" );
1468
1468
if (header ) {
1469
1469
if (!strncasecmp (header , "close" , sizeof ("close" )- 1 )) {
1470
1470
header_close = true;
1471
1471
}
1472
1472
efree (header );
1473
1473
}
1474
1474
}
1475
- header = get_http_header_value (ZSTR_VAL ( headers ) , "Transfer-Encoding:" );
1475
+ header = get_http_header_value (headers , "Transfer-Encoding:" );
1476
1476
if (header ) {
1477
1477
if (!strncasecmp (header , "chunked" , sizeof ("chunked" )- 1 )) {
1478
1478
header_chunked = true;
1479
1479
}
1480
1480
efree (header );
1481
1481
}
1482
- header = get_http_header_value (ZSTR_VAL ( headers ) , "Content-Length:" );
1482
+ header = get_http_header_value (headers , "Content-Length:" );
1483
1483
if (header ) {
1484
1484
header_length = atoi (header );
1485
1485
efree (header );
0 commit comments