Commit graph

204 commits

Author SHA1 Message Date
Alexandre Emsenhuber
3114dbea04 Replace $wgConf->localVHosts by $wgLocalVirtualHosts
The former is independent of the remaining of the SiteConfiguration
class, and as thus makes more sense to be defined as an explicit
configuration setting rather that being hidden in $wgConf.

Change-Id: I25204d37c5cfffb6953fe53e14316dc3df5b5b10
2014-10-03 03:54:44 -07:00
Kevin Israel
0d707a21ba CurlHttpRequest: Check library version, not CURLOPT_REDIR_PROTOCOLS
This works around <https://github.com/facebook/hhvm/issues/3702>.
We don't actually use the constant, so checking the library version
should suffice.

Bug: 70570
Change-Id: I732d8f7eb2908bae10100594f693cf7a63f8b5b1
2014-09-08 18:22:50 -04:00
umherirrender
1c68a1ee86 Cleanup some docs (includes/*.php)
- Swap "$variable type" to "type $variable"
- Added missing types
- Fixed spacing inside docs
- Makes beginning of @param/@return/@var/@throws in capital
- Changed some types to match the more common spelling

Change-Id: I783e4dbfe5f6f98b32b9a03ccf6439e13e132bcc
2014-07-24 19:42:24 +02:00
umherirrender
4ee680a8b3 Fixed spacing
- Removed spaces after not operator (!)
- Removed spaces inside array index
- use tab as indent instead of spaces
- Add newline at end of file
- Removed spaces after casts

Change-Id: I9ba17c4385fcb43d38998d45f89cf42952bc791b
2014-07-24 11:53:04 +02:00
umherirrender
a3983418d5 Fixed some @params documentation (includes/*)
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.

Change-Id: I0056b4a8df243cfc0c5f25378de48f7a35170aca
2014-04-22 13:07:02 +02:00
umherirrender
23fab68274 Fix spacing after @param and friends in comments
Searched for:
\@(param|return|throws|since|deprecated|access|todo|var)[ \t]{2,}

Change-Id: Icce22ba9fe0635455691ca58d9872d618151f346
2014-04-05 20:02:29 +00:00
jenkins-bot
55605dfbee Merge "Fixed stream wrapper in PhpHttpRequest" 2014-01-30 23:12:44 +00:00
Chad Horohoe
609a76b147 Remove setting referrer from HttpFunctions
It was introduced in 5d210b50 but no callers have ever been updated
so this always falls back on $wgTitle (which is usually wrong). It
only works on cURL, and is marginally useful at best.

Change-Id: Ic498108af9f466cefbd0072f94f0efa4055cd169
2014-01-27 16:39:20 -08:00
Tyler Anthony Romeo
499e5fd487 Fixed stream wrapper in PhpHttpRequest
Issue introduced when SSL verification was added to PHPHttpRequest.
For HTTP and HTTPS stream, PHP expects "http" as the steam context
name, regardless of SSL.

Change-Id: I12c5d3d9aded6e704ebabe85b86e556fd0e99479
Follows-Up: 1c927b1df2 (Iab2bda1ebc)
Bug: 56047
2014-01-03 09:01:42 +00:00
umherirrender
2e871f7087 Fixed spacing
- Removed double spaces in arrays
- Added space after for
- Added spaces around string concat

Change-Id: Ifbcaf35f9bfef1f97226a38b5bd74c237f61c99e
2013-12-15 20:56:09 +01:00
Mark A. Hershberger
eba84959ef Attempt to fix problems noted in phpcs.
Seen at
https://integration.wikimedia.org/ci/job/mediawiki-core-regression-phpcs-HEAD/3256/console

Change-Id: If1272366fa242ccdf1191ba1686f2d1cdf046872
2013-12-15 19:16:16 +00:00
Kevin Israel
33bc02fad1 Restore compatibility with curl < 7.16.2
Follows-up 58f71c7e9e, which assumed that the CURLOPT_CONNECTTIMEOUT_MS
constant was defined.

Bug: 58178
Change-Id: Id31a3ec56e4c7cac7d3edb2653c87be467d1a471
2013-12-09 11:34:22 -05:00
umherirrender
5ca5672aac Fixed spacing
- Place commas correct
- Moved comments
- Add space after if/foreach/catch
- Reformat some conditions
- Removed trailing spaces/tabs

Change-Id: I40ccda72c418c4a33fcd675773cb08d971510cdb
2013-12-01 20:58:51 +01:00
umherirrender
24bfde2710 Fix spacing and break some lines
Change-Id: Ia57685d8858e02e399ad5c75ce64d12609d340ac
2013-08-24 17:06:25 +02:00
jenkins-bot
94f26422ef Merge "Added SSL verification to PHPHttpRequest." 2013-06-26 21:56:40 +00:00
Brian Wolff
c1d900337c Follow up I6e64a missing global deceleration for $wgHTTPConnectTimeout
Bug: 47027
Change-Id: I3e2a84ee8a759dd2bdb2fd0837e0cd5605541816
2013-06-05 17:00:42 +00:00
Tyler Anthony Romeo
1c927b1df2 Added SSL verification to PHPHttpRequest.
PHP's stream context options support SSL server verification as well a CN matching and provision of
CA info.
Added options to the stream context so that the $sslVerifyHost, $sslVerifyCert, and $caInfo
parameters now work in non-CURL environments.

Change-Id: Iab2bda1ebcf20b625b019c91ae6352b5405dcc01
2013-06-04 22:27:46 +00:00
Chad Horohoe
58f71c7e9e Allow setting of connection timeouts for HTTP requests using cURL
Bug: 47027
Change-Id: I6e64a8bfc58e899149463d305eac672c1e8ad2ba
2013-06-04 22:08:09 +00:00
umherirrender
9f14ecf829 Added space after switch/Removed spaces after unset
While at it, added/removed some other spaces in the same files

Change-Id: I84d8001aa123a008807ad5eb76f396aed7c899a4
2013-04-26 16:42:31 +02:00
umherirrender
ef2f507d23 Fixed spacing in files direct in includes folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: Ibb8dd102db045522d12ff939075ba7420d95ab6b
2013-04-21 06:38:49 +00:00
Chad Horohoe
479363ce92 Support HTTP timeout detection in curl backend
We already do this for the pure-PHP backend, and it's easy to
catch this single error and pass a more specific message

Change-Id: I8a81dd90b691c35c51a19f8790f06578dd067613
2013-04-16 23:11:54 +00:00
Chad Horohoe
9fb1cf3e50 Most important documentation fix
Change-Id: I0482144112345ca76ed3d95e3ad3b846cce4d87b
2013-04-04 05:38:33 +00:00
Chad Horohoe
f6ecc03881 Remove non-functional handling of curl_error()
Per the docs, curl_error() returns a full error string, not an int
or string of an int. Just remove that and pass the error back up.

Change-Id: I7434bb2abda056fdee4d670c192b304c0cdf24f7
2013-04-02 14:18:43 -04:00
umherirrender
6c278b6d7e fix some spacing
* Removed spaces around array index
* Removed double spaces or added spaces to begin or end of function
  calls, method signature, conditions or foreachs
* Added braces to one-line ifs
* Changed multi line conditions to one line conditions
* Realigned some arrays

Change-Id: Ia04d2a99d663b07101013c2d53b3b2e872fd9cc3
2013-03-25 22:22:46 +00:00
Platonides
cebf04f334 wfProfile fixes:
0543c7b0 added a wfProfileIn() that should have been wfProfileOut()
 Reorder Http::request() so that wfProfileOut() is at the same
level as the above wfProfileIn() [checked by check-vars]

Change-Id: Ia91445d792e524b9c570890397f1513af0d8cd73
2013-03-19 16:17:19 +01:00
Tyler Anthony Romeo
0543c7b039 Added profiling to MWHttpRequest and Http.
Added profile calls to various functions in
MWHttpRequest as well as to the wrapper
function Http::request.

Change-Id: I7f2819a075891dbc565a7524d56e7bf077ab089a
2013-03-18 17:50:33 -04:00
Yuri Astrakhan
9506e3d812 Spellchecked /includes directory
* Ran spell-checker over code comments in /includes/
* A few spellchecking fixes for wfDebug() calls

Found one very strange (NOOP?) line in Linker.php - see "TODO: BUG?"

Change-Id: Ibb86b51073b980eda9ecce2cf0b8dd33f058adbf
2013-03-13 03:42:41 -04:00
Tyler Anthony Romeo
4dcc7961df Fixed @param tags to conform with Doxygen format.
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.

Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
2013-03-11 13:15:01 -04:00
umherirrender
d63121016d fix some spacing
Added/removed spaces around logical/arithmetic operator
Reduced multiple empty lines to one empty line
Removed wrong tabs before comments at end of line
Removed too many spaces in assigments

Change-Id: I2bba4e72f9b5f88c53324d7b70e6042f1aad8f6b
2013-03-07 17:53:21 +01:00
Tim Starling
3d55a64b83 Preserve caller expectations for behaviour of sslVerifyHost
(bug 42441) The previous patch unnecessarily broke backwards
compatibility in the Http::request() API, following cURL's broken
conventions for sslVerifyHost instead of the boolean interpretation
expected by all existing callers. This change reverts that one, and
fixes the bug in another way. See Ia6535f10.

Also don't bother wrapping the $this->sslVerifyHost access with isset()
since it's always set.

Change-Id: Ia4e1689249b6ac515b859ea2eca1dcff3e63098c
2013-02-27 18:03:44 -08:00
umherirrender
f3cf109e62 remove space before semicolon
Change-Id: Ic0d890f5e27cec017c7f7910a67d53b2edf82079
2013-02-09 22:44:24 +01:00
umherirrender
1044b0b8df fix some spacing
Change-Id: I8f976013f33c5818e4402604fe8610aa3f43b0c6
2013-02-04 20:18:33 +00:00
Alex Monk
c2c982c4e8 (bug 36537) Rename calls to wfArrayToCGI to wfArrayToCgi
Done with this command:
grep wfArrayToCGI * -R -l -Z | xargs -0 -l sed -i -e 's/wfArrayToCGI/wfArrayToCgi/g' && git checkout -- HISTORY

Change-Id: If7f4d4bfc199289c11c43cf519c2415a1aad1c51
2013-01-28 18:04:20 +00:00
Aaron Schulz
5c8245acdf Http function logic cleanups and comments.
Change-Id: Ibe309246960491958870610f69c253bf3ccc1637
2013-01-18 10:55:11 -08:00
IAlex
bce969ea18 Merge "Made SSL validation in Curl HTTP requests the default." 2012-11-15 10:24:11 +00:00
umherirrender
82375631c2 Fix tabs inside/between statements/text
This tabs are strange and a space there is better

Change-Id: I0885dff575ee2fcd0668d08fef3226e132c5b319
2012-10-26 18:18:59 +02:00
Tyler Anthony Romeo
5c8d6fa60f Made SSL validation in Curl HTTP requests the default.
Changed the default value for CURLOPT_SSL_VERIFYHOST
to 2 rather than true. This makes sure that hostname
validation occurs.

Change-Id: Ia6535f1090627ef2def360bda37c22bff10c7f31
2012-10-25 15:27:47 -04:00
Siebrand Mazeland
d4b046a893 Update docs for return and exception info
* Removed some inline tabs in the process.
* IDE fixed some incorrect leading spaces, too.

Change-Id: Ic9303eff6db4424ac3f1fa2816839692b43e6190
2012-10-09 09:41:58 +00:00
Liangent
10ec7a1990 Make MWHttpRequest::__construct() protected.
This class is not for direct initialization, and
new MWHttpRequest(...)->execute() doesn't work at all.

Change-Id: I557723c218cd8e8f27283d01141c890263da095d
2012-07-30 23:18:44 +08:00
Antoine Musso
12e608e3d5 converts '@fixme' to '@todo FIXME'
@fixme is simply not recognized by doxygen whereas @todo is used to
generate a nice ... todo list!!

Change-Id: If956c0a164373126ce48b791d45c56962034eecd
2012-07-10 17:16:46 +02:00
Reedy
698b51118b Revert "Treat truncated HTTP requests as errors."
Caused bug 36950 among other issues

This reverts commit ded6170bd2

Change-Id: I26500896a09a9fe720dc31b3d48cdbb3cd6c8677
2012-05-21 23:10:51 +01:00
Alexandre Emsenhuber
15e9fcca01 Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: Iaebd4e253ff3b35b568e9b394231a5691445ac95
2012-05-14 19:59:58 +02:00
Krinkle
0c9a4522cc Merge "HTTP: Fix ded6170bd2, which broke all HTTP calls." 2012-05-09 06:39:09 +00:00
Aaron
e4f0c1f57b HTTP: Fix ded6170bd2, which broke all HTTP calls.
* respHeaders contains arrays for each header (should've been
  respHeaders['content-length'][0] instead of respHeaders['content-length'])
  using getResponseHeader() instead.
* This also fixes InstantCommons, which was broken by this (bug 36653).
* Also cleaned up a bit of w/s in foreign repo code while in the area.

Change-Id: I429b0a36618cc2b873077516e9c1023dc5b7d693
2012-05-09 08:35:14 +02:00
Platonides
2af392378d Typo in comment
Change-Id: Ic5e1451f86d7bcda374fd12b5a9b85fe199a7c1a
2012-05-08 23:27:21 +02:00
Platonides
ded6170bd2 Treat truncated HTTP requests as errors.
We detect such prematurely ended request when there's a Content-Length
greater than the body we got. A strict comparison would easily fail
when there was a content encoding layer, but hopefully we won't hit
a compressed request _larger_ than the original content.

See http://thread.gmane.org/gmane.org.wikimedia.mediawiki/39622
for breakage caused by truncated HTTP replies.

Change-Id: I71418424730d46a781bde5cbfda8038457ec79c5
2012-05-07 14:46:54 -07:00
awjrichards
1122ca5f87 Ensure MWHttpRequest::method gets set with strtoupper() since code
examining MWHttpRequest::method always expects its value to be
fully uppercased.

Yes, this should not be a problem if MWHttpRequest is accessed
via HTTP class, but that will not always be guaranteed.

Resolves bug 36137.

Change-Id: Ic20e1b99dcb56b8a11cea50293ba44022e564de9
2012-04-20 15:18:06 -07:00
Mark A. Hershberger
7569a6600e Avoid setting multiple Content-Type headers.
Necessary for JSON-RPC where Content-Type has to be set to
application/json on POST.

Change-Id: I0d974c98d914a22d0150a198a9f630206bb01d64
2012-03-28 14:58:44 -04:00
Aaron Schulz
1d065d50f6 r111588: refactored proxy/noProxy code slightly for simplicity 2012-02-29 00:36:40 +00:00
Tim Starling
7c44943ee4 Make userAgent also work as an option to MWHttpRequest::factory() and MWHttpRequest::__construct(), not just Http::request(). 2012-02-27 01:37:06 +00:00