-
Notifications
You must be signed in to change notification settings - Fork 552
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
feat: set user agent in webdav requests #2284
base: main
Are you sure you want to change the base?
Conversation
src/cache/webdav.rs
Outdated
|
||
let op = Operator::new(builder)? | ||
.layer(LoggingLayer::default()) | ||
.finish(); | ||
Ok(op) | ||
} | ||
} | ||
|
||
/// Set the user agent (helps with monitoring on the server side) | ||
fn set_user_agent() -> HttpClient { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recall that we already have similar code that builds an HTTP client. Would you like to check the codebase again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right! I've removed the copied code and referenced set_user_agent
from src/cache/s3.rs
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Others look good to me. Thank you @lukevmorris for working for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @lukevmorris for working on this!
Could you please document this ? https://github.com/mozilla/sccache/?tab=readme-ov-file |
thanks. (your patch is conflicting) |
@sylvestre not a dumb question at all. I had considered that but wasn't sure what scope of change would be appreciated. I can try and make that change if you'd like? |
yeah, i think it makes sense :) |
Ok I ended up moving Let me know what you think! |
facepalm I didn't check in the new file. Hopefully that addresses the test failures. |
docs/Azure.md
Outdated
the container for you - you'll need to do that yourself. | ||
|
||
You can also define a prefix that will be prepended to the keys of all cache objects created and read within the container, effectively creating a scope. To do that use the `SCCACHE_AZURE_KEY_PREFIX` environment variable. This can be useful when sharing a bucket with another application. | ||
|
||
Requests sent to Azure Blob Storage will have a user agent header indicating the current sccache version, e.g. `sccache/0.8.2`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think we should duplicate it
just declare it once :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok sorry! I centralized it in one section at the bottom of the README. What do you think?
I have a WebDAV server that I use as a backend remote cache for multiple build tools. Many of these build tools (e.g.
bazel
,gradle
) differentiate themselves in their user agent header, whereassccache
does not. This PR configures the WebdavCache service with an http client preconfigured with a user agent header like so:sccache/0.8.2
. These changes are nearly identical to those in #2137. Happy to make whatever changes you feel may be necessary. Thanks!