Index: trunk/phase3/includes/HttpFunctions.php |
— | — | @@ -1,4 +1,4 @@ |
2 | | -<?php |
| 2 | + <?php |
3 | 3 | /** |
4 | 4 | * @defgroup HTTP HTTP |
5 | 5 | */ |
— | — | @@ -729,8 +729,8 @@ |
730 | 730 | $this->curlOptions[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_0; |
731 | 731 | $this->curlOptions[CURLOPT_WRITEFUNCTION] = $this->callback; |
732 | 732 | $this->curlOptions[CURLOPT_HEADERFUNCTION] = array($this, "readHeader"); |
733 | | - $this->curlOptions[CURLOPT_FOLLOWLOCATION] = $this->followRedirects; |
734 | 733 | $this->curlOptions[CURLOPT_MAXREDIRS] = $this->maxRedirects; |
| 734 | + $this->curlOptions[CURLOPT_ENCODING] = ""; # Enable compression |
735 | 735 | |
736 | 736 | /* not sure these two are actually necessary */ |
737 | 737 | if(isset($this->reqHeaders['Referer'])) { |
— | — | @@ -767,7 +767,13 @@ |
768 | 768 | $this->curlOptions[CURLOPT_HTTPHEADER] = $this->getHeaderList(); |
769 | 769 | |
770 | 770 | $curlHandle = curl_init( $this->url ); |
771 | | - curl_setopt_array( $curlHandle, $this->curlOptions ); |
| 771 | + if ( !curl_setopt_array( $curlHandle, $this->curlOptions ) ) { |
| 772 | + throw new MWException("Error setting curl options."); |
| 773 | + } |
| 774 | + if ( ! @curl_setopt( $curlHandle, CURLOPT_FOLLOWLOCATION, $this->followRedirects ) ) { |
| 775 | + wfDebug("Couldn't set CURLOPT_FOLLOWLOCATION. Probably safe_mode or open_basedir is set."); |
| 776 | + /* Continue the processing. If it were in curl_setopt_array, processing would have halted on its entry */ |
| 777 | + } |
772 | 778 | |
773 | 779 | if ( false === curl_exec( $curlHandle ) ) { |
774 | 780 | $code = curl_error( $curlHandle ); |