File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -114,10 +114,19 @@ mod download {
114
114
) ;
115
115
println ! ( "url:{}" , url) ;
116
116
let mut downloaded_bytes = Vec :: new ( ) ;
117
- let resp = ureq:: get ( & url) . call ( ) . unwrap ( ) ;
118
- assert_eq ! ( resp. status( ) , 200 , "url {} didn't return 200" , url) ;
119
117
120
- let _size = resp
118
+ let http_proxy = std:: env:: var ( "HTTPS_PROXY" ) . or_else ( |_| std:: env:: var ( "HTTP_PROXY" ) ) ;
119
+ let agent = if let Ok ( proxy) = http_proxy {
120
+ let proxy = ureq:: Proxy :: new ( proxy) . unwrap ( ) ;
121
+ ureq:: AgentBuilder :: new ( ) . proxy ( proxy) . build ( )
122
+ } else {
123
+ ureq:: AgentBuilder :: new ( ) . build ( )
124
+ } ;
125
+
126
+ let _size = agent
127
+ . get ( & url)
128
+ . call ( )
129
+ . unwrap ( )
121
130
. into_reader ( )
122
131
. read_to_end ( & mut downloaded_bytes)
123
132
. unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments