svn: /php/php-src/ branches/PHP_5_2/NEWS branches/PHP_5_2/ext/soap/php_http.c branches/PHP_5_3/NEWS branches/PHP_5_3/ext/soap/php_http.c
trunk/ext/soap/php_http.c
| From: | Sriram Natarajan | Date: | Tue, 05 Jan 2010 03:07:43 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_2/NEWS branches/PHP_5_2/ext/soap/php_http.c branches/PHP_5_3/NEWS branches/PHP_5_3/ext/soap/php_http.c trunk/ext/soap/php_http.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-61476@lists.php.net to get a copy of this message | ||
srinatar Tue, 05 Jan 2010 03:07:43 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=293131
Log:
- Fixed bug #48590 (SoapClient does not honor max_redirects)
Bug: http://bugs.php.net/48590 (Closed) SOAP Client
(redirect loop)
Changed paths:
U php/php-src/branches/PHP_5_2/NEWS
U php/php-src/branches/PHP_5_2/ext/soap/php_http.c
U php/php-src/branches/PHP_5_3/NEWS
U php/php-src/branches/PHP_5_3/ext/soap/php_http.c
U php/php-src/trunk/ext/soap/php_http.c
Modified: php/php-src/branches/PHP_5_2/NEWS
===================================================================
--- php/php-src/branches/PHP_5_2/NEWS 2010-01-05 02:55:24 UTC (rev 293130)
+++ php/php-src/branches/PHP_5_2/NEWS 2010-01-05 03:07:43 UTC (rev 293131)
@@ -24,6 +24,7 @@
(Jani)
- Fixed bug #50394 (Reference argument converted to value in __call). (Stas)
- Fixed bug #49851 (http wrapper breaks on 1024 char long headers). (Ilia)
+- Fixed bug #48590 (SoapClient does not honor max_redirects). (Sriram)
- Fixed bug #48190 (Content-type parameter "boundary" is not case-insensitive
in HTTP uploads). (Ilia)
- Fixed bug #47409 (extract() problem with array containing word "this").
Modified: php/php-src/branches/PHP_5_2/ext/soap/php_http.c
===================================================================
--- php/php-src/branches/PHP_5_2/ext/soap/php_http.c 2010-01-05 02:55:24 UTC (rev 293130)
+++ php/php-src/branches/PHP_5_2/ext/soap/php_http.c 2010-01-05 03:07:43 UTC (rev 293131)
@@ -237,9 +237,11 @@
int http_1_1;
int http_status;
int content_type_xml = 0;
+ long redirect_max = 20;
char *content_encoding;
char *http_msg = NULL;
zend_bool old_allow_url_fopen;
+ php_stream_context *context = NULL;
if (this_ptr == NULL || Z_TYPE_P(this_ptr) != IS_OBJECT) {
return FALSE;
@@ -307,6 +309,19 @@
phpurl = php_url_parse(location);
}
+ if (SUCCESS == zend_hash_find(Z_OBJPROP_P(this_ptr),
+ "_stream_context", sizeof("_stream_context"), (void**)&tmp)) {
+ context = php_stream_context_from_zval(*tmp, 0);
+ }
+
+ if (context &&
+ php_stream_context_get_option(context, "http", "max_redirects", &tmp) ==
SUCCESS) {
+ if (Z_TYPE_PP(tmp) != IS_STRING || !is_numeric_string(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp),
&redirect_max, NULL, 1)) {
+ if (Z_TYPE_PP(tmp) == IS_LONG)
+ redirect_max = Z_LVAL_PP(tmp);
+ }
+ }
+
try_again:
if (phpurl == NULL || phpurl->host == NULL) {
if (phpurl != NULL) {php_url_free(phpurl);}
@@ -953,6 +968,12 @@
}
phpurl = new_url;
+ if (--redirect_max < 1) {
+ smart_str_free(&soap_headers_z);
+ add_soap_fault(this_ptr, "HTTP", "Redirection limit reached, aborting",
NULL, NULL TSRMLS_CC);
+ return FALSE;
+ }
+
goto try_again;
}
}
Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS 2010-01-05 02:55:24 UTC (rev 293130)
+++ php/php-src/branches/PHP_5_3/NEWS 2010-01-05 03:07:43 UTC (rev 293131)
@@ -12,6 +12,7 @@
(Pierrick)
- Fixed bug #50632 (filter_input() does not return default value if the
variable does not exist). (Ilia)
+- Fixed bug #48590 (SoapClient does not honor max_redirects). (Sriram)
- Fixed bug #48190 (Content-type parameter "boundary" is not case-insensitive
in HTTP uploads). (Ilia)
- Fixed bug #47409 (extract() problem with array containing word "this").
Modified: php/php-src/branches/PHP_5_3/ext/soap/php_http.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/soap/php_http.c 2010-01-05 02:55:24 UTC (rev 293130)
+++ php/php-src/branches/PHP_5_3/ext/soap/php_http.c 2010-01-05 03:07:43 UTC (rev 293131)
@@ -207,6 +207,7 @@
int http_1_1;
int http_status;
int content_type_xml = 0;
+ long redirect_max = 20;
char *content_encoding;
char *http_msg = NULL;
zend_bool old_allow_url_fopen;
@@ -283,6 +284,14 @@
context = php_stream_context_from_zval(*tmp, 0);
}
+ if (context &&
+ php_stream_context_get_option(context, "http", "max_redirects", &tmp) ==
SUCCESS) {
+ if (Z_TYPE_PP(tmp) != IS_STRING || !is_numeric_string(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp),
&redirect_max, NULL, 1)) {
+ if (Z_TYPE_PP(tmp) == IS_LONG)
+ redirect_max = Z_LVAL_PP(tmp);
+ }
+ }
+
try_again:
if (phpurl == NULL || phpurl->host == NULL) {
if (phpurl != NULL) {php_url_free(phpurl);}
@@ -1012,6 +1021,12 @@
}
phpurl = new_url;
+ if (--redirect_max < 1) {
+ smart_str_free(&soap_headers_z);
+ add_soap_fault(this_ptr, "HTTP", "Redirection limit reached, aborting",
NULL, NULL TSRMLS_CC);
+ return FALSE;
+ }
+
goto try_again;
}
}
Modified: php/php-src/trunk/ext/soap/php_http.c
===================================================================
--- php/php-src/trunk/ext/soap/php_http.c 2010-01-05 02:55:24 UTC (rev 293130)
+++ php/php-src/trunk/ext/soap/php_http.c 2010-01-05 03:07:43 UTC (rev 293131)
@@ -207,11 +207,13 @@
int http_1_1;
int http_status;
int content_type_xml = 0;
+ long redirect_max = 20;
char *content_encoding;
char *http_msg = NULL;
char *old_allow_url_fopen_list;
soap_client_object *client;
zval **tmp;
+ php_stream_context *context = NULL;
if (this_ptr == NULL || Z_TYPE_P(this_ptr) != IS_OBJECT) {
return FALSE;
@@ -278,6 +280,19 @@
phpurl = php_url_parse(location);
}
+ if (SUCCESS == zend_hash_find(Z_OBJPROP_P(this_ptr),
+ "_stream_context", sizeof("_stream_context"), (void**)&tmp)) {
+ context = php_stream_context_from_zval(*tmp, 0);
+ }
+
+ if (context &&
+ php_stream_context_get_option(context, "http", "max_redirects", &tmp) ==
SUCCESS) {
+ if (Z_TYPE_PP(tmp) != IS_STRING || !is_numeric_string(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp),
&redirect_max, NULL, 1)) {
+ if (Z_TYPE_PP(tmp) == IS_LONG)
+ redirect_max = Z_LVAL_PP(tmp);
+ }
+ }
+
try_again:
if (phpurl == NULL || phpurl->host == NULL) {
if (phpurl != NULL) {php_url_free(phpurl);}
@@ -1018,6 +1033,12 @@
}
phpurl = new_url;
+ if (--redirect_max < 1) {
+ smart_str_free(&soap_headers_z);
+ add_soap_fault(this_ptr, "HTTP", "Redirection limit reached, aborting",
NULL, NULL TSRMLS_CC);
+ return FALSE;
+ }
+
goto try_again;
}
}