File tree 1 file changed +7
-1
lines changed
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,9 @@ const JSON_HTTP_CTYPE: &str = "Content-Type: application/json; charset=utf-8";
96
96
/// Program version tag: `"<major>.<minor>.<patch>"`
97
97
const VERSION : & str = env ! ( "CARGO_PKG_VERSION" ) ;
98
98
99
+ /// HTTP client User Agent string
100
+ const HTTP_USER_AGENT : & str = concat ! ( "crates-io-proxy/" , env!( "CARGO_PKG_VERSION" ) ) ;
101
+
99
102
/// Proxy server configuration
100
103
#[ derive( Debug , Clone ) ]
101
104
struct ProxyConfig {
@@ -135,7 +138,10 @@ struct IndexResponse {
135
138
/// The global agent instance is required to use HTTP request pipelining.
136
139
fn ureq_agent ( ) -> ureq:: Agent {
137
140
static AGENT : OnceLock < ureq:: Agent > = OnceLock :: new ( ) ;
138
- AGENT . get_or_init ( ureq:: agent) . clone ( )
141
+
142
+ AGENT
143
+ . get_or_init ( || ureq:: builder ( ) . user_agent ( HTTP_USER_AGENT ) . build ( ) )
144
+ . clone ( )
139
145
}
140
146
141
147
/// Downloads the crate file from the upstream download server
You can’t perform that action at this time.
0 commit comments