]> granicus.if.org Git - php/commitdiff
MFH: merged http ignore_errors context option
authorArnaud Le Blanc <lbarnaud@php.net>
Thu, 28 May 2009 13:20:22 +0000 (13:20 +0000)
committerArnaud Le Blanc <lbarnaud@php.net>
Thu, 28 May 2009 13:20:22 +0000 (13:20 +0000)
# [DOC] "since 5.2.10". See also bug #38802.

NEWS
ext/standard/http_fopen_wrapper.c

diff --git a/NEWS b/NEWS
index 72167c6fec9c68585b87d35bfe37759caa920a90..1ab6550c603cae650735251ebc52a617c0110345 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,7 @@ PHP                                                                        NEWS
 - Added new CURL options CURLOPT_REDIR_PROTOCOLS, CURLOPT_PROTOCOLS,
   and CURLPROTO_* for redirect fixes in CURL 7.19.4. (Yoram Bar Haim, Stas)
 - Added support for Sun CC (FR #46595 and FR #46513). (David Soria Parra)
+- Added "ignore_errors" option to http fopen wrapper. (David Zulke, Sara)
 
 - Fixed memory corruptions while reading properties of zip files. (Ilia)
 - Fixed memory leak in ob_get_clean/ob_get_flush. (Christian)
index 9a9b7ae9c9462e6eaffc9c66a616fa2180ec9564..b983f146e0a44c07f4d044f6db8084b82adeeb50 100644 (file)
@@ -104,7 +104,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
        size_t chunk_size = 0, file_size = 0;
        int eol_detect = 0;
        char *transport_string, *errstr = NULL;
-       int transport_len, have_header = 0, request_fulluri = 0;
+       int transport_len, have_header = 0, request_fulluri = 0, ignore_errors = 0;
        char *protocol_version = NULL;
        int protocol_version_len = 3; /* Default: "1.0" */
        struct timeval timeout;
@@ -552,9 +552,11 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
                        } else {
                                response_code = 0;
                        }
+                       if (context && SUCCESS==php_stream_context_get_option(context, "http", "ignore_errors", &tmpzval)) {
+                               ignore_errors = zend_is_true(*tmpzval);
+                       }
                        /* when we request only the header, don't fail even on error codes */
-                       if ((options & STREAM_ONLY_GET_HEADERS) ||
-                               (context && php_stream_context_get_option(context, "http", "ignore_errors",  &tmpzval) == SUCCESS && zend_is_true(*tmpzval)) ) {
+                       if ((options & STREAM_ONLY_GET_HEADERS) || ignore_errors) {
                                reqok = 1;
                        }
                        switch(response_code) {
@@ -632,7 +634,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
        }
        
        if (!reqok || location[0] != '\0') {
-               if (options & STREAM_ONLY_GET_HEADERS && redirect_max <= 1) {
+               if (((options & STREAM_ONLY_GET_HEADERS) || ignore_errors) && redirect_max <= 1) {
                        goto out;
                }