From a8916a094d4abc01654fc0a34e3d6ed74b74686f Mon Sep 17 00:00:00 2001 From: William Budington Date: Thu, 28 Mar 2024 20:17:37 -0700 Subject: [PATCH] Remove reqwest dependency and comment out reqwest-dependant code, leaving the option to return to it --- gpapi/Cargo.toml | 2 +- gpapi/src/lib.rs | 106 +++++++++++++++++++++++------------------------ 2 files changed, 54 insertions(+), 54 deletions(-) diff --git a/gpapi/Cargo.toml b/gpapi/Cargo.toml index 7eae874..3bdcdc1 100644 --- a/gpapi/Cargo.toml +++ b/gpapi/Cargo.toml @@ -11,7 +11,7 @@ repository = "https://github.com/EFForg/rs-google-play/tree/master/gpapi" [dependencies] prost = "0.12" -reqwest = { version = "0.12", features = ["stream"] } +#reqwest = "0.12" bytes = "1" hyper = { version = "0.14", features = ["full"] } hyper-tls = "0.5" diff --git a/gpapi/src/lib.rs b/gpapi/src/lib.rs index 43c2d87..f1a3087 100644 --- a/gpapi/src/lib.rs +++ b/gpapi/src/lib.rs @@ -71,8 +71,8 @@ use hyper::header::{HeaderName as HyperHeaderName, HeaderValue as HyperHeaderVal use hyper::{Body, Client, Method, Request}; use hyper_tls::HttpsConnector; use prost::Message; -use reqwest::header::{HeaderMap, HeaderValue, HeaderName}; -use reqwest::Url; +//use reqwest::header::{HeaderMap, HeaderValue, HeaderName}; +//use reqwest::Url; use tokio_dl_stream_to_disk::AsyncDownload; use crate::error::{Error as GpapiError, ErrorKind as GpapiErrorKind}; @@ -114,7 +114,7 @@ pub struct Gpapi { tos_token: Option, dfe_cookie: Option, gsf_id: Option, - client: Box, + //client: Box, hyper_client: Box>>, } @@ -142,7 +142,7 @@ impl Gpapi { tos_token: None, dfe_cookie: None, gsf_id: None, - client: Box::new(reqwest::Client::new()), + //client: Box::new(reqwest::Client::new()), hyper_client: Box::new(hyper_client), } } @@ -874,55 +874,55 @@ impl Gpapi { Ok(body_bytes) } - async fn execute_request_helper_reqwest( - &self, - endpoint: &str, - query: Option>, - msg: Option<&[u8]>, - headers: HashMap<&str, String>, - fdfe: bool, - ) -> Result> { - let mut url = if fdfe { - Url::parse(&format!( - "{}/fdfe/{}", - consts::defaults::DEFAULT_BASE_URL, - endpoint - ))? - } else { - Url::parse(&format!( - "{}/{}", - consts::defaults::DEFAULT_BASE_URL, - endpoint - ))? - }; - - if let Some(query) = query { - let mut queries = url.query_pairs_mut(); - for (key, val) in query { - queries.append_pair(key, &val); - } - } - - let mut reqwest_headers = HeaderMap::new(); - for (key, val) in headers { - reqwest_headers.insert(HeaderName::from_bytes(key.as_bytes())?, HeaderValue::from_str(&val)?); - } - - let res = { - if let Some(msg) = msg { - (*self.client) - .post(url) - .headers(reqwest_headers) - .body(msg.to_owned()) - .send() - .await? - } else { - (*self.client).get(url).headers(reqwest_headers).send().await? - } - }; - - Ok(res.bytes().await?) - } + //async fn execute_request_helper_reqwest( + // &self, + // endpoint: &str, + // query: Option>, + // msg: Option<&[u8]>, + // headers: HashMap<&str, String>, + // fdfe: bool, + //) -> Result> { + // let mut url = if fdfe { + // Url::parse(&format!( + // "{}/fdfe/{}", + // consts::defaults::DEFAULT_BASE_URL, + // endpoint + // ))? + // } else { + // Url::parse(&format!( + // "{}/{}", + // consts::defaults::DEFAULT_BASE_URL, + // endpoint + // ))? + // }; + + // if let Some(query) = query { + // let mut queries = url.query_pairs_mut(); + // for (key, val) in query { + // queries.append_pair(key, &val); + // } + // } + + // let mut reqwest_headers = HeaderMap::new(); + // for (key, val) in headers { + // reqwest_headers.insert(HeaderName::from_bytes(key.as_bytes())?, HeaderValue::from_str(&val)?); + // } + + // let res = { + // if let Some(msg) = msg { + // (*self.client) + // .post(url) + // .headers(reqwest_headers) + // .body(msg.to_owned()) + // .send() + // .await? + // } else { + // (*self.client).get(url).headers(reqwest_headers).send().await? + // } + // }; + + // Ok(res.bytes().await?) + //} }