dépôts
/
lhc
/
web
/
wiklou.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fab746c
)
Add $options param to Http::get() and friends. Now things don't need to use curl...
author
Chad Horohoe
<demon@users.mediawiki.org>
Thu, 11 Sep 2008 00:29:51 +0000
(
00:29
+0000)
committer
Chad Horohoe
<demon@users.mediawiki.org>
Thu, 11 Sep 2008 00:29:51 +0000
(
00:29
+0000)
includes/HttpFunctions.php
patch
|
blob
|
history
diff --git
a/includes/HttpFunctions.php
b/includes/HttpFunctions.php
index
8ae4d2d
..
c055d2e
100644
(file)
--- a/
includes/HttpFunctions.php
+++ b/
includes/HttpFunctions.php
@@
-5,12
+5,12
@@
* @ingroup HTTP
*/
class Http {
* @ingroup HTTP
*/
class Http {
- static function get( $url, $timeout = 'default' ) {
- return Http::request( "GET", $url, $timeout );
+ static function get( $url, $timeout = 'default'
, $opts = array()
) {
+ return Http::request( "GET", $url, $timeout
, $opts
);
}
}
- static function post( $url, $timeout = 'default' ) {
- return Http::request( "POST", $url, $timeout );
+ static function post( $url, $timeout = 'default'
, $opts = array()
) {
+ return Http::request( "POST", $url, $timeout
, $opts
);
}
/**
}
/**
@@
-18,7
+18,7
@@
class Http {
*
* if $timeout is 'default', $wgHTTPTimeout is used
*/
*
* if $timeout is 'default', $wgHTTPTimeout is used
*/
- static function request( $method, $url, $timeout = 'default' ) {
+ static function request( $method, $url, $timeout = 'default'
, $curlOptions = array()
) {
global $wgHTTPTimeout, $wgHTTPProxy, $wgVersion, $wgTitle;
wfDebug( __METHOD__ . ": $method $url\n" );
global $wgHTTPTimeout, $wgHTTPProxy, $wgVersion, $wgTitle;
wfDebug( __METHOD__ . ": $method $url\n" );
@@
-49,6
+49,12
@@
class Http {
if ( is_object( $wgTitle ) ) {
curl_setopt( $c, CURLOPT_REFERER, $wgTitle->getFullURL() );
}
if ( is_object( $wgTitle ) ) {
curl_setopt( $c, CURLOPT_REFERER, $wgTitle->getFullURL() );
}
+
+ if ( is_array( $curlOptions ) ) {
+ foreach( $curlOptions as $option => $value ) {
+ curl_setopt( $c, $option, $value );
+ }
+ }
ob_start();
curl_exec( $c );
ob_start();
curl_exec( $c );