Last modified: 2011-11-20 17:53:00 UTC
for any extension that uses Http::get a common task is setting the user-agent, which means they have to use the request object instead. Really $options should include the user-agent string
Most sensible thing may be to just accept a 'headers' key with a map of HTTP headers to set. Thus: $foo = Http::get($url, array( 'followRedirects' => false, 'postData' => array( 'foo' => 'bar', 'baz' => 'quux', ), 'headers' => array( 'User-Agent': 'my special extension', 'Accept': 'application/x-something', ) );
Doing some compat testing and I found out that this is actually lost functionality. Here's what Http::get looked like in 1.15 public static function get( $url, $timeout = 'default', $opts = array() ) { return Http::request( "GET", $url, $timeout, $opts ); public static function request( $method, $url, $timeout = 'default', $curlOptions = array() ) { and $curlOptions can accept CURLOPT_USERAGENT
...reviving that would be a bit of a hack though. CURL isn't the only thing we support.
Created attachment 9087 [details] Implement UA at Http::request() level I'm not so sure it's that hard or that hacky.
Patch applied in r103765