Skip to content

Commit

Permalink
Merge pull request #15 from qiniu/releases/v0.1.4
Browse files Browse the repository at this point in the history
Releases/v0.1.4
  • Loading branch information
longbai authored Aug 11, 2022
2 parents c7e75c0 + 135dbf8 commit 0fe3c63
Show file tree
Hide file tree
Showing 42 changed files with 355 additions and 254 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change log

## v0.1.4

- `ObjectsManagerBuilder` / `UploadManagerBuilder``use_https` 方法也对内置的 `BucketRegionsQueryerBuilder` 生效
- `ListIter` / `ListStream` 添加 `marker` 方法,获取最近一次列举返回的位置标记

## v0.1.3

- 修复编译 `ureq` 出现 `pattern InsecureRequestHttpsOnly not covered` 的错误
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ let mut uploader: AutoUploader = upload_manager.auto_uploader();
let params = AutoUploaderObjectParams::builder()
.object_name(object_name)
.file_name(object_name)
.insert_metadata("x:fname", "123.jpg")
.insert_metadata("x:age", "20")
.insert_custom_var("fname", "123.jpg")
.insert_custom_var("age", "20")
.build();
uploader.upload_path("/home/qiniu/test.mp4", params)?;
```
Expand Down
10 changes: 5 additions & 5 deletions api-generator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "qiniu-api-generator"
version = "0.1.3"
version = "0.1.4"
authors = ["Rong Zhou <[email protected]>", "Shanghai Qiniu Information Technologies Co., Ltd."]
edition = "2021"
license = "MIT"
Expand Down Expand Up @@ -28,8 +28,8 @@ walkdir = "2.3.2"

[dev-dependencies]
serde_json = "1.0.68"
qiniu-http = { version = "0.1.3", path = "../http" }
qiniu-http-client = { version = "0.1.3", path = "../http-client" }
qiniu-upload-token = { version = "0.1.3", path = "../upload-token" }
qiniu-utils = { version = "0.1.3", path = "../utils" }
qiniu-http = { version = "0.1.4", path = "../http" }
qiniu-http-client = { version = "0.1.4", path = "../http-client" }
qiniu-upload-token = { version = "0.1.4", path = "../upload-token" }
qiniu-utils = { version = "0.1.4", path = "../utils" }
indexmap = "1.7.0"
6 changes: 3 additions & 3 deletions apis/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "qiniu-apis"
version = "0.1.3"
version = "0.1.4"
authors = ["Rong Zhou <[email protected]>", "Shanghai Qiniu Information Technologies Co., Ltd."]
edition = "2021"
rust-version = "1.60.0"
Expand All @@ -21,8 +21,8 @@ indexmap = "1.7.0"
futures = { version = "0.3.5", optional = true }
async-std = { version = "1.9.0", optional = true }

qiniu-http-client = { version = "0.1.3", path = "../http-client", default-features = false }
qiniu-utils = { version = "0.1.3", path = "../utils" }
qiniu-http-client = { version = "0.1.4", path = "../http-client", default-features = false }
qiniu-utils = { version = "0.1.4", path = "../utils" }

[dev-dependencies]
anyhow = "1.0.43"
Expand Down
6 changes: 3 additions & 3 deletions apis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,21 @@

```toml
[dependencies]
qiniu-apis = { version = "0.1.3", features = ["ureq"] }
qiniu-apis = { version = "0.1.4", features = ["ureq"] }
```

### 启用 Isahc 异步接口

```toml
[dependencies]
qiniu-apis = { version = "0.1.3", features = ["async", "isahc"] }
qiniu-apis = { version = "0.1.4", features = ["async", "isahc"] }
```

### 启用 Reqwest 异步接口

```toml
[dependencies]
qiniu-apis = { version = "0.1.3", features = ["async", "reqwest"] }
qiniu-apis = { version = "0.1.4", features = ["async", "reqwest"] }
```

### 其他功能
Expand Down
4 changes: 2 additions & 2 deletions credential/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "qiniu-credential"
version = "0.1.3"
version = "0.1.4"
authors = ["Rong Zhou <[email protected]>", "Shanghai Qiniu Information Technologies Co., Ltd."]
edition = "2021"
rust-version = "1.60.0"
Expand All @@ -24,7 +24,7 @@ assert-impl = "0.1.3"
auto_impl = "1.0.0"
futures-lite = { version = "1.12.0", optional = true }

qiniu-utils = { version = "0.1.3", path = "../utils" }
qiniu-utils = { version = "0.1.4", path = "../utils" }

[dev-dependencies]
anyhow = "1.0.44"
Expand Down
4 changes: 2 additions & 2 deletions credential/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@

```toml
[dependencies]
qiniu-credential = "0.1.3"
qiniu-credential = "0.1.4"
```

### 启用异步接口

```toml
[dependencies]
qiniu-credential = { version = "0.1.3", features = ["async"] }
qiniu-credential = { version = "0.1.4", features = ["async"] }
```

## 代码示例
Expand Down
4 changes: 2 additions & 2 deletions download-manager/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "qiniu-download-manager"
version = "0.1.3"
version = "0.1.4"
authors = ["Rong Zhou <[email protected]>", "Shanghai Qiniu Information Technologies Co., Ltd."]
edition = "2021"
rust-version = "1.60.0"
Expand All @@ -24,7 +24,7 @@ futures = { version = "0.3.5", optional = true }
async-std = { version = "1.9.0", optional = true }
smart-default = { version = "0.6.0", optional = true }

qiniu-apis = { version = "0.1.3", path = "../apis", default-features = false }
qiniu-apis = { version = "0.1.4", path = "../apis", default-features = false }

[dev-dependencies]
anyhow = "1.0.51"
Expand Down
6 changes: 3 additions & 3 deletions download-manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@

```toml
[dependencies]
qiniu-download-manager = { version = "0.1.3", features = ["ureq"] }
qiniu-download-manager = { version = "0.1.4", features = ["ureq"] }
```

### 启用 Isahc 异步接口

```toml
[dependencies]
qiniu-download-manager = { version = "0.1.3", features = ["async", "isahc"] }
qiniu-download-manager = { version = "0.1.4", features = ["async", "isahc"] }
```

### 启用 Reqwest 异步接口

```toml
[dependencies]
qiniu-download-manager = { version = "0.1.3", features = ["async", "reqwest"] }
qiniu-download-manager = { version = "0.1.4", features = ["async", "reqwest"] }
```

### 其他功能
Expand Down
4 changes: 2 additions & 2 deletions etag/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "qiniu-etag"
version = "0.1.3"
version = "0.1.4"
authors = ["Rong Zhou <[email protected]>", "Shanghai Qiniu Information Technologies Co., Ltd."]
edition = "2021"
rust-version = "1.60.0"
Expand All @@ -19,7 +19,7 @@ digest = "0.9.0"
assert-impl = "0.1.3"
futures-lite = { version = "1.12.0", optional = true }

qiniu-utils = { version = "0.1.3", path = "../utils" }
qiniu-utils = { version = "0.1.4", path = "../utils" }

[dev-dependencies]
async-std = { version = "1.9.0", features = ["attributes"] }
Expand Down
4 changes: 2 additions & 2 deletions etag/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@

```toml
[dependencies]
qiniu-etag = "0.1.3"
qiniu-etag = "0.1.4"
```

### 启用异步接口

```toml
[dependencies]
qiniu-etag = { version = "0.1.3", features = ["async"] }
qiniu-etag = { version = "0.1.4", features = ["async"] }
```

## 代码示例
Expand Down
16 changes: 8 additions & 8 deletions http-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "qiniu-http-client"
version = "0.1.3"
version = "0.1.4"
authors = ["Rong Zhou <[email protected]>", "Shanghai Qiniu Information Technologies Co., Ltd."]
edition = "2021"
rust-version = "1.60.0"
Expand Down Expand Up @@ -55,13 +55,13 @@ trust-dns-resolver = { version = "0.21.2", optional = true }
async-std-resolver = { version = "0.21.2", optional = true }
async-once-cell = { version = "0.3.0", optional = true }

qiniu-http = { version = "0.1.3", path = "../http" }
qiniu-credential = { version = "0.1.3", path = "../credential" }
qiniu-upload-token = { version = "0.1.3", path = "../upload-token" }
qiniu-reqwest = { version = "0.1.3", path = "../http-reqwest", optional = true }
qiniu-isahc = { version = "0.1.3", path = "../http-isahc", optional = true }
qiniu-ureq = { version = "0.1.3", path = "../http-ureq", optional = true }
qiniu-utils = { version = "0.1.3", path = "../utils" }
qiniu-http = { version = "0.1.4", path = "../http" }
qiniu-credential = { version = "0.1.4", path = "../credential" }
qiniu-upload-token = { version = "0.1.4", path = "../upload-token" }
qiniu-reqwest = { version = "0.1.4", path = "../http-reqwest", optional = true }
qiniu-isahc = { version = "0.1.4", path = "../http-isahc", optional = true }
qiniu-ureq = { version = "0.1.4", path = "../http-ureq", optional = true }
qiniu-utils = { version = "0.1.4", path = "../utils" }

[dev-dependencies]
async-std = { version = "1.9.0", features = ["attributes"] }
Expand Down
6 changes: 3 additions & 3 deletions http-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,21 +105,21 @@

```toml
[dependencies]
qiniu-http-client = { version = "0.1.3", features = ["ureq"] }
qiniu-http-client = { version = "0.1.4", features = ["ureq"] }
```

### 启用 Isahc 异步接口

```toml
[dependencies]
qiniu-http-client = { version = "0.1.3", features = ["async", "isahc"] }
qiniu-http-client = { version = "0.1.4", features = ["async", "isahc"] }
```

### 启用 Reqwest 异步接口

```toml
[dependencies]
qiniu-http-client = { version = "0.1.3", features = ["async", "reqwest"] }
qiniu-http-client = { version = "0.1.4", features = ["async", "reqwest"] }
```

### 其他功能
Expand Down
2 changes: 1 addition & 1 deletion http-client/src/client/authorization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub trait AuthorizationProvider: Clone + Debug + Sync + Send {
/// 该方法的异步版本为 [`Self::async_sign`]。
fn sign(&self, request: &mut SyncRequest) -> AuthorizationResult<()>;

/// 使用指定的鉴权方式对 HTTP 请求进行异步签名
/// 使用指定的鉴权方式对异步 HTTP 请求进行签名
#[cfg(feature = "async")]
#[cfg_attr(feature = "docs", doc(cfg(feature = "async")))]
fn async_sign<'a>(&'a self, request: &'a mut AsyncRequest<'_>) -> BoxFuture<'a, AuthorizationResult<()>>;
Expand Down
31 changes: 31 additions & 0 deletions http-client/src/client/call/ip_addrs.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
use super::super::super::IpAddrWithPort;
use std::fmt::{self, Display};

#[derive(Default, Debug)]
pub(super) struct IpAddrs(Vec<IpAddrWithPort>);

impl From<IpAddrs> for Vec<IpAddrWithPort> {
fn from(ips: IpAddrs) -> Self {
ips.0
}
}

impl From<Vec<IpAddrWithPort>> for IpAddrs {
fn from(ips: Vec<IpAddrWithPort>) -> Self {
Self(ips)
}
}

impl Display for IpAddrs {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "[")?;
for (i, ip) in self.0.iter().enumerate() {
if i > 0 {
write!(f, ", ")?;
}
write!(f, "{}", ip)?;
}
write!(f, "]")?;
Ok(())
}
}
21 changes: 19 additions & 2 deletions http-client/src/client/call/ip_addrs_set.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
use super::super::super::IpAddrWithPort;
use std::collections::HashSet;
use std::{
collections::HashSet,
fmt::{self, Display},
};

#[derive(Default)]
#[derive(Default, Debug)]
pub(super) struct IpAddrsSet {
set: HashSet<IpAddrWithPort>,
ordered: Vec<IpAddrWithPort>,
Expand Down Expand Up @@ -50,3 +53,17 @@ impl IpAddrsSet {
.collect()
}
}

impl Display for IpAddrsSet {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "[")?;
for (i, ip) in self.ordered.iter().enumerate() {
if i > 0 {
write!(f, ", ")?;
}
write!(f, "{}", ip)?;
}
write!(f, "]")?;
Ok(())
}
}
1 change: 1 addition & 0 deletions http-client/src/client/call/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
mod domain_or_ip_addr;
mod error;
mod ip_addrs;
mod ip_addrs_set;
mod request_call;
mod send_http_request;
Expand Down
3 changes: 3 additions & 0 deletions http-client/src/client/call/request_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use super::{
ip_addrs_set::IpAddrsSet,
try_endpoints::try_endpoints,
};
use log::debug;
use qiniu_http::Extensions;

pub(in super::super) fn request_call<E: EndpointsProvider>(
Expand All @@ -34,6 +35,7 @@ pub(in super::super) fn request_call<E: EndpointsProvider>(
{
let (_, extensions) = err.split();
retried.switch_to_alternative_endpoints();
debug!("Switch to alternative endpoints");
try_alternative_endpoints(
endpoints.alternative(),
&parts,
Expand Down Expand Up @@ -103,6 +105,7 @@ pub(in super::super) async fn async_request_call<E: EndpointsProvider>(
{
let (_, extensions) = err.split();
retried.switch_to_alternative_endpoints();
debug!("Switch to alternative endpoints");
try_alternative_endpoints(
endpoints.alternative(),
&parts,
Expand Down
Loading

0 comments on commit 0fe3c63

Please sign in to comment.