* to avoid attacks on intranet services accessible by HTTP.
* - userAgent A user agent, if you want to override the default
* MediaWiki/$wgVersion
- * @return Mixed: (bool)false on failure or a string on success
+ * @return string|bool (bool)false on failure or a string on success
*/
public static function request( $method, $url, $options = array() ) {
wfDebug( "HTTP: $method: $url\n" );
* Simple wrapper for Http::request( 'GET' )
* @see Http::request()
*
- * @param $url
- * @param $timeout string
- * @param $options array
+ * @param string $url
+ * @param string $timeout
+ * @param array $options
* @return string
*/
public static function get( $url, $timeout = 'default', $options = array() ) {
* Simple wrapper for Http::request( 'POST' )
* @see Http::request()
*
- * @param $url
- * @param $options array
+ * @param string $url
+ * @param array $options
* @return string
*/
public static function post( $url, $options = array() ) {
/**
* Check if the URL can be served by localhost
*
- * @param string $url full url to check
- * @return Boolean
+ * @param string $url Full url to check
+ * @return bool
*/
public static function isLocalURL( $url ) {
global $wgCommandLineMode, $wgConf;
/**
* A standard user-agent we can use for external requests.
- * @return String
+ * @return string
*/
public static function userAgent() {
global $wgVersion;
*
* @todo FIXME this is wildly inaccurate and fails to actually check most stuff
*
- * @param $uri Mixed: URI to check for validity
- * @return Boolean
+ * @param string $uri URI to check for validity
+ * @return bool
*/
public static function isValidURI( $uri ) {
return preg_match(
protected $followRedirects = false;
/**
- * @var CookieJar
+ * @var CookieJar
*/
protected $cookieJar;
public $status;
/**
- * @param string $url url to use. If protocol-relative, will be expanded to an http:// URL
+ * @param string $url Url to use. If protocol-relative, will be expanded to an http:// URL
* @param array $options (optional) extra params to pass (see Http::request())
*/
protected function __construct( $url, $options = array() ) {
/**
* Generate a new request object
- * @param string $url url to use
+ * @param string $url Url to use
* @param array $options (optional) extra params to pass (see Http::request())
* @throws MWException
* @return CurlHttpRequest|PhpHttpRequest
/**
* Get the body, or content, of the response to the request
*
- * @return String
+ * @return string
*/
public function getContent() {
return $this->content;
/**
* Set the parameters of the request
*
- * @param $args Array
+ * @param array $args
* @todo overload the args param
*/
public function setData( $args ) {
/**
* Set the user agent
- * @param $UA string
+ * @param string $UA
*/
public function setUserAgent( $UA ) {
$this->setHeader( 'User-Agent', $UA );
/**
* Set an arbitrary header
- * @param $name
- * @param $value
+ * @param string $name
+ * @param string $value
*/
public function setHeader( $name, $value ) {
// I feel like I should normalize the case here...
* bytes are reported handled than were passed to you, the HTTP fetch
* will be aborted.
*
- * @param $callback Callback
+ * @param callable $callback
* @throws MWException
*/
public function setCallback( $callback ) {
* A generic callback to read the body of the response from a remote
* server.
*
- * @param $fh handle
- * @param $content String
+ * @param resource $fh
+ * @param string $content
* @return int
*/
public function read( $fh, $content ) {
* (see RFC2616, section 10, http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
* for a list of status codes.)
*
- * @return Integer
+ * @return int
*/
public function getStatus() {
if ( !$this->respHeaders ) {
/**
* Returns true if the last status code was a redirect.
*
- * @return Boolean
+ * @return bool
*/
public function isRedirect() {
if ( !$this->respHeaders ) {
* (e.g. Set-Cookie) can appear more than once the, each value of
* the associative array is an array of the values given.
*
- * @return Array
+ * @return array
*/
public function getResponseHeaders() {
if ( !$this->respHeaders ) {
/**
* Returns the value of the given response header.
*
- * @param $header String
- * @return String
+ * @param string $header
+ * @return string
*/
public function getResponseHeader( $header ) {
if ( !$this->respHeaders ) {
/**
* Tells the MWHttpRequest object to use this pre-loaded CookieJar.
*
- * @param $jar CookieJar
+ * @param CookieJar $jar
*/
public function setCookieJar( $jar ) {
$this->cookieJar = $jar;
* cookies. Used internally after a request to parse the
* Set-Cookie headers.
* @see Cookie::set
- * @param $name
- * @param $value null
- * @param $attr null
+ * @param string $name
+ * @param mixed $value
+ * @param array $attr
*/
public function setCookie( $name, $value = null, $attr = null ) {
if ( !$this->cookieJar ) {
protected $headerText = "";
/**
- * @param $fh
- * @param $content
+ * @param resource $fh
+ * @param string $content
* @return int
*/
protected function readHeader( $fh, $content ) {
class PhpHttpRequest extends MWHttpRequest {
/**
- * @param $url string
+ * @param string $url
* @return string
*/
protected function urlToTcp( $url ) {