Commit graph

335 commits

Author SHA1 Message Date
Amir E. Aharoni
d928aac86c WebRequest.php: Make lines shorter to make phpcs happier
Change-Id: Icdc91bc32c526065009b18ece34205aa765cfd46
2015-09-26 14:19:03 +00:00
umherirrender
3ab5510ef7 FauxRequest: Avoid header leak
Actually override initHeaders to avoid init of the header, if no header
was set.

The tests was taken from I4c06369968e.
Follows-up 578a0c082f.

Change-Id: I86b2a9bae2f5938374fd9e5e46997c3fdfe87e39
2015-09-16 16:52:58 +00:00
jeroendedauw
578a0c082f Remove unused private methods in FauxRequest
Change-Id: I49a0a8ced0819eeef3ff404fc14b0b90c36b0922
2015-09-15 19:08:22 +00:00
Timo Tijhof
45d7d21140 FauxRequest: Add @since for new setHeaders and setCookie methods
Follows-up 53b0df09ab.

Change-Id: Ia854aef848062624eccc6a5b25b7d1f1f8fbc444
2015-07-03 03:38:38 +00:00
Brad Jorsch
53b0df09ab Add cookies and improve headers in FauxRequest
For testing, it can be useful for a FauxRequest to actually contain
cookies. And for convenience, it's useful to allow setting headers by
passing an array rather than by making multiple calls to ->setHeader().

Change-Id: I3b84246e954aae594490927d2b0a57336af2e3a5
2015-07-02 12:43:02 -04:00
Gilles Dubuc
b276829806 Make proxy behaviour of detectServer() configurable
Bug: T75510
Change-Id: Ia6540962f8d913d925547189e101124f76d969c7
2015-06-22 21:19:22 +02:00
daniel
9f34e31d33 Allow limit and offset to be restricted in subclasses of QueryPage.php
Change-Id: Ib54b50619a0f412e53f92d48821221a243f19756
2015-06-18 19:51:10 +00:00
Alex Monk
e7c9096ecc HTTPS-ify links to Wikimedia's sites in MW core source
See https://blog.wikimedia.org/2015/06/12/securing-wikimedia-sites-with-https/

Ignoring SVN stuff because svn.wikimedia.org's SSL certificate has expired, and
ignoring wgSharedUploadPath because T25122 wants to get rid of it.

Also a couple of BZ -> phab changes

Change-Id: I02fd23ac6c30a4a4c718e57d4dedbc693dd653c0
2015-06-13 19:23:23 +01:00
Kunal Mehta
f6e5079a69 Use mediawiki/at-ease library for suppressing warnings
wfSuppressWarnings() and wfRestoreWarnings() were split out into a
separate library. All usages in core were replaced with the new
functions, and the wf* global functions are marked as deprecated.

Additionally, some uses of @ were replaced due to composer's autoloader
being loaded even earlier.

Ie1234f8c12693408de9b94bf6f84480a90bd4f8e adds the library to
mediawiki/vendor.

Bug: T100923
Change-Id: I5c35079a0a656180852be0ae6b1262d40f6534c4
2015-06-11 18:49:29 +00:00
Ori Livneh
9622c07f46 WebRequest::getHeader: add optional flag to get back list
* Add a stub FauxRequest::initHeaders method. This allows FauxRequest to
  use WebRequest's getHeader implemention, leading to less code duplication.
