-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Samuel Schwanzer
committed
Aug 29, 2024
1 parent
a1e9026
commit a0dc476
Showing
7 changed files
with
72 additions
and
15 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
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,45 @@ | ||
use std::env; | ||
use reqwest::blocking::ClientBuilder; | ||
use reqwest::Proxy; | ||
|
||
pub fn get_sync_client() -> ClientBuilder { | ||
let proxy_val = env::var("PODFETCH_PROXY"); | ||
|
||
|
||
|
||
let mut res = ClientBuilder::new(); | ||
|
||
if let Ok(unwrapped_proxy) = proxy_val { | ||
let proxy = Proxy::all(unwrapped_proxy); | ||
match proxy { | ||
Ok(e)=>{ | ||
res = res.proxy(e); | ||
} | ||
Err(e)=>{ | ||
log::error!("Proxy is invalid {}", e) | ||
} | ||
} | ||
} | ||
|
||
res | ||
} | ||
|
||
pub fn get_async_sync_client() -> reqwest::ClientBuilder { | ||
let proxy_val = env::var("PODFETCH_PROXY"); | ||
|
||
let mut res = reqwest::ClientBuilder::new(); | ||
|
||
if let Ok(unwrapped_proxy) = proxy_val { | ||
let proxy = Proxy::all(unwrapped_proxy); | ||
match proxy { | ||
Ok(e)=>{ | ||
res = res.proxy(e); | ||
} | ||
Err(e)=>{ | ||
log::error!("Proxy is invalid {}", e) | ||
} | ||
} | ||
} | ||
|
||
res | ||
} |