Index: trunk/phase3/includes/HttpFunctions.php |
— | — | @@ -27,6 +27,11 @@ |
28 | 28 | static function request( $method, $url, $timeout = 'default', $curlOptions = array() ) { |
29 | 29 | global $wgHTTPTimeout, $wgHTTPProxy, $wgVersion, $wgTitle; |
30 | 30 | |
| 31 | + // Go ahead and set the timeout if not otherwise specified |
| 32 | + if ( $timeout == 'default' ) { |
| 33 | + $timeout = $wgHTTPTimeout; |
| 34 | + } |
| 35 | + |
31 | 36 | wfDebug( __METHOD__ . ": $method $url\n" ); |
32 | 37 | # Use curl if available |
33 | 38 | if ( function_exists( 'curl_init' ) ) { |
— | — | @@ -37,9 +42,6 @@ |
38 | 43 | curl_setopt($c, CURLOPT_PROXY, $wgHTTPProxy); |
39 | 44 | } |
40 | 45 | |
41 | | - if ( $timeout == 'default' ) { |
42 | | - $timeout = $wgHTTPTimeout; |
43 | | - } |
44 | 46 | curl_setopt( $c, CURLOPT_TIMEOUT, $timeout ); |
45 | 47 | curl_setopt( $c, CURLOPT_USERAGENT, "MediaWiki/$wgVersion" ); |
46 | 48 | if ( $method == 'POST' ) |
— | — | @@ -78,7 +80,7 @@ |
79 | 81 | curl_close( $c ); |
80 | 82 | } else { |
81 | 83 | # Otherwise use file_get_contents... |
82 | | - # This may take 3 minutes to time out, and doesn't have local fetch capabilities |
| 84 | + # This doesn't have local fetch capabilities... |
83 | 85 | |
84 | 86 | global $wgVersion; |
85 | 87 | $headers = array( "User-Agent: MediaWiki/$wgVersion" ); |
— | — | @@ -89,7 +91,8 @@ |
90 | 92 | $opts = array( |
91 | 93 | 'http' => array( |
92 | 94 | 'method' => $method, |
93 | | - 'header' => implode( "\r\n", $headers ) ) ); |
| 95 | + 'header' => implode( "\r\n", $headers ), |
| 96 | + 'timeout' => $timeout ) ); |
94 | 97 | $ctx = stream_context_create($opts); |
95 | 98 | |
96 | 99 | $url_fopen = ini_set( 'allow_url_fopen', 1 ); |