From: Dmitry Stogov Date: Mon, 1 Aug 2005 11:38:02 +0000 (+0000) Subject: Allow SOAP work when allow_url_fopen is turned off. X-Git-Tag: RELEASE_2_0_0~56 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1066066436912ce5914b5f6bd22761b175637739;p=php Allow SOAP work when allow_url_fopen is turned off. --- diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c index 70c16645f6..dfbae27c1b 100644 --- a/ext/soap/php_http.c +++ b/ext/soap/php_http.c @@ -234,6 +234,7 @@ int make_http_soap_request(zval *this_ptr, int http_status; int content_type_xml = 0; char *content_encoding; + zend_bool old_allow_url_fopen; if (this_ptr == NULL || Z_TYPE_P(this_ptr) != IS_OBJECT) { return FALSE; @@ -315,10 +316,14 @@ try_again: add_soap_fault(this_ptr, "HTTP", "Unknown protocol. Only http and https are allowed.", NULL, NULL TSRMLS_CC); return FALSE; } + + old_allow_url_fopen = PG(allow_url_fopen); + PG(allow_url_fopen) = 1; if (use_ssl && php_stream_locate_url_wrapper("https://", NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) == NULL) { php_url_free(phpurl); if (request != buf) {efree(request);} - add_soap_fault(this_ptr, "HTTP", "SSL support not available in this build", NULL, NULL TSRMLS_CC); + add_soap_fault(this_ptr, "HTTP", "SSL support is not available in this build", NULL, NULL TSRMLS_CC); + PG(allow_url_fopen) = old_allow_url_fopen; return FALSE; } @@ -367,9 +372,11 @@ try_again: php_url_free(phpurl); if (request != buf) {efree(request);} add_soap_fault(this_ptr, "HTTP", "Could not connect to host", NULL, NULL TSRMLS_CC); + PG(allow_url_fopen) = old_allow_url_fopen; return FALSE; } } + PG(allow_url_fopen) = old_allow_url_fopen; if (stream) { zval **cookies, **login, **password; diff --git a/ext/soap/php_xml.c b/ext/soap/php_xml.c index 3746c805e1..73035ee56c 100644 --- a/ext/soap/php_xml.c +++ b/ext/soap/php_xml.c @@ -80,11 +80,16 @@ xmlDocPtr soap_xmlParseFile(const char *filename) { xmlParserCtxtPtr ctxt = NULL; xmlDocPtr ret; + zend_bool old_allow_url_fopen; /* xmlInitParser(); */ + + old_allow_url_fopen = PG(allow_url_fopen); + PG(allow_url_fopen) = 1; ctxt = xmlCreateFileParserCtxt(filename); + PG(allow_url_fopen) = old_allow_url_fopen; if (ctxt) { ctxt->keepBlanks = 0; ctxt->sax->ignorableWhitespace = soap_ignorableWhitespace;