build(deps): bump isahc from 0.9.14 to 1.0.2

Bumps [isahc](https://github.com/sagebind/isahc) from 0.9.14 to 1.0.2.
- [Release notes](https://github.com/sagebind/isahc/releases)
- [Commits](https://github.com/sagebind/isahc/compare/0.9.14...1.0.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
This commit is contained in:
dependabot-preview[bot] 2021-01-01 19:36:21 +00:00 committed by Mike Welsh
parent 49a69c8109
commit 54367aafa0
4 changed files with 15 additions and 19 deletions

10
Cargo.lock generated
View File

@ -1227,12 +1227,13 @@ dependencies = [
[[package]]
name = "flume"
version = "0.9.2"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bebadab126f8120d410b677ed95eee4ba6eb7c6dd8e34a5ec88a08050e26132"
checksum = "0362ef9c4c1fa854ff95b4cb78045a86e810d804dc04937961988b45427104a9"
dependencies = [
"futures-core",
"futures-sink",
"pin-project 1.0.2",
"spinning_top",
]
@ -1808,11 +1809,10 @@ dependencies = [
[[package]]
name = "isahc"
version = "0.9.14"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2948a0ce43e2c2ef11d7edf6816508998d99e13badd1150be0914205df9388a"
checksum = "990caf8da378f0127ade48d4db60ed19f9e7dd3094a4278ef51cf3d56982e28b"
dependencies = [
"bytes",
"crossbeam-utils",
"curl",
"curl-sys",

View File

@ -23,7 +23,7 @@ webbrowser = "0.5.5"
url = "2.2.0"
clipboard = "0.5.0"
dirs = "3.0"
isahc = "0.9.14"
isahc = "1.0.2"
tinyfiledialogs = {git ="https://github.com/jdm/tinyfiledialogs-rs", rev="1a235d1"}
[target.'cfg(windows)'.dependencies]

View File

@ -13,8 +13,7 @@ mod ui;
use crate::custom_event::RuffleEvent;
use crate::executor::GlutinAsyncExecutor;
use clap::Clap;
use isahc::config::RedirectPolicy;
use isahc::prelude::*;
use isahc::{config::RedirectPolicy, prelude::*, HttpClient};
use ruffle_core::{
backend::audio::{AudioBackend, NullAudioBackend},
Player,

View File

@ -1,8 +1,7 @@
//! Navigator backend for web
use crate::custom_event::RuffleEvent;
use isahc::config::RedirectPolicy;
use isahc::prelude::*;
use isahc::{config::RedirectPolicy, prelude::*, AsyncReadResponseExt, HttpClient, Request};
use ruffle_core::backend::navigator::{
NavigationMethod, NavigatorBackend, OwnedFuture, RequestOptions,
};
@ -10,7 +9,6 @@ use ruffle_core::indexmap::IndexMap;
use ruffle_core::loader::Error;
use std::borrow::Cow;
use std::fs;
use std::io::Read;
use std::rc::Rc;
use std::sync::mpsc::Sender;
use std::time::{Duration, Instant};
@ -144,12 +142,17 @@ impl NavigatorBackend for ExternalNavigatorBackend {
.body(body_data)
.map_err(|e| Error::FetchError(e.to_string()))?;
let response = client
let mut response = client
.send_async(body)
.await
.map_err(|e| Error::FetchError(e.to_string()))?;
response_to_bytes(response).map_err(|e| Error::FetchError(e.to_string()))
let mut buffer = vec![];
response
.copy_to(&mut buffer)
.await
.map_err(|e| Error::FetchError(e.to_string()))?;
Ok(buffer)
}),
}
}
@ -184,9 +187,3 @@ impl NavigatorBackend for ExternalNavigatorBackend {
url
}
}
fn response_to_bytes(res: Response<Body>) -> Result<Vec<u8>, std::io::Error> {
let mut buffer: Vec<u8> = Vec::new();
res.into_body().read_to_end(&mut buffer)?;
Ok(buffer)
}