Skip to content

Commit

Permalink
Merge pull request #2269 from aarroyoc/fix-2267
Browse files Browse the repository at this point in the history
Use reqwest async and use futures::executor
  • Loading branch information
mthom committed Jan 3, 2024
2 parents 5abc72c + fac8866 commit ff01067
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ ctrlc = { version = "3.2.2", optional = true }
rustyline = { version = "12.0.0", optional = true }
native-tls = { version = "0.2.4", optional = true }
warp = { version = "=0.3.5", features = ["tls"], optional = true }
reqwest = { version = "0.11.18", features = ["blocking"], optional = true }
reqwest = { version = "0.11.18", optional = true }
tokio = { version = "1.28.2", features = ["full"] }

[target.'cfg(target_arch = "wasm32")'.dependencies]
Expand Down
10 changes: 5 additions & 5 deletions src/machine/system_calls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4288,18 +4288,18 @@ impl Machine {
let address_string = address_sink.as_str(); //to_string();
let address: Url = address_string.parse().unwrap();

let client = reqwest::blocking::Client::builder().build().unwrap();
let client = reqwest::Client::builder().build().unwrap();

// request
let mut req = reqwest::blocking::Request::new(method, address);
let mut req = reqwest::Request::new(method, address);

*req.headers_mut() = headers;
if !bytes.is_empty() {
*req.body_mut() = Some(reqwest::blocking::Body::from(bytes));
*req.body_mut() = Some(reqwest::Body::from(bytes));
}

// do it!
match client.execute(req) {
match futures::executor::block_on(client.execute(req)) {
Ok(resp) => {
// status code
let status = resp.status().as_u16();
Expand Down Expand Up @@ -4336,7 +4336,7 @@ impl Machine {
self.machine_st.registers[6]
);
// body
let reader = resp.bytes().unwrap().reader();
let reader = futures::executor::block_on(resp.bytes()).unwrap().reader();

let mut stream = Stream::from_http_stream(
AtomTable::build_with(&self.machine_st.atom_tbl, &address_string),
Expand Down

0 comments on commit ff01067

Please sign in to comment.