johannes                                 Wed, 27 Jan 2010 17:42:17 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=294110

Log:
merge r293131 - Fixed bug #48590 (SoapClient does not honor max_redirects)
(srinatar)

Bug: http://bugs.php.net/48590 (Closed) SOAP Client (redirect loop)
      
Changed paths:
    _U  php/php-src/branches/PHP_5_3_2/
    U   php/php-src/branches/PHP_5_3_2/NEWS
    U   php/php-src/branches/PHP_5_3_2/ext/soap/php_http.c


Property changes on: php/php-src/branches/PHP_5_3_2
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/php/php-src/branches/PHP_5_3:292504,292574,292594-292595,292611,292624,292630,292632-292635,292654,292677,292682-292683,292693,292719,292762,292765,292771,292777,292823,293051,293075,293114,293126,293974
/php/php-src/trunk:284726
   + 
/php/php-src/branches/PHP_5_3:292504,292574,292594-292595,292611,292624,292630,292632-292635,292654,292677,292682-292683,292693,292719,292762,292765,292771,292777,292823,293051,293075,293114,293126,293131,293974
/php/php-src/trunk:284726

Modified: php/php-src/branches/PHP_5_3_2/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3_2/NEWS 2010-01-27 17:36:46 UTC (rev 294109)
+++ php/php-src/branches/PHP_5_3_2/NEWS 2010-01-27 17:42:17 UTC (rev 294110)
@@ -10,6 +10,7 @@

 - 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_2/ext/soap/php_http.c
===================================================================
--- php/php-src/branches/PHP_5_3_2/ext/soap/php_http.c  2010-01-27 17:36:46 UTC 
(rev 294109)
+++ php/php-src/branches/PHP_5_3_2/ext/soap/php_http.c  2010-01-27 17:42:17 UTC 
(rev 294110)
@@ -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;
                        }
                }

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to