Commit graph

166 commits

Author SHA1 Message Date
Michael Dale
3bc78b785a * r55034#c3604 re-factored presently used curl options to back-end agnostic options.
* broke out curl and php based requests into separate classes ( more general cleanup is of course possible :)
* @@todo these tokens need to be mapped to php fopen stream "context" along with a more general mapping of the rest of the curl options.
2009-09-01 16:01:51 +00:00
Bryan Tong Minh
c2033042ee * Code style & commenting on upload functions.
* Move isValidURI from UploadFromUrl to HttpFunctions.
* Made some functions in UploadBase static.
2009-08-26 17:05:24 +00:00
Chad Horohoe
4684e284e0 Followup r53884, use wfSuppressWarnings/wfRestoreWarnings instead of @ 2009-08-19 01:55:13 +00:00
Michael Dale
16bf140f66 fixed variable name 2009-08-14 18:56:45 +00:00
Michael Dale
c89ea20030 http:get was clearing opts array (fixed) 2009-08-14 18:03:15 +00:00
Michael Dale
7049cbd76e * added curl option support for get requests 2009-08-14 18:01:05 +00:00
Michael Dale
3e052756db added memchached compatibility to background downloads. 2009-08-13 20:39:20 +00:00
Brion Vibber
40038bfe4a Suppress 'Expect: 100-continue' header on Http::post, as some servers will reject it with a 417 and Curl won't auto retry.
Curl seems to like to insert this HTTP 1.1 request header sometimes, but not always, when you add post data.
2009-08-02 07:36:47 +00:00
Brion Vibber
ab7470b6e8 Allow passing postdata in Http::post() options...
Note -- CURL allows you to pass an array which it will encode as multipart, but this doesn't seem to work for me.
Until resolved, do URL form encoding yourself with wfArrayToCGI() and pass in a string.
Todo: implement also for non-CURL mode if possible?
2009-07-30 22:11:44 +00:00
Michael Dale
d772611135 checking for session_id() was preventing updates (just put a @ infront to ignore E_NOTICE for php 4.3.3 and greater ) 2009-07-28 17:38:33 +00:00
Michael Dale
ae1b5f9855 * ( bug 19932 ) simpleFileWriter::close was still issuing a update_session_progress call even if do_close_session_update was off 2009-07-28 17:29:32 +00:00
Niklas Laxström
a2f8c30442 * formatSize is not static
* isset returns bool
2009-07-28 06:54:07 +00:00
Michael Dale
996d17d401 * ignorewarnings fixes
* removed extra debug statement 
* supports do_close_session_update for php based requests
2009-07-27 21:32:25 +00:00
Michael Dale
6af2322f85 * ( bug 19930 ) default to SYNC_DOWNLOAD 2009-07-27 19:00:27 +00:00
Michael Dale
4a200aa70f * (bug 19932) added do_close_session_update to avoid closing session on synchronous requests
* some upload js cleanup / bug fixes
2009-07-27 15:24:14 +00:00
Michael Dale
80a0e63f54 applies patch from bug 19934 2009-07-27 00:42:26 +00:00
Jack Phoenix
5af8e55976 coding style tweaks 2009-07-25 20:05:41 +00:00
Alex Z
a7c9a7e4cc Fix a couple notices/strict warnings 2009-07-25 00:19:36 +00:00
Michael Dale
a3a5708d69 fixes bug 19736
If you did not have the wgServer var set manually the internal shell request for the download would result in localhost being used for the API result url.
2009-07-23 21:28:54 +00:00
Alexandre Emsenhuber
e7802f4848 remove debugging code *stab* 2009-07-21 20:32:41 +00:00
Alexandre Emsenhuber
e35b28c0e0 * don't require allow_url_fopen enabled when cURL is available
* implemented get_headers() with cURL (headers_only option in HttpRequest)
* fix some possible ENOTICE
* some spacing fixes
2009-07-21 20:31:49 +00:00
Michael Dale
a7f7dc29cc fixed php based request path (uses fopen instead of curl) r53282 c3232 2009-07-17 19:06:36 +00:00
Michael Dale
2d5154e634 * addressed r53282#c3209 moved conditional inclusion of $wgExtensionMessages in mwScriptLoader.php to Setup.php
* put a @ in front of get_headers() should hopefully avoid errors where allow_url_fopen=0
* combined $wgPhpCliPath into the similar used $wgPhpCli var
* minor js & example file mwEmbed fixes
2009-07-15 22:41:56 +00:00
Roan Kattouw
5733faae10 Fix another fatal in r53282 2009-07-15 21:14:56 +00:00
Roan Kattouw
b92cbc2c4d Fix fatal in r53282 2009-07-15 21:10:53 +00:00
Michael Dale
332a6642c6 restored bc for Http::request per comments on r53282 2009-07-15 20:50:09 +00:00
Niklas Laxström
35049ad88b Only whitespace changes 2009-07-15 07:38:17 +00:00
Jack Phoenix
de7fa9061b follow-up to r53282:
*coding style tweaks
*added __METHOD__ to some wfDebug calls
*removed php ending tag from mwScriptLoader.php
*some doxygen docs added
2009-07-15 00:55:58 +00:00
Michael Dale
aefc40d749 here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview

= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions

== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php

* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)

== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.

= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader

* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html  )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.

= js2 system  / mwEmbed=
$wgEnableJS2system = false

* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)

* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.

= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs  <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)

== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.

== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
Chad Horohoe
7b8b26aa64 Fix odd edge case for POST Http::request()'s. I incidentally found this while working with Special:Import. For some reason that I can't 100% nail down--works fine on Win32, fails on CentOS--cURL seems to want CURLOPT_POSTFIELDS set to at least an empty string, if not values. Using a workaround I found, we'll set it to an empty string if we're making a POST. Since we explicitly allow setting of arbitrary curlopts later, users can still override the empty string if they in fact want to set this. This fixes my Special:Import problem (and possibly similar issues) and has no regressions afaict. Credit to Phill Sparks @ http://www.milk-hub.net/blog/2008/08/26/curl_error_26#comments-77 2009-01-08 06:56:11 +00:00
Chad Horohoe
380657edfc * Move user-agent construction to its own method, so we're not writing the same string in two places (and provides a reliable way for getting MW's standard user-agent)
* Mark visibility, they're all public anyway
2008-11-18 22:48:03 +00:00
Tim Starling
057eb1971f Revert r41445: static members invite permanent use in the caller, which would give us an ugly interface to remain backwards compatible with. See CodeReview. 2008-10-11 05:20:18 +00:00
Chad Horohoe
8b789e4848 Add some more debugging goodies to this. $lastCurlErrno and $lastHttpResponse are static members saved with the last returned status codes. 2008-09-30 19:58:56 +00:00
Brion Vibber
9fdb79cfd2 Curl sanity -- dump non-200 return codes and error numbers to debug log at least, rather than just silently failing. 2008-09-30 19:25:04 +00:00
Chad Horohoe
1bc6db839f * Remove unneeded ini_set() from a very long time ago. Can't run this on allow_url_fopen nowadays.
* Remove extra global declaration.
2008-09-29 06:24:32 +00:00
Chad Horohoe
de193b7869 Cleanup some docs :) 2008-09-29 06:12:47 +00:00
Chad Horohoe
af7cdb8b48 Make file_get_contents() respect our timeout settings. Otherwise, we'll get 3 minute waits for timeouts potentially, which is icky. 2008-09-22 15:44:13 +00:00
Chad Horohoe
574c459824 Fix more doxygen stuff. 2008-09-20 03:44:09 +00:00
Chad Horohoe
dc404545e0 Fix some doxygen stuff. 2008-09-19 00:21:03 +00:00
Chad Horohoe
fa6d8c3dba Add $options param to Http::get() and friends. Now things don't need to use curl directly just because they want to set specific options not set by default (I'm eying you, UploadFromUrl and SpecialUpload). 2008-09-11 00:29:51 +00:00
Chad Horohoe
3064f477ff Add @ingroup definitions to these. Created new group HTTP for web-related things (cookies, headers, HTTP requests, etc). 2008-09-03 17:30:20 +00:00
Brion Vibber
aca1bd92fa Revert r34877 -- duplicates wfExpandUrl() 2008-05-15 19:42:55 +00:00
Bryan Tong Minh
0ea9e36c3c Force output of a full URL in Special:Filepath and ApiQueryImageInfo in case the wiki images are not configured to full urls. 2008-05-15 18:33:12 +00:00
Siebrand Mazeland
79d5225c0e * remove end of line whitespace
* remove empty lines at end of file
* remove "?>" where still present
2008-04-14 07:45:50 +00:00
Alexandre Emsenhuber
7ac76358c3 replacing some calls from deprecated global functions to new modularized functions 2008-03-05 11:58:44 +00:00
Tim Starling
697c6b32b4 Don't return truncated output 2007-08-31 14:53:17 +00:00
Brion Vibber
e3dfb56b52 A little more cleanup on the fallback (non-cURL) HttpFunctions fetch.
Include a User-Agent header equivalent to the cURL one; this also is needed
when fetching export pages from Wikipedia, as we currently block the default
PHP user-agent string...
2007-07-17 15:13:57 +00:00
Brion Vibber
06e677c9c8 * (bug 10615) Fix for transwiki import when CURL not available
Was doing a POST without sending Content-Length header, which some web servers get real pissy about.
Now sends a 'Content-Length: 0' header
2007-07-17 14:46:43 +00:00
Aryeh Gregor
a15c419b3d Remove ?>'s from files. They're pointless, and just asking for people to mess with the files and add trailing whitespace. (Yes, I looked over every one and reverted those that were bogus. Slash-enter a million times in less worked well enough, although it was a bit mind-numbing.) 2007-06-29 01:19:14 +00:00
River Tarnell
ec38363086 PHP Fatal error: Call to undefined function request() in /usr/local/apache/common-local/php-1.5/includes/HttpFunctions.php on line 8
need to qualify function with class name
2007-05-10 19:29:21 +00:00
River Tarnell
e59f873bef - Http::request(), Http::post()
- don't redirect page views on POST
- Special:Export shouldn't do POST special case when page name provided
- Special:Import should use POST for interwiki fetches
2007-05-10 19:13:02 +00:00
Tim Starling
2ff288720c Various performance and initialisation issues:
* Made autoloader work for unserialize()
* Made XmlFunctions.php and HttpFunctions.php autoloadable modules, via Http:: and Xml::
* Made Image class autoloadable, global functions moved to ImageFunctions.php where they can be loaded on every invocation.
* Removed some unnecessary require_once() calls
* Deferred $wgValidSkinNames initialisation
* Fixed a couple of silly construct/initialise splits. My idea from C++ experience, bad practice in PHP.
* Deferred skin initialisation in ParserOptions
* Removed $wgMwRedir during an attempt to make MagicWord autoloadable. Didn't complete that, but removing the global is still the right direction.
2006-07-02 15:57:59 +00:00
Brion Vibber
0a26267688 Revert to r14512; domas introduced massive breakage with incomplete experimental changes. They will be recommitted when they work. :) 2006-06-01 08:19:02 +00:00
Domas Mituzas
bda0b8e104 Use AutoLoader to load classes:
* remove require_once() throughout whole code, yet left in few places
* move global functions in HttpUtils, ProxyTools, Credits to class methods
* php5 only: __autoload() now used, combined with class->file map and require()
* move initialization of $wgValidSkinNames to Skin::getSkinNames()
* few more changes that will surely break stuff.
2006-06-01 07:22:49 +00:00
Lupin
c7408b9223 trailing whitespace removal 2006-03-11 17:13:49 +00:00
Lupin
11337038b3 removing unused globals and some whitespace cleaning 2006-03-07 01:10:39 +00:00
Tim Starling
61bc10203f Various improvements to interwiki transclusion. Introduced {{raw:..}}, to force raw transclusion when subst: isn't in use. Referer header set in wfGetHTTP(), this could be for weak (honour-bound) detection of the external site, for statistics or license notices. 2006-02-01 04:41:53 +00:00
Tim Starling
8da9fca6c0 Fixes and improvements to interwiki transclusion:
* allow interwiki {{subst:...}} using action=raw fetches
* Allowed non-MSIE browsers to access action=raw via the article alias. This is necessary to allow action=raw transclusion, since the only known URL is the article path, not the script path.
* Specify a user agent in wfGetHttp() fetches, when using curl.
* Added transcache table to tables.sql, it was in the updater but not there for some reason.
* Fixed transcache expiry, added option
* Allow interwiki transclusion outside the template namespace using leading colon syntax. Syntax is counterintuitive at times, e.g. to subst the wikipedia main page you would use {{subst::Wikipedia:Main_Page}} not {{subst:Wikipedia::Main_Page}}.
2006-01-31 03:44:08 +00:00
Ævar Arnfjörð Bjarmason
7bbe971aec * s~ +$~~ 2006-01-07 13:09:30 +00:00
Antoine Musso
b7db9837bf some useless calls / unitialized $matches arrays 2005-12-04 21:15:04 +00:00
Antoine Musso
2ca68a256d Clean up unused globals! 2005-12-04 18:27:59 +00:00
Tim Starling
758d91f128 Check for error response codes, don't proxy via localhost in command line mode 2005-11-01 22:26:11 +00:00
Antoine Musso
157861bc31 fix some issues with phpdoc 2005-07-05 21:22:25 +00:00
River Tarnell
2d61f91edf - proxy support for wfGetHTTP()
- support for interwiki transcludes (disabled by default, keyed on iw_trans)
2005-07-03 07:15:53 +00:00
Brion Vibber
39f7b246de live hack 2005-06-26 18:49:40 +00:00
Tim Starling
bf452fdc63 Made a SiteConfiguration object generally available. Added functions for performing an HTTP client request using curl. This will be used in the SpamBlacklist extension, and hopefully Lucene as well. 2005-06-26 06:34:13 +00:00