Commit graph

43 commits

Author SHA1 Message Date
Timo Tijhof
f57b6af45b WebResponse: Implement statusHeader() using the new HttpStatus::header()
* Convert existing use of WebResponse::header() for HTTP status headers
  to use this new statusHeader() method.

* Extend unit test forFauxResponse.

I'm not calling HttpStatus::header directly in code. We keep the abstraction
layer of WebResponse so that responses can continue to be mocked/fauxed without
affecting the outer HTTP response.

Change-Id: I8a536e16659fa88b54cffa1457efb889efa5fcd6
2015-06-04 02:27:30 +00:00
Thiemo Mättig
53e6c5b237 Set parameter default to array() in WebResponse::setcookie()
This is a direct follow-up for the question raised in Ifab16c2.
Null is not a meaningful value in this case. As far as I can see the
only reason it was added was to make the parameter optional. Optional
array parameters are better marked with "= array()".

Change-Id: I86965d390fdb718de7fb81a9f4c48b2261c16aa9
2015-03-27 09:58:58 +01:00
Thiemo Mättig
63a8237c64 Fix inline documentation in WebResponse
Main reason to touch this file are the missing "null" types in the
documentation.

Change-Id: Ifab16c276efb3d8c4aa0a27d8d5106d4e3303794
2015-03-26 18:48:47 +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
Ori Livneh
67e9b8e394 Add WebResponse::getHeader()
Equivalent to FauxResponse::getHeader()
Also change case of FauxResponse::getHeader.

Change-Id: I569b2ebbcd166f5d0a5a5f2dfa913a6aa49e13f4
2014-11-07 11:19:12 -08:00
umherirrender
a203032d00 Docs: compatability -> compatibility
https://en.wiktionary.org/wiki/compatability

Change-Id: I71d82ae04d4b17609a1d5a7eec4497115e64972e
2014-08-13 19:39:07 +02: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
829886b10a Fixed some @params documentation
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: I64e8cfe478cb0ba438f40b0631d6e9049cdab567
2014-04-14 12:59:19 +00:00
Kevin Israel
00b7f76aaf Remove $wgHttpOnlyBlacklist
This hack was added in r34083 / 6b16f44108 to support IE for Mac.
That browser is no longer supported, and no additional user-agent
strings have been added in WMF configuration.

Change-Id: Iffba121a9964e2ad387fad8827ddfd8dabcbd12e
2014-03-20 21:19:08 -04:00
Brad Jorsch
54bf87d346 Improve WebResponse::setcookie
Various bits of code are not using this because it doesn't support
various use cases, e.g. session cookies, httpOnly, custom paths, etc.

Refactor it to add all those options. Also add a hook so extensions can
override the setting of the cookie.

Change-Id: Ia0c424a48d9455a8574d91631cde0f00c9882288
2013-08-07 17:43:06 -04:00
Tyler Anthony Romeo
c2c40b2b9b Fixed $wgCookieExpiration functionality when set to 0.
When $wgCookieExpiration is set to 0, cookies should
by default expire when the browser closes. However,
MediaWiki accidentally interpreted this as the cookies
expiring 0 seconds from the request time.

Bug: 47886
Change-Id: Ib988ad18574122a56b0d11c8888c7c41d94dea6e
2013-07-03 17:35:02 +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
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
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
Ori Livneh
8debd7b5cd Flip order of conditionals and add explanatory note
The conditional is nominally more performant and considerably more readable
with its constituents flipped. Also adds an explanatory note. Prompted by
confusion over change Ie89507f8e98c365df9d93a7633223103b9025790.

Change-Id: I2d3db63bdbcebe0fd59c063c9f371362c9d07f91
2013-02-25 22:02:14 +00:00
Matthew Flaschen
3f4e273a7b Fix documentation error for $expire in WebResponse::setcookie.
Change-Id: I657ba9b722706d3c71a6fffa3f4b94d35d8de7c5
2013-02-23 08:07:43 +01:00
umherirrender
1044b0b8df fix some spacing
Change-Id: I8f976013f33c5818e4402604fe8610aa3f43b0c6
2013-02-04 20:18:33 +00:00
umherirrender
6fbbbd17ca fix some spacing
Change-Id: Ie7bb35871cc99237f3a655f7db22ca1f0646df5e
2013-01-27 14:21:50 +01:00
Antoine Musso
9362bb6c56 miscellaneous doxygen warnings
* @licence -> @license
* Protects inline HTML by using double quotes, our inline comments uses
  elements such as <h1> or <firstnameLastname@gmail.com>
* Commands in lowercase (@TODO -> @todo, @NOTE -> @note)
* removes @abstract and @static since doxygen detects them from PHP
  code.
* various undocumented function parameters
* typos in parameters declarations

