Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix parsing of HTTP Links #729

Merged
merged 1 commit into from May 18, 2022
Merged

Conversation

Alkarex
Copy link
Contributor

@Alkarex Alkarex commented Apr 25, 2022

Before, SimplePie was not able to parse an HTTP header such as:

Link: <https://pubsubhubbub.appspot.com>; rel="hub", <https://pubsubhubbub.superfeedr.com>; rel=hub, <https://websubhub.com/hub>; rel="hub"

The new regex complies with https://datatracker.ietf.org/doc/html/rfc8288

See also https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link

Downstream: FreshRSS/FreshRSS#4283

Before, SimplePie was not able to parse an HTTP header such as:

```
Link: <https://pubsubhubbub.appspot.com>; rel="hub", <https://pubsubhubbub.superfeedr.com>; rel=hub, <https://websubhub.com/hub>; rel="hub"
```

The new regex complies with https://datatracker.ietf.org/doc/html/rfc8288

See also https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link

Downstream: FreshRSS/FreshRSS#4283
if (!empty($matches)) {
return $matches;
// https://datatracker.ietf.org/doc/html/rfc8288
if (is_string($link_headers) &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Can $this->data['headers']['link'] be anything other than array or string?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I do not believe so. And this PR does not change the assumptions (there was already a case for array and string before).

Copy link
Contributor

Choose a reason for hiding this comment

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

In that case, is not is_string($link_headers) redundant?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe, but it is not something that is currently enforced (e.g. through a type), and I have not checked in details

@Art4 Art4 mentioned this pull request May 17, 2022
14 tasks
@mblaney
Copy link
Member

mblaney commented May 18, 2022

thanks @Alkarex

@mblaney mblaney merged commit 3116185 into simplepie:master May 18, 2022
@Alkarex Alkarex deleted the fix-HTTP-links branch May 18, 2022 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants