X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FWebRequest.php;h=6593e49d8a219aa7d3250617778ed836f75b416c;hb=cbc42199a0c836a467c828b9e917b6a9fbe8915b;hp=2a03d2dc7d3158614dbbef8b0b437ab981b39da8;hpb=0f24b13ea03a7226bd7b9f0d84f4deee8bea0736;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/WebRequest.php b/includes/WebRequest.php index 2a03d2dc7d..6593e49d8a 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -275,8 +275,18 @@ class WebRequest { public static function getRequestId() { // This method is called from various error handlers and should be kept simple. - if ( !self::$reqId ) { - self::$reqId = $_SERVER['UNIQUE_ID'] ?? wfRandomString( 24 ); + if ( self::$reqId ) { + return self::$reqId; + } + + global $wgAllowExternalReqID; + + self::$reqId = $_SERVER['UNIQUE_ID'] ?? wfRandomString( 24 ); + if ( $wgAllowExternalReqID ) { + $id = RequestContext::getMain()->getRequest()->getHeader( 'X-Request-Id' ); + if ( $id ) { + self::$reqId = $id; + } } return self::$reqId; @@ -849,12 +859,19 @@ class WebRequest { * in HTML or other output. * * If $wgServer is protocol-relative, this will return a fully - * qualified URL with the protocol that was used for this request. + * qualified URL with the protocol of this request object. * * @return string */ public function getFullRequestURL() { - return wfGetServerUrl( PROTO_CURRENT ) . $this->getRequestURL(); + // Pass an explicit PROTO constant instead of PROTO_CURRENT so that we + // do not rely on state from the global $wgRequest object (which it would, + // via wfGetServerUrl/wfExpandUrl/$wgRequest->protocol). + if ( $this->getProtocol() === 'http' ) { + return wfGetServerUrl( PROTO_HTTP ) . $this->getRequestURL(); + } else { + return wfGetServerUrl( PROTO_HTTPS ) . $this->getRequestURL(); + } } /** @@ -1123,7 +1140,7 @@ HTML; /** * Parse the Accept-Language header sent by the client into an array * - * @return array Array( languageCode => q-value ) sorted by q-value in + * @return array [ languageCode => q-value ] sorted by q-value in * descending order then appearing time in the header in ascending order. * May contain the "language" '*', which applies to languages other than those explicitly listed. * This is aligned with rfc2616 section 14.4