Commit graph

139 commits

Author SHA1 Message Date
Roan Kattouw
75681bc57a Expand some more URLs: for feeds, referers and the proxy script 2011-08-19 17:31:40 +00:00
Marooned
0102df8489 Relative values of the "Location" header are incorrect as stated in RFC, however they do happen and modern browsers support them.
This function loops backwards through all locations in order to build the proper absolute URI - Marooned at wikia-inc.com
2011-08-18 10:33:39 +00:00
Roan Kattouw
ae7d7676fb Fix r93820: PROT_ -> PROTO_ 2011-08-03 13:11:42 +00:00
Roan Kattouw
6adb2e86a5 Some random URL protocol forcing for protocol-relative URLs 2011-08-03 12:58:21 +00:00
Chad Horohoe
4f21bb309e (bug 29959) Installer fatal when cURL and allow_url_fopen is disabled and user tries to subsribe to mediawiki-announce
Really, I'm not sure about the usefulness of exploding with a MWException anytime we can't do an external request, but at least we can stop the installer from exploding :)
2011-07-18 21:56:10 +00:00
Krinkle
0e22bbc883 Reverting r91642 per CR and pending review need-patch/patch in bug 29755 2011-07-08 17:45:26 +00:00
Mark A. Hershberger
1c712a6cc6 Bug #29755: Apply patch from Vitaliy Filippov so that MW's HTTP client
respects no_proxy env setting
2011-07-07 14:56:18 +00:00
Mark A. Hershberger
20d5ed9326 follow up r89278 — remove FTP support. 2011-06-04 02:59:10 +00:00
Brion Vibber
29aedac7db Add some doc comments on Cookie::validateCookieDomain() and Http::isValidUri(), which both have some failing test cases and are incomplete 2011-06-01 22:35:03 +00:00
Mark A. Hershberger
623083aa78 Fix Bug #29231: PhpHttpRequest doesn't support HTTPS
Tested fix with PHPUnit Tests that aren't currently executed by
CruiseControl b/c they're marked “broken” till someone comes up with
some reasonable unit tests that will work for everyone.
2011-06-01 18:57:33 +00:00
Sam Reed
4065e65d03 Even more documentation in various files 2011-05-29 14:24:27 +00:00
Brion Vibber
c07ed42491 * (bug 29174) Fix regression in upload-by-URL: files larger than PHP memory limit work again
r65152 switched upload-by-URL ($wgAllowCopyUploads) to use Http / MwHttpRequest class instead of CURL directly.
While this is mostly nice, it switched from saving large files directly to a temp file to buffering them in memory, causing large files to fail when they hit the PHP memory limit.

Fix uses MwHttpRequest's callback capability to override the read handler; now appending it to the temporary file as we go, and can confirm that largish files work again; was able to upload a 64mb .ogv that previously didn't work for me: http://prototype.wikimedia.org/tmh/images/b/b2/File-Arborophila_brunneopectus_pair_feeding_-_Kaeng_Krachan.ogv

