diff options
author | Umherirrender <umherirrender_de.wp@web.de> | 2023-04-24 21:49:42 +0200 |
---|---|---|
committer | Umherirrender <umherirrender_de.wp@web.de> | 2023-04-24 21:52:32 +0200 |
commit | 4a1479c9cc78f5f8acbb8991ad2af29a0ba302a3 (patch) | |
tree | 789cd2947d44bd20734ab3fe4cc17099e26b4df9 /includes/http | |
parent | 4bd94b22e3ca4bdb9dc94a30db5ae12194f70d56 (diff) | |
download | mediawikicore-4a1479c9cc78f5f8acbb8991ad2af29a0ba302a3.tar.gz mediawikicore-4a1479c9cc78f5f8acbb8991ad2af29a0ba302a3.zip |
Remove deprecated class Http
The class and all functions are deprecated:
- Http::request()
- Http::get()
- Http::post()
- Http::userAgent()
- Http::isValidURI()
- Http::getProxy()
- Http::createMultiClient()
Bug: T305813
Change-Id: Icd8af4822b16b4bf4558b756e20171c3ae9a9fa1
Diffstat (limited to 'includes/http')
-rw-r--r-- | includes/http/Http.php | 152 |
1 files changed, 0 insertions, 152 deletions
diff --git a/includes/http/Http.php b/includes/http/Http.php deleted file mode 100644 index 9f03e1a901ef..000000000000 --- a/includes/http/Http.php +++ /dev/null @@ -1,152 +0,0 @@ -<?php -/** - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @file - */ - -use MediaWiki\MainConfigNames; -use MediaWiki\MediaWikiServices; - -/** - * Various HTTP related functions - * @deprecated since 1.34 - * @ingroup HTTP - */ -class Http { - /** - * Perform an HTTP request - * - * @deprecated since 1.34, use HttpRequestFactory::request(). Hard-deprecated since 1.40. - * - * @param string $method HTTP method. Usually GET/POST - * @param string $url Full URL to act on. If protocol-relative, will be expanded to an http:// URL - * @param array $options Options to pass to MWHttpRequest object. See HttpRequestFactory::create - * docs - * @param string $caller The method making this request, for profiling - * @return string|false - */ - public static function request( $method, $url, array $options = [], $caller = __METHOD__ ) { - wfDeprecated( __METHOD__, '1.34' ); - $ret = MediaWikiServices::getInstance()->getHttpRequestFactory()->request( - $method, $url, $options, $caller ); - return is_string( $ret ) ? $ret : false; - } - - /** - * Simple wrapper for Http::request( 'GET' ) - * - * @deprecated since 1.34, use HttpRequestFactory::get(). Hard-deprecated since 1.40. - * - * @since 1.25 Second parameter $timeout removed. Second parameter - * is now $options which can be given a 'timeout' - * - * @param string $url - * @param array $options - * @param string $caller The method making this request, for profiling - * @return string|false false on error - */ - public static function get( $url, array $options = [], $caller = __METHOD__ ) { - wfDeprecated( __METHOD__, '1.34' ); - $args = func_get_args(); - if ( isset( $args[1] ) && ( is_string( $args[1] ) || is_numeric( $args[1] ) ) ) { - // Second was used to be the timeout - // And third parameter used to be $options - wfWarn( "Second parameter should not be a timeout.", 2 ); - $options = isset( $args[2] ) && is_array( $args[2] ) ? - $args[2] : []; - $options['timeout'] = $args[1]; - $caller = __METHOD__; - } - return self::request( 'GET', $url, $options, $caller ); - } - - /** - * Simple wrapper for Http::request( 'POST' ) - * - * @deprecated since 1.34, use HttpRequestFactory::post(). Hard-deprecated since 1.40. - * - * @param string $url - * @param array $options - * @param string $caller The method making this request, for profiling - * @return string|false false on error - */ - public static function post( $url, array $options = [], $caller = __METHOD__ ) { - wfDeprecated( __METHOD__, '1.34' ); - return self::request( 'POST', $url, $options, $caller ); - } - - /** - * A standard user-agent we can use for external requests. - * - * @deprecated since 1.34, use HttpRequestFactory::getUserAgent(). Hard-deprecated since 1.40. - * @return string - */ - public static function userAgent() { - wfDeprecated( __METHOD__, '1.34' ); - return MediaWikiServices::getInstance()->getHttpRequestFactory()->getUserAgent(); - } - - /** - * Check that the given URI is a valid one. - * - * This hardcodes a small set of protocols only, because we want to - * deterministically reject protocols not supported by all HTTP-transport - * methods. - * - * "file://" specifically must not be allowed, for security purpose - * (see <https://www.mediawiki.org/wiki/Special:Code/MediaWiki/r67684>). - * - * @todo FIXME this is wildly inaccurate and fails to actually check most stuff - * - * @deprecated since 1.34, use MWHttpRequest::isValidURI. Hard-deprecated since 1.40. - * @param string $uri URI to check for validity - * @return bool - */ - public static function isValidURI( $uri ) { - wfDeprecated( __METHOD__, '1.34' ); - return MWHttpRequest::isValidURI( $uri ); - } - - /** - * Gets the relevant proxy from $wgHTTPProxy - * - * @deprecated since 1.34, use $wgHTTPProxy directly - * @return string The proxy address or an empty string if not set. - */ - public static function getProxy() { - wfDeprecated( __METHOD__, '1.34' ); - - $httpProxy = MediaWikiServices::getInstance()->getMainConfig()->get( - MainConfigNames::HTTPProxy ); - return (string)$httpProxy; - } - - /** - * Get a configured MultiHttpClient - * - * @deprecated since 1.34, use MediaWikiServices::getHttpRequestFactory()->createMultiClient() - * @param array $options - * @return MultiHttpClient - */ - public static function createMultiClient( array $options = [] ) { - wfDeprecated( __METHOD__, '1.34' ); - $httpProxy = MediaWikiServices::getInstance()->getMainConfig()->get( - MainConfigNames::HTTPProxy ); - return MediaWikiServices::getInstance()->getHttpRequestFactory() - ->createMultiClient( $options + [ 'proxy' => $httpProxy ] ); - } -} |