Skip to content

Commit

Permalink
fix cfug#1452
Browse files Browse the repository at this point in the history
  • Loading branch information
wendux committed Mar 31, 2022
1 parent f56ce11 commit ac78e61
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README-ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dio是一个强大的Dart Http请求库,支持Restful API、FormData、拦截

```yaml
dependencies:
dio: ^4.0.5
dio: ^4.0.6
```
> 如果你是dio 3.x 用户,想了解4.0的变更,请参考 [4.x更新列表](./migration_to_4.x.md)!
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ A powerful Http client for Dart, which supports Interceptors, Global configurati

```yaml
dependencies:
dio: ^4.0.5
dio: ^4.0.6
```
> Already know Dio 3 and just want to learn about what's new in Dio 4? Check out the [Migration Guide](./migration_to_4.x.md)!
Expand Down
3 changes: 3 additions & 0 deletions dio/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 4.0.6
- fix #1452

# 4.0.5
- require Dart `2.12.1` which fixes exception handling for secure socket connections (https://github.com/dart-lang/sdk/issues/45214)
- Only delete file if it exists when downloading.
Expand Down
2 changes: 1 addition & 1 deletion dio/README-ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dio是一个强大的Dart Http请求库,支持Restful API、FormData、拦截

```yaml
dependencies:
dio: ^4.0.5
dio: ^4.0.6
```
> 如果你是dio 3.x 用户,想了解4.0的变更,请参考 [4.x更新列表](./migration_to_4.x.md)!
Expand Down
2 changes: 1 addition & 1 deletion dio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ A powerful Http client for Dart, which supports Interceptors, Global configurati

```yaml
dependencies:
dio: ^4.0.5
dio: ^4.0.6
```
> Already know Dio 3 and just want to learn about what's new in Dio 4? Check out the [Migration Guide](./migration_to_4.x.md)!
Expand Down
16 changes: 6 additions & 10 deletions dio/lib/src/adapters/io_adapter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class DefaultHttpClientAdapter implements HttpClientAdapter {

late HttpClientRequest request;
try {
request = await reqFuture;
if (options.connectTimeout > 0) {
request = await reqFuture
.timeout(Duration(milliseconds: options.connectTimeout));
Expand All @@ -61,7 +62,6 @@ class DefaultHttpClientAdapter implements HttpClientAdapter {
}
rethrow;
} on TimeoutException {
request.abort();
_throwConnectingTimeout();
}

Expand Down Expand Up @@ -97,15 +97,11 @@ class DefaultHttpClientAdapter implements HttpClientAdapter {
try {
responseStream = await future;
} on TimeoutException {
try {
await responseStream.detachSocket();
} finally {
throw DioError(
requestOptions: options,
error: 'Receiving data timeout[${options.receiveTimeout}ms]',
type: DioErrorType.receiveTimeout,
);
}
throw DioError(
requestOptions: options,
error: 'Receiving data timeout[${options.receiveTimeout}ms]',
type: DioErrorType.receiveTimeout,
);
}

var stream =
Expand Down
2 changes: 1 addition & 1 deletion dio/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: dio
description: A powerful Http client for Dart, which supports Interceptors, FormData, Request Cancellation, File Downloading, Timeout etc.
version: 4.0.5
version: 4.0.6
homepage: https://github.com/flutterchina/dio

environment:
Expand Down

0 comments on commit ac78e61

Please sign in to comment.