Commit graph

188 commits

Author SHA1 Message Date
Brian Wolff
c1d900337c Follow up I6e64a missing global deceleration for $wgHTTPConnectTimeout
Bug: 47027
Change-Id: I3e2a84ee8a759dd2bdb2fd0837e0cd5605541816
2013-06-05 17:00:42 +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
Thomas Gries
adc105dac4 important fix inside HttpFunctions.php. I noticed that when you call HttpRequest::factory with noProxy=true for example inside an intranet, this is ignored in (Curl)HttpRequest because the proxy url is not cleared. This commit makes sure at lowest level - namel in the public function proxySetup() - that a optional(true) value of noProxy is observed and that it (now) also clears the proxy url. (I have been told that I am allowed to commit this patch. Please carefully review, as usual). 2012-02-15 22:40:38 +00:00
Sam Reed
76246b9bf5 More return documentation 2012-02-09 21:33:27 +00:00
Sam Reed
85bbb0b080 Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar
Other documentation improvements
2012-02-09 18:01:10 +00:00
Sam Reed
f619564720 * (bug 32341) Add upload by URL domain limitation. 2012-01-19 19:16:06 +00:00
Brion Vibber
2fc16ba670 Add comments explaining that the funky multiple Location headers stuff is a CURL artifact, and that the code will need updating if bug 29232 is done (high-level handling of http redirects)
Followup r94881, r106948.
2011-12-22 23:12:44 +00:00
Roan Kattouw
c5a18b323a (bug 310720) Make Http::request() (and, by extension, get() and post() as well) accept a 'userAgent' option. Patch by Chad Horohoe 2011-11-20 17:45:18 +00:00
Platonides
2af42298c1 Follow-up r101808. Use canonical class name. 2011-11-03 22:58:16 +00:00
Mark A. Hershberger
c69ddf40aa typo 2011-11-03 15:14:02 +00:00
Antoine Musso
57faa0c794 comment that isValidURI must reject file:// URI 2011-11-03 15:06:52 +00:00
Mark A. Hershberger
d379979d1a use isValidURI for redirect check 2011-11-03 14:04:01 +00:00
Sam Reed
52cd34acf5 More documentation 2011-10-29 01:53:28 +00:00
Tobias
596a9e77e8 Disable proxy for local URLs instead of using a local proxy (which might not always exist). In r61357 a comment "Not sure this makes any sense." was removed. Indeed, that comment seems to have been right :) 2011-10-28 23:02:30 +00:00
Sam Reed
abe7663d8c Documentation
Swap a lot of "@returns" to "@return"
2011-10-13 18:44:26 +00:00
Roan Kattouw
fe82ae0e27 Use wfParseUrl() instead of parse_url() in MWHttpRequest::__construct(), and check the return value for false 2011-09-08 13:53:18 +00:00
Roan Kattouw
37e3f5dff5 Move URL expansion from Http::request() (where it was put in r93820) to MWHttpRequest::__construct(). That should fix bug 30797 (UploadStash barfs on protocol-relative URLs) 2011-09-08 13:48:11 +00:00
Roan Kattouw
75681bc57a Expand some more URLs: for feeds, referers and the proxy script 2011-08-19 17:31:40 +00:00