Index: branches/REL1_16/phase3/includes/HttpFunctions.php |
— | — | @@ -714,8 +714,8 @@ |
715 | 715 | $this->curlOptions[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_0; |
716 | 716 | $this->curlOptions[CURLOPT_WRITEFUNCTION] = $this->callback; |
717 | 717 | $this->curlOptions[CURLOPT_HEADERFUNCTION] = array($this, "readHeader"); |
718 | | - $this->curlOptions[CURLOPT_FOLLOWLOCATION] = $this->followRedirects; |
719 | 718 | $this->curlOptions[CURLOPT_MAXREDIRS] = $this->maxRedirects; |
| 719 | + $this->curlOptions[CURLOPT_ENCODING] = ""; # Enable compression |
720 | 720 | |
721 | 721 | /* not sure these two are actually necessary */ |
722 | 722 | if(isset($this->reqHeaders['Referer'])) { |
— | — | @@ -748,7 +748,13 @@ |
749 | 749 | $this->curlOptions[CURLOPT_HTTPHEADER] = $this->getHeaderList(); |
750 | 750 | |
751 | 751 | $curlHandle = curl_init( $this->url ); |
752 | | - curl_setopt_array( $curlHandle, $this->curlOptions ); |
| 752 | + if ( !curl_setopt_array( $curlHandle, $this->curlOptions ) ) { |
| 753 | + throw new MWException("Error setting curl options."); |
| 754 | + } |
| 755 | + if ( ! @curl_setopt( $curlHandle, CURLOPT_FOLLOWLOCATION, $this->followRedirects ) ) { |
| 756 | + wfDebug("Couldn't set CURLOPT_FOLLOWLOCATION. Probably safe_mode or open_basedir is set."); |
| 757 | + /* Continue the processing. If it were in curl_setopt_array, processing would have halted on its entry */ |
| 758 | + } |
753 | 759 | |
754 | 760 | if ( false === curl_exec( $curlHandle ) ) { |
755 | 761 | $code = curl_error( $curlHandle ); |