Also expanded the documentation on MwHttpRequest::setCallback to clarify the function parameters and return value for the callback (which currently matches the low-level CURL handler's callback directly).
Note that the non-CURL implementation doesn't abort the read if the callback doesn't return the expected number of bytes, but this is an immediate fatal end of request on the Curl backend. May want further cleanup.
2011-05-27 22:31:48 +00:00
Tim Starling
6fec4e3fde Revert r87635, r87637, r87639, r87643 (MW_MIN_PHP_VERSION etc.): breaks HipHop support. 2011-05-15 13:21:16 +00:00
Happy-melon
fd34d0354b * Implement MW_VERSION constant in Defines.php and use it in preference to $wgVersion. Defines.php will have been loaded anywhere that DefaultSettings.php has been loaded.
* Move the declaration of $wgFeedClasses from Defines.php to WebStart.php
2011-05-07 14:53:08 +00:00
Sam Reed
d72508dbe7 * (bug 27924) PhpHttpRequest doesn't return response body if HTTP != 200
Apply Bawolffs patch minus the var_dump()'s
2011-03-17 15:14:09 +00:00
Sam Reed
149737fb27 Kill the oldtimeout stuff, with minimum PHP being 5.2.3 2011-03-15 12:24:05 +00:00
Sam Reed
604d1e47b7 After r83879, we're requiring php 5.2.3
Remove < 5.1.7 check and related code
2011-03-15 12:00:53 +00:00
Antoine Musso
a87cc203c6 typo / space fix in HTTP class 2011-03-09 07:12:19 +00:00
Mark A. Hershberger
b3df4babc2 misc w/s cleanups, “svn diff -x-w” clean 2011-03-08 18:12:17 +00:00
Sam Reed
6f9c5532f2 Last few svn property fixes 2011-03-08 02:40:09 +00:00
Sam Reed
350fbc1371 Strip cookie classes out of the middle of HttpFunctions.php into Cookie.php using svn copy 2011-03-07 20:42:55 +00:00
Brian Wolff
65eaa9dae1 (bug 27854) Http::isValidURI is way to lax. This is a much simplified regex that accepts a subset of the previous
regex, but also accepts ftps because both cURL and php support it. It no longer accepts thing like 'foo http://bar bax'
which was my main concern

Note the previous regex kind of looks more restrictive, but is not since saying "anything not containing a space
optionally followed by anything not containing a bunch of characters including a space" is the same as saying anything
with no spaces. See also r83296. This obviously doesn't catch all cases, but I personally think its sufficient.
At the very least it is a very significant improvement over the previous version that caught almost nothing.
2011-03-06 02:43:24 +00:00
Sam Reed
fbe8a15c31 Fix typo in @param comment
Add type to CookieJar

Define $result before loop
2011-03-02 13:07:15 +00:00
Jeroen De Dauw
0e0f81cdae Moved stuff so the cURL class can be used to post files and added constants so you can check if the class allows for file posting 2011-02-27 20:48:52 +00:00
Chad Horohoe
202bd2eb33 Allow callback to be set by options array, inspired by bug 27391 2011-02-14 17:16:39 +00:00
Sam Reed
c5f1a2a031 Explicitally define $domain
Documentation
2011-02-14 14:09:25 +00:00
Platonides
c31f0bc39f Follow up r67663. Now with 100% less sugar, er.. @s! 2010-12-29 16:15:23 +00:00
Brian Wolff
8adc7befe5 (Bug 25872) Rename HttpRequest class to MWHttpRequest to avoid conflict with php extension.
This also keeps the old HttpRequest class name around, so it should not break backwards compatability.
2010-11-12 07:32:09 +00:00
Mark A. Hershberger
014599f042 * Followup r75064 — fix misleading doc comment
* Don't let redirects set the status object to an error.
2010-10-21 18:18:00 +00:00
Mark A. Hershberger
1a2b825f45 follow up r75046 — Add getStatus() method to HttpRequest 2010-10-20 02:50:36 +00:00
Siebrand Mazeland
64fdb18e74 More whitespace updates for files touched in r72342:
* stylize.php run
* code formatting updates
* updated a few comments
* added braces where not used
2010-09-04 13:48:16 +00:00
Mark A. Hershberger
5dbbca7331 w/s changes 2010-09-04 01:06:34 +00:00
Alexandre Emsenhuber
4bb00ba65c Fixed some doxygen warnings 2010-07-02 21:22:38 +00:00
Tim Starling
6784f598b6 Let CookieJar work for hostnames without dots in them, so that ApiTest can work on my test wiki (and presumably most other localhost wikis). 2010-06-29 03:49:35 +00:00
Derk-Jan Hartman
e38132ec25 And one more \n in wfDebug. 2010-06-24 22:14:35 +00:00
Derk-Jan Hartman
2f4e28d9e3 Add a \n to the debug of the HTTP functions, so my debug log is readable. 2010-06-24 22:13:11 +00:00
Alexandre Emsenhuber
fa537d2d3f Fixed some doxygen warnings 2010-06-15 20:09:19 +00:00
Tim Starling
40eba8bb57 * Fix for r67684: in the curl backend, don't redirect if canFollowRedirects() returns false.
* Doxygen-compatible lists in Http::request() doc comment.
2010-06-11 06:10:54 +00:00
Tim Starling
b16fd61848 Fixes for r61911:
* Do not follow redirects by default. This breaks on safe_mode, and may potentially open security vulnerabilities in callers which blacklist domain names. Instead, send followRedirects=true option in the HttpTest caller that needs it.
* Added a check for the cURL security vulnerability CVE-2009-0037, which allowed redirects to file:/// and scp://. Refuse to follow redirects if a vulnerable client library is present.
* Factored out the redirect compatibility test into public function canFollowRedirects() so that callers can provide this information to users.
* In PhpHttpRequest, only follow redirects to HTTP URLs, do not fopen() arbitrary locations. This is not quite as bad as it sounds, since the lack of response headers prevents file:/// content from being returned to the caller.
* Fixed vertical alignment in Http::request(), per style guide.
* 304, 305 and 306 responses are not really redirects and cannot contain a Location header.
2010-06-09 06:39:22 +00:00
Platonides
1f048d2dae Follow up r67663. Stay quiet, T_OPEN_TAG! 2010-06-08 20:06:28 +00:00
Platonides
52d874ca62 Enable http compression.
Skip "CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set" error.
2010-06-08 20:01:22 +00:00
Andrew Garrett
4901c2257d As well as fixing the broken implementation of sslVerifyHost, correct its documentation and implement a new option, sslVerifyCert, to do what the documentation said that sslVerifyHost did.
Note that CURLOPT_SSL_VERIFYHOST controls *only* the verification of hostname against the hostname on the certificate.
2010-04-25 23:10:53 +00:00
Andrew Garrett
5e9e490a6b HttpFunctions: Fix bug where sslVerifyHost was only added to the CURL options when it would have no effect anyway. 2010-04-25 22:53:19 +00:00
Mark A. Hershberger
bd3faaeb15 * Fix a bug to keep consecutive HTTP requests from sharing results
* Update Login API
2010-04-09 05:25:40 +00:00
Chad Horohoe
2b4ff9dfaa bug 18664, bug 19270: Relative URIs in interwiki table break things (in general: fix wfExpandUrl() so it handles protocol-relative URIs) 2010-03-17 00:21:52 +00:00
Mark A. Hershberger
116fe657e2 * Fixes Bug #22268
* Document parseHeader()
* Separate out setStatus() so it can be called from execute()
* Avoid core dumps on older PHPs when using PhpHttpRequest and doing redirects
* Add getResponseHeader() for getting the response headers
* Add special handling on tests for older PHP
2010-02-22 05:12:20 +00:00
Tim Starling
ba7a9c2959 Fix call to nonexistent function from r61357 2010-02-16 01:06:49 +00:00
Mark A. Hershberger
d74e55fc09 Fix problem of incorrect Status message use.
Uncovered an additional problem with HTTP error messages and PhpHttpRequest
2010-02-09 08:23:09 +00:00
Mark A. Hershberger
e51c98f687 fix messages for http non-200 messages 2010-02-09 06:46:20 +00:00
Mark A. Hershberger
c8c68401e7 Fix Http::request() so that it continues to return false on non-200 requests. 2010-02-09 06:18:53 +00:00