Change-Id: I62ad6fc124c355bf31acc780b9614a59cf79a421
2012-10-22 14:00:08 +02:00
csteipp
5801da5f86 (bug 29898) Set cookie to force HTTPS from HTTP
Sets a cookie on user login (removed on logout) if wpStickHTTPS
was checked, which causes the browser to get a redirect if they
visit the HTTP version of the site.

Change-Id: I60f44a1062a93d15198edae6674bb3310a148b2d
2012-09-21 15:47:59 -07:00
Antoine Musso
fc6bc233be Fix doxygen docs before REL1_19 branching 2012-02-01 20:53:38 +00:00
Sam Reed
6d466491c6 Followup r94211
Bug 30315 - Declaration of FauxResponse::setcookie() should be compatible with that of WebResponse::setcookie()
2011-08-11 00:17:58 +00:00
Chad Horohoe
052f542165 Allow overriding $wgCookiePrefix and $wgCookieDomain in WebResponse::setcookie() so I can stop crying when I look at things like CentralAuth and CentralNotice 2011-08-10 23:27:10 +00:00
Alexandre Emsenhuber
0511b15706 * Added some tests for FauxResponse class
* Made some fixes to that class and removed one unused variable
2011-07-13 20:16:14 +00:00
Alexandre Emsenhuber
303eb51924 Per Brion, fix for r91460: make this a bit more robust 2011-07-05 16:40:12 +00:00
Alexandre Emsenhuber
2f7f99b1f1 * Don't create a WebRequest obhject in CLI mode but a FauxRequest; avoids some useless notices about headers already sent (I know this is more a PHP silliness, but anyway)
* Added HTTP response code parsing (sending a "HTTP/1.x code" header was throwing a NOTICE about undefined index on the result of the explode() call) and storage; added FauxResponse::getStatusCode() to retrieve it
2011-07-05 15:05:14 +00:00
Alexandre Emsenhuber
e7eaf43077 Added some GPL headers 2011-06-28 18:21:59 +00:00
Sam Reed
d3cd73cc25 Documentation updates and additions 2011-06-05 21:04:48 +00:00
Sam Reed
29d159aeba * (bug 22179) Internal use of API (FauxRequest) results in HTTP headers being set
Per Chad, switch API to use WebResponse::header() wrapper

Add $http_response_code to WebResponse::header()


Fix some code spacing/whitespace issues
2011-06-05 19:51:31 +00:00
Alexandre Emsenhuber
bc8abfe5b1 Drop 5.1 compatibility calls to session_set_cookie_params() and setcookie() since we require 5.2.3+ now 2011-04-01 09:50:09 +00:00
Alexandre Emsenhuber
7b79d94515 * Standardised file description headers
* Added some descriptions
* Added @file where needed
2010-08-14 17:42:40 +00:00
Mark A. Hershberger
c74fe71cd8 * new FauxResponse class to help with unit testing
* Add append() method to FileRepo classes to enable chunked uploading
* Change chunksessionkey to chunksession
* Remove echo json stuff
* Fix a multitude of bugs in my own code
* still to test: mwEmbed use of chunked upload
2010-02-10 10:36:11 +00:00
Aaron Schulz
c155fd4e4a Revert r43804 'This should probably be in Response, not Request, as we're setting data, not getting it. Nothing's using it yet (fairly new), so nothing to update.'
Session id is used by client request to specify its login data from cookie, so the session data, by extensions, is like a sort of request parameter. Also, WebResponse.php seems to be used for data actually sent to the client, like requested cookies.
2008-11-21 09:55:13 +00:00
Chad Horohoe
bf244b740f This should probably be in Response, not Request, as we're setting data, not getting it. Nothing's using it yet (fairly new), so nothing to update. 2008-11-21 09:01:26 +00:00
Alexandre Emsenhuber
a1ce0224ad fix some doxygen warnings 2008-09-17 14:26:43 +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
Chad Horohoe
9dc6b435cf Clarified visibility + docs 2008-08-24 03:06:03 +00:00
Chad Horohoe
88ba444d0d Remove boneheaded config var $wgEnablePersistentCookies. Setting the default expiration to 0 now makes the cookies session-only (seeing as it was largely ignored) 2008-08-18 19:57:01 +00:00
Chad Horohoe
98c86aa7ff * Bug 12976: Use $WebResponse->setCookie() rather than raw setcookie() calls.
* Moved all of the debugging/logic to WebResponse so it can be properly used elsewhere.
* A bit of cleanup so cookies set by $wgUser->setCookie() use $wgCookiePath as they should.
* Bug 14887: $wgEnablePersistentCookies has been added to allow for disabling of persistent cookies.
2008-08-15 01:54:59 +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
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
Antoine Musso
16558d1dbc Added some comments to our classes. 2007-04-21 12:42:27 +00:00
Domas Mituzas
8974bfd94b add some abstraction for web responses, so far minimal and not that used, requires discussion, conflicts and reverts %) 2006-08-12 23:03:53 +00:00