mike            Fri Jul 25 08:27:10 2008 UTC

  Modified files:              
    /php-src/ext/standard       http_fopen_wrapper.c 
  Log:
  - Changed HTTP stream wrapper to accept any code between and including
    200 to 399 as successful. (patch by Noah Fontes)
  
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/http_fopen_wrapper.c?r1=1.134&r2=1.135&diff_format=u
Index: php-src/ext/standard/http_fopen_wrapper.c
diff -u php-src/ext/standard/http_fopen_wrapper.c:1.134 
php-src/ext/standard/http_fopen_wrapper.c:1.135
--- php-src/ext/standard/http_fopen_wrapper.c:1.134     Fri Jul 11 10:24:29 2008
+++ php-src/ext/standard/http_fopen_wrapper.c   Fri Jul 25 08:27:10 2008
@@ -19,7 +19,7 @@
    |          Sara Golemon <[EMAIL PROTECTED]>                              |
    +----------------------------------------------------------------------+
  */
-/* $Id: http_fopen_wrapper.c,v 1.134 2008/07/11 10:24:29 tony2001 Exp $ */ 
+/* $Id: http_fopen_wrapper.c,v 1.135 2008/07/25 08:27:10 mike Exp $ */ 
 
 #include "php.h"
 #include "php_globals.h"
@@ -572,25 +572,25 @@
                                (context && 
php_stream_context_get_option(context, "http", "ignore_errors",  &tmpzval) == 
SUCCESS && zend_is_true(*tmpzval)) ) {
                                reqok = 1;
                        }
-                       switch(response_code) {
-                               case 200:
-                               case 206: /* partial content */
-                               case 302:
-                               case 303:
-                               case 301:
-                                       reqok = 1;
-                                       break;
-                               case 403:
-                                       php_stream_notify_error(context, 
PHP_STREAM_NOTIFY_AUTH_RESULT,
-                                                       tmp_line, 
response_code);
-                                       break;
-                               default:
-                                       /* safety net in the event tmp_line == 
NULL */
-                                       if (!tmp_line_len) {
-                                               tmp_line[0] = '\0';
-                                       }
-                                       php_stream_notify_error(context, 
PHP_STREAM_NOTIFY_FAILURE,
-                                                       tmp_line, 
response_code);
+                       /* all status codes in the 2xx range are defined by the 
specification as successful;
+                        * all status codes in the 3xx range are for 
redirection, and so also should never
+                        * fail */
+                       if (response_code >= 200 && response_code < 400) {
+                               reqok = 1;
+                       } else {
+                               switch(response_code) {
+                                       case 403:
+                                               
php_stream_notify_error(context, PHP_STREAM_NOTIFY_AUTH_RESULT,
+                                                               tmp_line, 
response_code);
+                                               break;
+                                       default:
+                                               /* safety net in the event 
tmp_line == NULL */
+                                               if (!tmp_line_len) {
+                                                       tmp_line[0] = '\0';
+                                               }
+                                               
php_stream_notify_error(context, PHP_STREAM_NOTIFY_FAILURE,
+                                                               tmp_line, 
response_code);
+                               }
                        }
                        if (tmp_line[tmp_line_len - 1] == '\n') {
                                --tmp_line_len;



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

Reply via email to