diff --git a/s3/bin/simple_crud.rs b/s3/bin/simple_crud.rs index 83902ff..9482fe0 100644 --- a/s3/bin/simple_crud.rs +++ b/s3/bin/simple_crud.rs @@ -1,6 +1,7 @@ extern crate s3; use std::str; +use std::time; use std::ops::Range; use s3::bucket::Bucket; @@ -101,7 +102,7 @@ pub fn main() -> Result<(), S3Error> { for backend in vec![aws] { println!("Running {}", backend.name); // Create Bucket in REGION for BUCKET - let bucket = Bucket::new_with_path_style(&backend.bucket, backend.region, backend.credentials)?; + let bucket = Bucket::new_with_path_style(&backend.bucket, backend.region, time::Duration::from_secs(5),backend.credentials)?; // List out contents of directory let results = rt.block_on(bucket.list("".to_string(), None)).unwrap(); diff --git a/s3/bin/simple_read.rs b/s3/bin/simple_read.rs index aaa2c3f..0ff23c3 100644 --- a/s3/bin/simple_read.rs +++ b/s3/bin/simple_read.rs @@ -1,6 +1,6 @@ extern crate s3; -use std::str; +use std::{str, time}; use std::ops::Range; use s3::bucket::Bucket; @@ -74,7 +74,7 @@ pub fn main() -> Result<(), S3Error> { for backend in vec![aws] { println!("Running {}", backend.name); // Create Bucket in REGION for BUCKET - let bucket = Bucket::new_with_path_style(&backend.bucket, backend.region, backend.credentials)?; + let bucket = Bucket::new_with_path_style(&backend.bucket, backend.region,time::Duration::from_secs(5), backend.credentials)?; // [3052000608..3052000640, 3052000512..3052000544, 3052000544..3052000576, 3052000576..3052000608, 3052000640..3052000672, 3052000672..3052000704, 3052000704..3052000736, 3052000736..3052000768] let mut ranges = Vec::new(); diff --git a/s3/src/bucket.rs b/s3/src/bucket.rs index 1d542f7..d885112 100644 --- a/s3/src/bucket.rs +++ b/s3/src/bucket.rs @@ -1444,6 +1444,7 @@ mod test { Bucket::new( "rust-s3-test", "eu-central-1".parse().unwrap(), + std::time::Duration::from_secs(5), test_aws_credentials(), ) .unwrap() @@ -1453,6 +1454,7 @@ mod test { Bucket::new( "rust-s3", "wa-eu-central-1".parse().unwrap(), + std::time::Duration::from_secs(5), test_wasabi_credentials(), ) .unwrap() @@ -1465,6 +1467,7 @@ mod test { region: "us-east1".to_owned(), endpoint: "https://storage.googleapis.com".to_owned(), }, + std::time::Duration::from_secs(5), test_gc_credentials(), ) .unwrap() @@ -1720,6 +1723,7 @@ mod test { let response = Bucket::create( &uuid::Uuid::new_v4().to_string(), "us-east-1".parse().unwrap(), + std::time::Duration::from_secs(5), test_aws_credentials(), config, ) @@ -1748,6 +1752,7 @@ mod test { let response = Bucket::create( &uuid::Uuid::new_v4().to_string(), "eu-central-1".parse().unwrap(), + std::time::Duration::from_secs(5), test_aws_credentials(), config, ) @@ -1776,6 +1781,7 @@ mod test { let response = Bucket::create( &uuid::Uuid::new_v4().to_string(), "eu-central-1".parse().unwrap(), + std::time::Duration::from_secs(5), test_aws_credentials(), config, ) diff --git a/s3/src/multipart/mod.rs b/s3/src/multipart/mod.rs index d6b84f3..2c69f65 100644 --- a/s3/src/multipart/mod.rs +++ b/s3/src/multipart/mod.rs @@ -204,15 +204,15 @@ fn issue_104() { fn issue_114() { // ::init_log(); - fn consume_all(mut rdr: R) { - loop { - let consume = rdr.fill_buf().unwrap().len(); - if consume == 0 { - return; - } - rdr.consume(consume); - } - } + // fn consume_all(mut rdr: R) { + // loop { + // let consume = rdr.fill_buf().unwrap().len(); + // if consume == 0 { + // return; + // } + // rdr.consume(consume); + // } + // } use std::io::Cursor; diff --git a/s3/src/request.rs b/s3/src/request.rs index 5c7b6ba..283e805 100644 --- a/s3/src/request.rs +++ b/s3/src/request.rs @@ -4,7 +4,7 @@ extern crate md5; use std::io::{Write, Read}; use std::ops::Range; use log::warn; - +use std::time; use chrono::{DateTime, Utc}; use maybe_async::maybe_async; use reqwest::header::{HeaderMap, HeaderName, HeaderValue}; @@ -289,7 +289,7 @@ mod tests { #[test] fn url_uses_https_by_default() -> Result<()> { let region = "custom-region".parse()?; - let bucket = Bucket::new("my-first-bucket", region, fake_credentials())?; + let bucket = Bucket::new("my-first-bucket", region, std::time::Duration::from_secs(5),fake_credentials())?; let path = "/my-first/path"; let request = Reqwest::new(&bucket, path, Command::GetObject); @@ -305,7 +305,7 @@ mod tests { #[test] fn url_uses_https_by_default_path_style() -> Result<()> { let region = "custom-region".parse()?; - let bucket = Bucket::new_with_path_style("my-first-bucket", region, fake_credentials())?; + let bucket = Bucket::new_with_path_style("my-first-bucket", region, std::time::Duration::from_secs(5),fake_credentials())?; let path = "/my-first/path"; let request = Reqwest::new(&bucket, path, Command::GetObject); @@ -321,7 +321,7 @@ mod tests { #[test] fn url_uses_scheme_from_custom_region_if_defined() -> Result<()> { let region = "http://custom-region".parse()?; - let bucket = Bucket::new("my-second-bucket", region, fake_credentials())?; + let bucket = Bucket::new("my-second-bucket", region, std::time::Duration::from_secs(5),fake_credentials())?; let path = "/my-second/path"; let request = Reqwest::new(&bucket, path, Command::GetObject); @@ -336,7 +336,7 @@ mod tests { #[test] fn url_uses_scheme_from_custom_region_if_defined_with_path_style() -> Result<()> { let region = "http://custom-region".parse()?; - let bucket = Bucket::new_with_path_style("my-second-bucket", region, fake_credentials())?; + let bucket = Bucket::new_with_path_style("my-second-bucket", region, std::time::Duration::from_secs(5),fake_credentials())?; let path = "/my-second/path"; let request = Reqwest::new(&bucket, path, Command::GetObject); @@ -352,7 +352,7 @@ mod tests { #[test] fn test_get_object_range_header() -> Result<()> { let region = "http://custom-region".parse()?; - let bucket = Bucket::new_with_path_style("my-second-bucket", region, fake_credentials())?; + let bucket = Bucket::new_with_path_style("my-second-bucket", region, std::time::Duration::from_secs(5),fake_credentials())?; let path = "/my-second/path"; let request = Reqwest::new(