| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library io_client; | 5 library io_client; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 import 'base_client.dart'; | 10 import 'base_client.dart'; |
| 11 import 'base_request.dart'; | 11 import 'base_request.dart'; |
| 12 import 'streamed_response.dart'; | 12 import 'streamed_response.dart'; |
| 13 import 'utils.dart'; | |
| 14 | 13 |
| 15 /// A `dart:io`-based HTTP client. This is the default client. | 14 /// A `dart:io`-based HTTP client. This is the default client. |
| 16 class IOClient extends BaseClient { | 15 class IOClient extends BaseClient { |
| 17 /// The underlying `dart:io` HTTP client. | 16 /// The underlying `dart:io` HTTP client. |
| 18 HttpClient _inner; | 17 HttpClient _inner; |
| 19 | 18 |
| 20 /// Creates a new HTTP client. | 19 /// Creates a new HTTP client. |
| 21 IOClient() : _inner = new HttpClient(); | 20 IOClient() : _inner = new HttpClient(); |
| 22 | 21 |
| 23 /// Sends an HTTP request and asynchronously returns the response. | 22 /// Sends an HTTP request and asynchronously returns the response. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 51 }); | 50 }); |
| 52 } | 51 } |
| 53 | 52 |
| 54 /// Closes the client. This terminates all active connections. If a client | 53 /// Closes the client. This terminates all active connections. If a client |
| 55 /// remains unclosed, the Dart process may not terminate. | 54 /// remains unclosed, the Dart process may not terminate. |
| 56 void close() { | 55 void close() { |
| 57 if (_inner != null) _inner.close(force: true); | 56 if (_inner != null) _inner.close(force: true); |
| 58 _inner = null; | 57 _inner = null; |
| 59 } | 58 } |
| 60 } | 59 } |
| OLD | NEW |