Overhaul the usage of libcurl-impersonate (#4535)

libcurl-impersonate was not being used properly, as the code was
overriding the headers set by it to prevent detection.

- update the libcurl-impersonate to an actively managed lexiforest
  fork
- impersonate Chrome 131
- move the defaultHttpHeaders to http.php, where it belongs
- only set defaultHttpHeaders if curl-impersonate is not detected
- make useragent ini setting optional and disabled by default
- add necessary documentation updates
This commit is contained in:
Dawid Wróbel 2025-05-17 20:18:36 +02:00 committed by GitHub
parent 0f77d3ae0a
commit b7c04f8587
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 45 additions and 30 deletions

View file

@ -64,19 +64,7 @@ function getContents(
}
}
// Snagged from https://github.com/lwthiker/curl-impersonate/blob/main/firefox/curl_ff102
$defaultHttpHeaders = [
'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8',
'Accept-Language' => 'en-US,en;q=0.5',
'Upgrade-Insecure-Requests' => '1',
'Sec-Fetch-Dest' => 'document',
'Sec-Fetch-Mode' => 'navigate',
'Sec-Fetch-Site' => 'none',
'Sec-Fetch-User' => '?1',
'TE' => 'trailers',
];
$config['headers'] = array_merge($defaultHttpHeaders, $httpHeadersNormalized);
$config['headers'] = $httpHeadersNormalized;
$maxFileSize = Configuration::getConfig('http', 'max_filesize');
if ($maxFileSize) {