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

Set default user agent for external requests #952

Merged
merged 1 commit into from Feb 19, 2020
Merged

Set default user agent for external requests #952

merged 1 commit into from Feb 19, 2020

Conversation

lukehsiao
Copy link
Contributor

@lukehsiao lukehsiao commented Feb 17, 2020

Many servers will return errors (e.g. 400/403) to requests that do not
set a User-Agent header. This results in issues in both the link_checker
and load_data components. With the link_checker these are false positive
dead links. In load_data, remote data fails to be fetched. To mitigate
this issue, this sets a default User-Agent of

$CARGO_PKG_NAME/$CARGO_PKG_VERSION

Note that the root cause of this regression from zola v0.9.0 is that
reqwest 0.10 changed their default behavior and no longer sets a
User-Agent by default:

https://github.com/seanmonstar/reqwest/pull/751

Fixes #950.

IMPORTANT: Please do not create a Pull Request adding a new feature without discussing it first.

The place to discuss new features is the forum: https://zola.discourse.group/
If you want to add a new feature, please open a thread there first in the feature requests section.

Sanity check:

  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Code changes

(Delete or ignore this section for documentation changes)

  • Are you doing the PR on the next branch?

If the change is a new feature or adding to/changing an existing one:

  • Have you created/updated the relevant documentation page(s)?

This change is not visible to the end user, and doesn't have corresponding docs.

@lukehsiao lukehsiao requested a review from Keats February 17, 2020 19:15
Many servers will return errors (e.g. 400/403) to requests that do not
set a User-Agent header. This results in issues in both the link_checker
and load_data components. With the link_checker these are false positive
dead links. In load_data, remote data fails to be fetched. To mitigate
this issue, this sets a default User-Agent of

    $CARGO_PKG_NAME/$CARGO_PKG_VERSION

Note that the root cause of this regression from zola v0.9.0 is that
reqwest 0.10 changed their default behavior and no longer sets a
User-Agent by default:

    seanmonstar/reqwest#751

Fixes #950.
@lukehsiao lukehsiao changed the title link_checker: set default user agent Set default user agent for external requests Feb 18, 2020
@Keats Keats changed the base branch from master to next February 19, 2020 09:06
@Keats Keats merged commit a3223eb into getzola:next Feb 19, 2020
@Keats
Copy link
Collaborator

Keats commented Feb 19, 2020

Thanks!

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.

Set user agent to avoid errors in link_checker and load_data
2 participants