Skip to content

Stop using HTTPRequest for package update server requests#5973

Merged
BurntimeX merged 1 commit into
masterfrom
stop-using-http-request2
Aug 12, 2024
Merged

Stop using HTTPRequest for package update server requests#5973
BurntimeX merged 1 commit into
masterfrom
stop-using-http-request2

Conversation

@BurntimeX
Copy link
Copy Markdown
Member

No description provided.

@BurntimeX BurntimeX requested a review from dtdesign August 9, 2024 12:44
@BurntimeX BurntimeX merged commit 998bd9f into master Aug 12, 2024
@BurntimeX BurntimeX deleted the stop-using-http-request2 branch August 12, 2024 12:15
Comment on lines +236 to +237
if (!empty($response->getHeaders()['etag'])) {
$metaData['list']['etag'] = \reset($response->getHeaders()['etag']);
Copy link
Copy Markdown
Member

@TimWolla TimWolla Aug 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Careful here (and in the other places where getHeaders() is used): The casing depends on the casing returned by the server [1], which is not necessarily lowercased [2].

The correct solution is $response->getHeaderLine('etag') (returns string, duplicate headers are comma-separated) or $response->getHeader('etag') (returns array) and possibly $response->hasHeader('etag').

[1]

/** @var string[][] Map of all registered headers, as original name => array of values */
private $headers = [];

[2] HTTP/2 guarantees lowercase and recent HAProxy versions emit lowercase by default even with HTTP/1.1, but other web servers will tend to use an uppercase character after every hyphen or so.

BurntimeX added a commit that referenced this pull request Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants