-
Notifications
You must be signed in to change notification settings - Fork 559
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: set user agent in webdav requests (#2284)
- Loading branch information
1 parent
a1c33d4
commit 5a65dc5
Showing
12 changed files
with
58 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
# WebDAV | ||
|
||
Set `SCCACHE_WEBDAV_ENDPOINT` to a webdav service endpoint to store cache in a webdav service. Set `SCCACHE_WEBDAV_KEY_PREFIX` to specify the key prefix of cache. | ||
|
||
The webdav cache is compatible with: | ||
Users can configure sccache to cache incremental build artifacts in a remote WebDAV service. | ||
The following services all expose a WebDAV interface and can be used as a backend: | ||
|
||
- [Ccache HTTP storage backend](https://ccache.dev/manual/4.7.4.html#_http_storage_backend) | ||
- [Bazel Remote Caching](https://bazel.build/remote/caching). | ||
- [Gradle Build Cache](https://docs.gradle.org/current/userguide/build_cache.html) | ||
|
||
Users can set `SCCACHE_WEBDAV_ENDPOINT` to those services directly. | ||
Set `SCCACHE_WEBDAV_ENDPOINT` to an appropriate webdav service endpoint to enable remote caching. | ||
Set `SCCACHE_WEBDAV_KEY_PREFIX` to specify the key prefix of cache. | ||
|
||
## Credentials | ||
|
||
Sccache is able to load credentials from the following sources: | ||
|
||
- Set `SCCACHE_WEBDAV_USERNAME`/`SCCACHE_WEBDAV_PASSWORD` to specify the username/password pair for basic authentication. | ||
- Set `SCCACHE_WEBDAV_TOKEN` to specify the token value for bearer token authentication. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use opendal::raw::HttpClient; | ||
use reqwest::ClientBuilder; | ||
|
||
/// Set the user agent (helps with monitoring on the server side) | ||
pub fn set_user_agent() -> HttpClient { | ||
let user_agent = format!("{}/{}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION")); | ||
let client = ClientBuilder::new().user_agent(user_agent).build().unwrap(); | ||
HttpClient::with(client) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters