Skip to content

Commit

Permalink
Merge pull request #49 from kpcyrd/async-chrootable
Browse files Browse the repository at this point in the history
Port to async chrootable-https
  • Loading branch information
kpcyrd committed Dec 12, 2018
2 parents d8923f4 + 3a84395 commit 8f16948
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 125 deletions.
239 changes: 119 additions & 120 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ diesel = { version = "1.0.0", features = ["sqlite"] }
diesel_migrations = { version = "1.3.0", features = ["sqlite"] }
dirs = "1.0"
url = "1.7"
chrootable-https = "0.5.0"
#chrootable-https = { path = "../chrootable-https" }
chrootable-https = "0.6"
base64 = "0.10"
kuchiki = "0.7.2"
serde_urlencoded = "0.5"
Expand Down
3 changes: 2 additions & 1 deletion src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ impl Client {

let request = request.body(body)?;

let resp = self.client.request(request)?;
let resp = self.client.request(request)
.wait_for_response()?;
info!("response: {:?}", resp);

let reply = serde_json::from_slice::<ApiResponse<T>>(&resp.body)?;
Expand Down
3 changes: 2 additions & 1 deletion src/geoip/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ pub trait Maxmind: Sized {
fn download<P: AsRef<Path>>(path: P, filter: &str, url: &str) -> Result<()> {
debug!("Downloading {:?}...", url);
let client = Client::with_system_resolver()?;
let resp = client.get(url)?;
let resp = client.get(url)
.wait_for_response()?;
debug!("Downloaded {} bytes", resp.body.len());
archive::extract(&mut &resp.body[..], filter, path)?;
Ok(())
Expand Down
3 changes: 2 additions & 1 deletion src/psl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ impl Psl {

pub fn download(path: &PathBuf, url: &str) -> Result<()> {
let client = Client::with_system_resolver()?;
let resp = client.get(url)?;
let resp = client.get(url)
.wait_for_response()?;
fs::write(path, &resp.body)?;
Ok(())
}
Expand Down
1 change: 1 addition & 0 deletions src/runtime/dns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ pub fn dns(lua: &mut hlua::Lua, state: Arc<State>) {
};

let reply = resolver.resolve(&name, options.record_type()?)
.wait_for_response()
.map_err(|e| state.set_error(e))?;

let reply = serde_json::to_value(reply)
Expand Down
3 changes: 2 additions & 1 deletion src/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ impl HttpRequest {
if let Some(timeout) = self.timeout {
http.timeout(timeout);
}
let res = http.request(req)?;
let res = http.request(req)
.wait_for_response()?;

// map result to LuaMap
let mut resp = LuaMap::new();
Expand Down

0 comments on commit 8f16948

Please sign in to comment.