WebRequest: Change getFullRequestURL() to use local getProtocol()
authorTimo Tijhof <krinklemail@gmail.com>
Fri, 19 Apr 2019 23:41:56 +0000 (00:41 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Fri, 19 Apr 2019 23:58:17 +0000 (00:58 +0100)
commit7929d190b467bb9ecaec02e581c8c548b63ea8ce
tree18725aec4b4e4f9a622fa40408a2a29296523dd4
parent9d225ee6039c56dae3275ceb96d4a1d9e3c6fe08
WebRequest: Change getFullRequestURL() to use local getProtocol()

Previously it relied on wfGetServerUrl to decide the url,
which passed PROTO_CURRENT on to wfExpandUrl(), when then uses
global $wgRequest and checks getProtocol() on that.

For typical web requests, these would be the same object by
reference, but the needless indirection makes the code harder
to reason about and harder to test.

Instead, check this locally and pass on an explicit HTTP or HTTPS
to wfGetServerUrl/wfExpandUrl.

Change-Id: I797bd2f909625536c3af36f015fb2e94bf922ba9
includes/FauxRequest.php
includes/WebRequest.php
tests/phpunit/includes/WebRequestTest.php