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

Allow custom User-Agent to be specified for outgoing requests #4810

Conversation

konidev20
Copy link
Contributor

@konidev20 konidev20 commented May 19, 2024

What does this PR change? What problem does it solve?

Allow custom User-Agent to be specified for outgoing requests. ~~Restic currently uses the default User-Agent of the net/http package for all outgoing HTTP requests. ~~

The customisable User-Agent can be used to differentiate between Restic HTTP client and other golang http clients at a Frontend Gateway or Load Balancer.

Added a global option flag --http-user-agent. This will wrap the default http.RoundTripper to set the custom User-Agent header. If the flag is not specified, the default User-Agent from the net/http package is used for outgoing requests.

Was the change previously discussed in an issue or on the forum?

#4768

Checklist

  • I have read the contribution guidelines.
  • I have enabled maintainer edits.
  • I have added tests for all code changes.
  • I have added documentation for relevant changes (in the manual).
  • There's a new file in changelog/unreleased/ that describes the changes for our users (see template).
  • I have run gofmt on the code in all commits.
  • All commit messages are formatted in the same style as the other commits in the repo.
  • I'm done! This pull request is ready for review.

@konidev20 konidev20 force-pushed the fix-gh-4768-add-custom-user-agent-for-http-client branch from 88edf29 to 7d54e2b Compare May 19, 2024 09:35
@konidev20 konidev20 marked this pull request as draft May 20, 2024 20:35
@konidev20 konidev20 marked this pull request as ready for review May 21, 2024 20:29
cmd/restic/global.go Outdated Show resolved Hide resolved
cmd/restic/global.go Outdated Show resolved Hide resolved
internal/backend/customuseragent_roundtripper.go Outdated Show resolved Hide resolved
changelog/unreleased/issue-4768 Outdated Show resolved Hide resolved
doc/manual_rest.rst Outdated Show resolved Hide resolved
@konidev20 konidev20 force-pushed the fix-gh-4768-add-custom-user-agent-for-http-client branch from edd3b41 to 480a813 Compare May 26, 2024 22:04
@MichaelEischer MichaelEischer force-pushed the fix-gh-4768-add-custom-user-agent-for-http-client branch from 480a813 to 5d7f81f Compare May 30, 2024 13:37
@MichaelEischer MichaelEischer force-pushed the fix-gh-4768-add-custom-user-agent-for-http-client branch from 5d7f81f to de7b418 Compare May 30, 2024 13:38
Copy link
Member

@MichaelEischer MichaelEischer left a comment

Choose a reason for hiding this comment

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

LGTM. I've rebased the PR to fix the merge conflict in the docs.

@MichaelEischer MichaelEischer added this pull request to the merge queue May 30, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 30, 2024
@MichaelEischer MichaelEischer added this pull request to the merge queue May 30, 2024
Merged via the queue into restic:master with commit 2280fbf May 30, 2024
13 checks passed
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