* Add an optional $flags parameter to WebRequest::getHeader. When the flag
  WebRequest::GETHEADER_LIST is set, treat the header as a comma-separated
  list of values (per RFC 2616 § 4.2) and return an array.
  (Initial use-case: Ibb292d241's treatment of If-None-Match header.)
* Add test.

See <http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html>.

Change-Id: I2760f57adfa7b886c84044a6e9348a47ac307229
2015-05-08 17:58:54 -07:00
Ori Livneh
667fa3e264 Make WebRequest objects time-aware
* Deprecate $wgRequestTime in favor of $_SERVER['REQUEST_TIME_FLOAT'], which is
  more accurate. Because $_SERVER['REQUEST_TIME_FLOAT'] is only set for PHP
  5.4+, set it to microtime( true ) in WebStart.php for back-compatibility.
* Add a 'requestTime' property to WebRequest objects, set to
  $_SERVER['REQUEST_TIME_FLOAT'] for WebRequest or the instance creation time
  for FauxRequest instances.
* Use that to provide WebRequest::getElapsedTime(), which gets the time since
  the request was initiated.
* In wfLogProfilingData(), get the user and request objects from the context
  object rather than from global scope.

Opportunistic clean-up: move the magic quotes check to WebStart.php and make
the error message more helpful.

Change-Id: I7e07e22eaf16b5141b80ad9f843285c542a127b7
2015-04-01 18:21:26 -07:00
Kunal Mehta
13975fe76a Use wikimedia/utfnormal library, add backwards-compatability layer
This drops support for the custom utf8 normal PHP extension in favor
of the intl extension.

Bug: T90825
Change-Id: Ifbaeb2ef684217cf6187ccc4fb4d303f89608300
2015-03-24 12:59:26 -07:00
Jaroslav Škarvada
89a5f17463 Fix HTTPS protocol detection
According to PHP documentation:
http://www.php.net/manual/en/reserved.variables.server.php
The $_SERVER['HTTPS'] is set to a non-empty value if the script was queried
through the HTTPS protocol. There is also note that for ISAPI with IIS, the
value is set to 'off' if the request was not made through the HTTPS protocol.

To follow the PHP documentation the $_SERVER['HTTPS'] == 'on' doesn't seem
to be the correct way how to detect the HTTPS protocol (there maybe e.g. '1'
instead of 'on').

Bug: 46511
Change-Id: I5675fed9b7d54711b96b25702181112ef3692f3c
2015-01-16 16:22:54 +00:00
Aaron Schulz
e369f66d00 Replace wfRunHooks calls with direct Hooks::run calls
* This avoids the overhead of an extra function call

Change-Id: I8ee996f237fd111873ab51965bded3d91e61e4dd
2014-12-10 12:26:59 -08:00
jenkins-bot
3e51aeea1c Merge "Don't rely on $wgTitle in WebRequest" 2014-10-02 20:27:51 +00:00
Max Semenik
14433b56fd Implement FauxRequest::getRequestURL() - needed for MF tests
Change-Id: Ib780582cdc68cb770c5fd12d805f4561bc0e2a13
2014-09-25 14:41:51 -07:00
Chad Horohoe
35e1c7cd67 Don't rely on $wgTitle in WebRequest
All callers have been updated to provide their own getLocalUrl() calls as
appropriate, so deprecate calling appendQueryValue() and appendQueryArray()
with $onlyquery = false.

appendQuery() is now unused and deprecated as it always assumed $onlyquery = false

Change-Id: I142195c39f278165118a52143031008d9c68e01a
2014-09-24 13:49:38 -07:00
Bryan Davis
e2fb163be2 Use protocol default port with HTTP_X_FORWARDED_PROTO
When $_SERVER['HTTP_X_FORWARDED_PROTO'] is set, keep the detected
protocol default port rather than using the local server port when
creating a canonical URL.

Bug: 70021
Change-Id: I2b37da5872929e1c461ff20cccf3dfe11f182a2f
2014-08-25 21:54:41 -06:00
withoutaname
b74a36fce6 Documentation: Remove paragraph about not creating a 2nd WebRequest
WebRequest is no longer required to be a singleton for $wgRequest,
thanks to https://gerrit.wikimedia.org/r/144996

Change-Id: Ica629fd28d96f8ee77ee548b0a284abf24b1e780
2014-07-26 19:27:36 -07: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
Chad Horohoe
5a4a33a8ff Remove support for magic_quotes_gpc
This "feature" of PHP has been disabled by default for quite some
time, deprecated in 5.3 and removed entirely in 5.4.

See <http://www.php.net/manual/en/security.magicquotes.php> for
information on why this practice is bad and how to disable it.

For MediaWiki, the removed todo comment says it all. Doing this
messes with all of the super globals and makes embedding MediaWiki
inside another application problematic. It also increases our
memory footprint for every single request even when the data might
not be used.

Finally, it makes it possible to instantiate new WebRequest objects
pretty much whenever you want, so there's no reason for $wgRequest
to exist anymore.

Bug: 11558
Change-Id: I4bc0392276f454ceb966547c7fbd7c8190ebbc7c
2014-07-23 20:38:31 +00:00
withoutaname
bfa75b6f45 Removed deprecated WebRequest::escapeAppendQuery()
This function was deprecated in 1.20 and slated for removal in 1.22;
there were supposed to be warnings given in 1.21 but there does
not seem to be any use of this function otherwise in core.

Change-Id: If70a4e2c1509bf3527d5f8960c14115ce4ab713e
2014-06-20 15:11:03 -07:00
Aaron Schulz
5d6864ccf1 Cleanups to WebRequest::getIP logic
* Throw an error if there is no immediate server IP, otherwise the
  XFF logic is wonky.
* Refactored the loop to be a bit easier to read.
* Better handle "unknown" entries in the XFF chain.

Change-Id: I9541afa408d895c3fd337a883ecfe4ce0ba57090
2014-06-11 09:59:14 -07:00
Thiemo Mättig
c10b4698f0 Fix broken @return documentation
I found one of these in Wikibase and run a global search.

Change-Id: I76c1519a47d7222f136272c59ea454b650808a86
2014-05-24 22:06:01 +02:00
Brandon Black
e323bc3393 Speed up CIDR matching from $wgSquidServersNoPurge
This adds a new generic library class IPSet, which precomputes
a reasonably-efficient data structure from the input list of
addresses and CIDR net/mask specs for fast runtime matching,
and then uses it to check trusted XFF-setters.

See also: 32b4f19f173fc5cff1029eedee63a39a2d72dd3a
Bug: 57021
Change-Id: Ia3b12fb90c3e7e492374a128943b014481cc2730
2014-05-15 17:23:12 +00:00
Siebrand Mazeland
4b8523198f Make phpcs-strict pass on includes/ (4/~10)
Change-Id: I2767205a7059adfb8fa090a82abd332e518f2590
2014-05-11 19:35:09 +00:00
csteipp
a43530d825 Initialize static input to null
Followup to I8710844f21d21cbbf28517b0cc25b0713b506bee.

Change-Id: I1163deeaf18a31480ed425c7aedd0024591fd4ce
2014-05-01 12:58:46 -07:00
umherirrender
23bb3d1cb4 Follow-Ups to "Fixed some @params documentation"
Fix of inline comments of the following patch sets:
Follow-Up: I0056b4a8df243cfc0c5f25378de48f7a35170aca
Follow-Up: I7f605aa9e117b5fd80d9b1440864fe526d2b14a5
Follow-Up: I3622f216a2ca8ac1b5e51892be9f98665f65bc36
Follow-Up: I6627ba0e76d3577c40bf2473e0f78a5ad7368634
Follow-Up: Id75b5ecf648ca50f955b3bde3307c82c4366b102
Follow-Up: I4ca5231119f33039d91da3b57a41cd40719a576b

Change-Id: Id9bbe84b2820e9db44af5783411e955f55f643d4
2014-04-23 13:39:49 +02:00
umherirrender
30fe862c20 Fixed some @params documentation (includes/[WebRequest.php|Xml.php])
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.

Change-Id: I4ca5231119f33039d91da3b57a41cd40719a576b
2014-04-23 10:28:46 +00:00
Ladsgroup
1ba0445c12 Changing URLs of mediawiki.org in scripts to the SSL-based website
http://www.mediawiki.org --> https://www.mediawiki.org

Part 2

Change-Id: I3be61fe3dfb502cc20180486eb1a8016eac151df
2014-03-12 23:24:03 +00:00
jenkins-bot
996771f720 Merge "Revert "Limit searches at 500 per page"" 2014-02-11 18:05:05 +00:00
Chad
e56e3ce5e9 Revert "Limit searches at 500 per page"
People seem to like large slow search pages.

This reverts commit 42d4f35696.

Change-Id: I52ee602a81c1b6ec4e124008806271b0c74c581c
2014-02-11 01:03:45 +00:00
umherirrender
bda7e863ef Ignore 'unknown' in XFF
Can come from Squid
http://www.squid-cache.org/Doc/config/forwarded_for/

Bug: 57467
Change-Id: I3fd3170d31a1aff2e748302c30dd6e364ed3bdcd
2014-01-28 00:39:20 +00:00
jenkins-bot
3de8536d3e Merge "Remove classes and functions deprecated in MediaWiki 1.17" 2014-01-09 21:11:51 +00:00
Chad Horohoe
42d4f35696 Limit searches at 500 per page
* 5000 search results in a single page is too many to be useful and
  just results in a slow page load. If you need that many results use
  the API.
* Adds new parameter to WebRequest::getLimitOffset() to allow making
  the 5000 limit configurable by callers

Change-Id: I7c12e4b0526db6453aaba5d589ee1c01a54b72d4
2014-01-09 10:38:19 -08:00
Siebrand Mazeland
52ba6500df Remove classes and functions deprecated in MediaWiki 1.17
Removed classes:
- WikiError (deprecated in 1.17)
- WikiXmlError (deprecated in 1.17)
- WikiErrorMsg (deprecated in 1.17)

Removed methods:
- ApiBase::getValidNamespaces() (deprecated in 1.17)
- ApiMain::setCachePrivate() (deprecated in 1.17)
- ApiMain::setVaryCookie (deprecated in 1.17)
- CategoryViewer::addSubcategory() (deprecated in 1.17)
- WebRequest::getFileSize() (deprecated in 1.17)
- WebRequest::isPathInfoBad() (deprecated in 1.17)

Change-Id: Id715c2391742c136d09f5369f88d67e798842af7
2014-01-05 18:54:27 +01:00
Siebrand Mazeland
c6178d229c Remove unreachable statement
Change-Id: I537d189e802c6201a4c9a1a5f17ca172836ec5b3
2013-12-27 17:34:55 +01:00
umherirrender
0bc583af2c Move closing parenthesis from multi line if and function to own line
The Line continuation Coding conventions prefers the closing parenthesis
on the same line than the beginning curly braces. This is done for ifs
and functions.
Also move some boolean operator from the end of a line to the beginning
and changed some indentation to make the condition hopefully better
readable.

Change-Id: Id0437b06bde86eb5a75bc59eefa19e7edb624426
2013-12-01 21:39:00 +01:00
Reedy
b38473c328 Make WebRequest::protocol protected as it's used in subclasses in the same file
Change-Id: If894e9122fa56e957c666c887fb33ed60733ac0e
2013-11-23 01:08:44 +00:00
Siebrand Mazeland
1032c5c3da Add documentation for DerivativeRequest::__construct
Change-Id: I20e62d07b6a069b3c2b5b0cb67736ded294bcfb2
2013-11-16 20:07:19 +00:00
Bartosz Dziewoński
9a61734fb7 FormOptions: Implement FLOAT type
Also added WebRequest#getFloat().

Change-Id: I854f09bd26287880a2806852274471904bc33092
2013-11-07 23:50:59 +01:00
Tim Starling
8af1c9503d Introduce WebRequest::getProtocol()
The use of static server detection outside of its intended use case
(i.e. at the start of DefaultSettings.php), for example in r93258, was
an architectural error. Every other bit of information about the web
request in non-setup code comes from non-static methods of WebRequest,
which allows the request object to be meaningfully replaced or
subclassed. The situation became increasingly ridiculous as more
callers of WebRequest::detectProtocol() were introduced. Two of the
callers were calling it non-statically! I suppose they had the right
idea, in a way.

Using a non-static call allows caching, which is a nice additional
benefit.

WebRequest::detectProtocolAndStdPort() was introduced in r93258 as part of
the introduction of WebRequest::detectProtocol(). It was basically
useless. Grep indicates there was only one caller in core and WMF
deployed extensions, and it is patched here.

Change-Id: Ia0a61e98fbff7a46ceaeebcb02236e5eac3df0e1
2013-11-06 21:13:10 +04:00
Aaron Schulz
382ed18a64 Detect invalid IPs in XFFs and give a more useful error message
* This will only error out if we are stuck with a CDN or site proxy IP

Bug: 54288

Change-Id: Ib81e06527c2f7a8d9c288b56c0f46610a4517f74
2013-09-19 23:05:27 +00:00
Chad Horohoe
9c57e5f5f5 Protect against non-arrays when fetching headers
PHP documentation says this can theoretically return false on failure.

HHVM actually returns null when running from the command line, so
this does protect against that.

Change-Id: I0d75b8ed209128a9667ce1e7189597ae9ebc8af6
2013-09-17 10:38:14 -07:00
Max Semenik
cfc0770ad0 Normalize IPv6 addresses in XFF chains
Otherwise, we're at proxy's mercy for using the same form of IPs.

Change-Id: I090947958bf699ee6d8a9009c9e4a6d11da23f2c
2013-08-30 00:55:38 +04:00
csteipp
8ef4572700 Add methods to get raw request in WebRequest
Make it possible to get the raw parameters given to the request, with
no escaping. This is needed for features like OAuth, where a signature
is calculated over the parameters to verify their integrity and source.

FauxRequest is extended so the original request doesn't pollute the
fake one. This could be extended so "raw" values could be set and used,
but there isn't a use case for that yet, so it's not done here.

Change-Id: I8710844f21d21cbbf28517b0cc25b0713b506bee
2013-07-29 16:52:17 +00:00
jenkins-bot
00073f299b Merge "Make headers in FauxRequest case insensitive" 2013-06-03 15:06:43 +00:00
daniel
1da2dd7983 Make headers in FauxRequest case insensitive
HTTP headers are case insensitive per spec, and WebRequest
treats them like that, so FauxRequest should too.

Change-Id: I4257af7a8de2792ac556c670dcc7f28e4af4cb44
2013-06-03 16:23:11 +02:00
Aaron Schulz
8bd6922ab0 WebRequest::getIP() cleanups.
* Always treat the first XFF IP from cache proxies as sane
  even if it is a private IP (useful for things like labs wmf).
* Make sure IP::canonicalize() gets called if the IP is selected
  from the XFF chain (this matches getRawIP()).
* Altered and expanded unit tests.

bug: 48919
Change-Id: I350aca72c7a96ba3ec727324800612fc84e0e7a4
2013-05-30 18:24:43 +00:00
Tim Starling
196865004d Remove taint support
Venema's taint feature was apparently never publicised beyond the
php-dev mailing list, and now there is a PECL taint extension which is
incompatible with the interface assumed here.

Grep confirms that wfArrayMap() is not used in any extensions.

Change-Id: I17d8d302947443262474c608829c7c7504bef589
2013-05-06 17:39:07 +10: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
Kevin Israel
516fcfe0ca WebRequest::getRequestURL: Follow up Ibe00a6b8
* Only match consecutive slashes at the beginning of the URL, where
  they are actually a problem.
* Fix bug 46607 in cases where the server provides an absolute URL.

Change-Id: Ibe00a6b8722786170d09b846c1c4054b73da3d9e
2013-03-29 13:28:35 -04:00
Siebrand Mazeland
075dc3f57d Prevent PHP notice by adding isset() check
Issue was caused by change
I34c3fc9d8f9467e83cd201cb099c2d26f3a39b36

Bug: 46627
Change-Id: Ida87efc622e9e90b835473f069559817565eafc1
2013-03-28 08:42:51 +00:00
MarkAHershberger
5a266de0a4 Handle protocol-relative URLs in WebRequest::getRequestURL.
Multiple slashes at the start of the request url will look like a
protocol-relative url, so strip the extra slashes.

Bug: 46607
Change-Id: I34c3fc9d8f9467e83cd201cb099c2d26f3a39b36
2013-03-27 17:55:58 +00: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
Aaron Schulz
f31a0463aa Fixed importScopedSession() and moved exportUserSession() to RequestContext.
* Renamed WebRequest::exportUserSession -> RequestContext::exportSession.
  Updated the only callers of this new function.
* Init the user with User::newFromId() instead of relying on the session
  (which breaks when things like CentralAuth are enabled).
* Made RequestContext::exportSession() include the user ID.
* Removed now-redundant user ID checks in upload jobs.
* Added unit tests for the session import function.

Change-Id: I543e6766f7a8a828ea5d270328c3bc7738c6fe94
2013-03-15 12:49:54 -07: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
Reedy
c3e4057e06 Kill off numerous unused variables
Change-Id: I7039f1328f37ee669b694f73ee282602186bffd1
2013-03-08 02:36:24 +00:00
umherirrender
de7380b56e Change intval( User::getOption() ) to User::getIntOption()
Also changed some getOption with int or bool cast

Change-Id: Ia551a50e9de047c62be84065481fdf8c02e2ef96
2013-03-04 14:08:48 +00:00
Aaron Schulz
fbf34d84ab [Upload] Moved async upload stuff to the job queue.
* (bug 44080) Also carry-over the IP and HTTP header info.
* This adds a RequestContext::importScopedSession() function.

Change-Id: Ie9c0a4d78fb719569c8149b9cc8a5430f0ac5673
2013-02-15 15:00:35 -08:00
umherirrender
ca31ebad3f fix some spacing
Added/removed spaces after opening/before closing parentheses

Added a space after a comma

Removed unneeded parentheses in condition

Change-Id: I306091347ccaaf11dee0cdfda3019cb0c12be51b
2013-02-09 23:03:53 +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
umherirrender
9d6575af15 The static declaration must come after the visibility declaration
From phpcs

Change-Id: Ieab0207f965630eda113abdc0259aa2eddcf5ca7
2013-01-26 21:03:52 +01:00
Niklas Laxström
833f87a037 (bug 44010) FauxRequest leaks cookie data from primary request
Change-Id: I6baf972352fd69660c09a5d413ff55b81aa31305
2013-01-16 09:45:36 +00:00
awjrichards
b786347996 Makes WebRequest::detectProtocolAndStdPort() take HTTP_X_FORWARDED_PROTO headers into account
Change-Id: I4debf1460b6357962fc634f781416929bcca2d76
2013-01-03 15:46:34 -08:00
IAlex
3b0f9bfe28 Merge "Tidy up some unbalanced returns in methods" 2012-12-09 09:48:40 +00:00
Reedy
d537d96868 Add numerous missing @throws to method documentation
Change-Id: Iba868e82a75fef7c7d011bc5be192bf059d037c0
2012-12-09 03:09:48 +00:00
Reedy
d0a242abb4 Tidy up some unbalanced returns in methods
Leave a TODO

Change-Id: Ic49ac8630650b341aafb3c17abd22f3a07805d27
2012-12-09 02:59:04 +00:00
umherirrender
e5f5e95137 Fix indentation whitespace errors
Change-Id: Ie268bee2098c589c050e1b5b0e93fe1b3feca86f
2012-10-26 17:42:13 +02:00
Aaron Schulz
5e2ac408f8 Merge "(bug 26585) Detect CSV/array values in $_SERVER['REMOTE_ADDR']." 2012-10-23 21:18:21 +00:00
Tyler Anthony Romeo
c4ed43cf6b (bug 26585) Detect CSV/array values in $_SERVER['REMOTE_ADDR'].
Changed WebRequest::getRawIP to check for values of
$_SERVER['REMOTE_ADDR'] that are either an array
or a comma separated list of IP addresses, and throw
an exception.

Original patch by Ilmari Karonen. Adapted from original
patch to work with newer MediaWiki version.

Change-Id: I4b3c56adf46b336c5032db3f2a1e621c873f0d83
2012-10-23 17:14:33 -04:00
umherirrender
85d8ee1f87 Remove a bunch of trailing spaces and unneeded newlines
Change-Id: I00f369641320acd7f087427ef031f3ee7efa0997
2012-10-10 20:14:40 +02: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
Alexandre Emsenhuber
53b3c82fd7 Added WebRequest::getMethod() to get the HTTP method of the request.
This is to replace the usage of $_SERVER['REQUEST_METHOD'].

Change-Id: I45084254c5452b00b0665df78628cfd214e39cab
2012-08-07 18:28:43 +02:00
Alexandre Emsenhuber
737ccd82c6 In WebRequest, don't use isset() to check that a variable is null
Change-Id: If4577b911e774e1e0c6a1d90c585bbb027d6b7cd
2012-08-06 13:02:34 +02:00
Reedy
c61744b0d8 Suppress warnings around parse_url call
From the docs:
On seriously malformed URLs, parse_url may return false and emit a E_WARNING

We're already checking for false, but we can get spammed with E_WARNING..

Change-Id: I44a9ef2b163e64113bd2a30b081c1256ffeada1e
2012-07-28 19:50:34 +01:00
Antoine Musso
aab43dd495 escape tags and entity in doxygen comments
When inserting XML elements inline <such as this one>, doxygen chokes
about it not being known. Simply enclosing the tag in double quotes
prevents doxygen from emitting a warning.

Also enclosed a few invalid functions calls such as \. and double quoted
the HTML entities such as &foobar;

Change-Id: I4019637145e683c2bec3d17b2fd98b0c50a932f1
2012-07-10 17:08:32 +02:00
awjrichards
c29fd59775 Big oops - merged to wrong branch.
Revert "Revert to arbitrarily old point before initial remote branch creation to help clean up"

This reverts commit ee0d3d330f
2012-06-05 22:58:54 +00:00
awjrichards
ee0d3d330f Revert to arbitrarily old point before initial remote branch creation to help clean up
Change-Id: I41a3d1e55d3ea9dffa42451237fe065f9334361d
2012-06-02 08:43:04 -07:00
Platonides
1ea18dfaf2 Minor changes to Ic50d01f5 Accept-Language code.
Minor improvments to commit 894c5c1

Change-Id: I8cc63cb1ba2c3aa74ca9e225022d5be75e75ad23
2012-05-29 20:38:48 +02:00
Liangent
894c5c108d Tweak Accept-Language sorting method to respect RFC 3282.
Now in Accept-Language handling (in the language converter),
languages appearing earlier in the list are treated as more
preferred languages (variants).

Change-Id: Ic50d01f52dce1ae1f4f4e747d5f8b8399ca03b0b
2012-05-28 19:03:19 +08:00
Max Semenik
40e35d5b32 Deprecate WebRequest::escapeAppendQuery()
It is an ugly piece of UI-related code in an infrastructure class.
Its only user, MobileFrontend, is currently in process of getting rid of it.

Patchset 2: Fixed commit message

Change-Id: I62f9f707532a95be01c1ecdcb1fbfbd0c4117be6
2012-04-25 12:09:01 +04:00
Reedy
8f9563ce7b A set method doesn't need to return anything (and besides, niether does $this->base->setSessionData())
Change-Id: I1315697ee2879898b033c1dd01fecb809c4fe0dd
2012-04-07 17:21:16 +01:00
Daniel Friesen
9d83797631 Separate $wgArticlePath from $wgUsePathInfo.
- $wgUsePathInfo is now only used on servers not passing REQUEST_URI to determine if PATH_INFO should be used
- WebRequest now extracts information from REQUEST_URI even when $wgUsePathInfo is false
- HTMLForm bases it's decision on whether or not to include a hidden 'title' input on whether $wgArticlePath uses a query instead of assuming that $wgUsePathInfo was used to set the article path

Change-Id: I1b461fef88b26d045f4edd7553b59255c5e595d8
2012-03-24 03:44:08 -07:00
Benny Situ
586285e1f3 followup to -r113545 - add null for missing $default param 2012-03-10 00:31:54 +00:00
Roan Kattouw
f5f30aa959 (bug 34521) Returning to the previous page after logging in loses any array-valued parameters in the query string. This happens because WebRequest::getValues() calls getVal() which strips arrays, even though the doc comment says that no transformation is applied. Changed getValues() to call getGPCVal() instead. The only difference is that arrays are no longer stripped, so the doc comment is no longer a lie 2012-03-09 23:27:28 +00:00
Niklas Laxström
7476c290d3 Hrrrmp *grumbles* 2012-03-01 13:38:49 +00:00
Arthur Richards
1c242d9690 Added unsetVal() method as antithesis to setVal() 2012-02-29 21:56:05 +00:00
Sam Reed
c052fc3b7b Documentation followups from lastnight 2012-02-10 15:37:33 +00:00
Sam Reed
0a626db6e1 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 19:29:36 +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
Mark A. Hershberger
2d72930472 w/s 2012-02-07 13:05:31 +00:00
Sam Reed
657ecdebfa Add @since to getIP/getRawIP
Came in r94932, soemwhere after 1.18 was branched, so is in 1.19
2012-02-06 20:20:43 +00:00
Antoine Musso
ffbb4a0ed2 FauxRequest now has empty data per default 2012-01-09 10:42:44 +00:00
Jeroen De Dauw
0b105ebf1d added missing deprecation notices 2011-12-13 19:51:03 +00:00
Daniel Friesen
8ddf933100 Followup r104676, r104688:
- Update our woefully out of date doc comment for WebRequest::getPathInfo (we haven't simply been extracting a PATH_INFO for ages)
- Make PathRouter::makeWeight protected
- Add more comments to the PathRouter code
- Add two more edge case tests to the PathRouter tests.
2011-12-09 00:28:34 +00:00
Daniel Friesen
fba28f5233 Followup r104688, reintroduce the full PathRouter code now that the bug with url encoded paths is fixed. 2011-11-30 15:12:19 +00:00
Brion Vibber
73b6bd244a Revert r104274, r104284, r104285 -- breaks special pages on non-english 2011-11-28 19:55:49 +00:00