Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/controller/DiffusionServeController.php
Show All 36 Lines | public function getGitLFSToken() { | ||||||||||||||
return $this->gitLFSToken; | return $this->gitLFSToken; | ||||||||||||||
} | } | ||||||||||||||
public function isVCSRequest(AphrontRequest $request) { | public function isVCSRequest(AphrontRequest $request) { | ||||||||||||||
$identifier = $this->getRepositoryIdentifierFromRequest($request); | $identifier = $this->getRepositoryIdentifierFromRequest($request); | ||||||||||||||
if ($identifier === null) { | if ($identifier === null) { | ||||||||||||||
return null; | return null; | ||||||||||||||
} | } | ||||||||||||||
$content_type = $request->getHTTPHeader('Content-Type'); | $content_type = $request->getHTTPHeader('Content-Type', ''); | ||||||||||||||
$user_agent = idx($_SERVER, 'HTTP_USER_AGENT'); | $user_agent = idx($_SERVER, 'HTTP_USER_AGENT', ''); | ||||||||||||||
valerio.bozzolan: ⚠ Here I suggest to set a default empty string
Since, interestingly, removing the user agent… | |||||||||||||||
Not Done Inline Actions
To avoid null, interestingly there is a $default parameter valerio.bozzolan: To avoid null, interestingly there is a `$default` parameter | |||||||||||||||
$request_type = $request->getHTTPHeader('X-Phabricator-Request-Type'); | $request_type = $request->getHTTPHeader('X-Phabricator-Request-Type'); | ||||||||||||||
Not Done Inline Actions✅ I verified the above line and I can confirm that the getHTTPHeader() has a default parameter to null and also idx(). valerio.bozzolan: ✅ I verified the above line and I can confirm that the `getHTTPHeader()` has a default… | |||||||||||||||
// This may have a "charset" suffix, so only match the prefix. | // This may have a "charset" suffix, so only match the prefix. | ||||||||||||||
$lfs_pattern = '(^application/vnd\\.git-lfs\\+json(;|\z))'; | $lfs_pattern = '(^application/vnd\\.git-lfs\\+json(;|\z))'; | ||||||||||||||
$vcs = null; | $vcs = null; | ||||||||||||||
if ($request->getExists('service')) { | if ($request->getExists('service')) { | ||||||||||||||
$service = $request->getStr('service'); | $service = $request->getStr('service'); | ||||||||||||||
// We get this initially for `info/refs`. | // We get this initially for `info/refs`. | ||||||||||||||
▲ Show 20 Lines • Show All 1,247 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0
⚠ Here I suggest to set a default empty string
Since, interestingly, removing the user agent in my browser caused our well known server crash in PHP 8.1
Here how I tested this:
https://superuser.com/q/692530/390314