Skip to content

Do not download big resources when using curl#46

Open
Zegnat wants to merge 1 commit intoindieweb:mainfrom
Zegnat:limit-the-size-of-the-fetched-resource
Open

Do not download big resources when using curl#46
Zegnat wants to merge 1 commit intoindieweb:mainfrom
Zegnat:limit-the-size-of-the-fetched-resource

Conversation

@Zegnat
Copy link
Member

@Zegnat Zegnat commented Jan 24, 2026

Hopefully addresses the concerns of #45.

Note: MentionClient ignores curl errors and just silently carries on. There will not be a difference between a resource that does not advertise an endpoint or a resource that goes over the maximum file size.

curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_MAXFILESIZE, self::$_maxFilesize);

Choose a reason for hiding this comment

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

I don't expect the headers to exceed the 1MB, but for consistency, not a bad thing to put it in anyway.

Copy link
Member Author

Choose a reason for hiding this comment

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

I simply did not check if curl automatically cuts the connection after the last header, or if it continues to fetch data if a server decides to send a body on a HEAD request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants