Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Side by Side Diff: sdk/lib/io/http_impl.dart

Issue 246923003: Add HttpClient:put/delete/head/patch. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/io/http.dart ('k') | tests/standalone/io/http_client_connect_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 part of dart.io; 5 part of dart.io;
6 6
7 const int _OUTGOING_BUFFER_SIZE = 8 * 1024; 7 const int _OUTGOING_BUFFER_SIZE = 8 * 1024;
8 8
9 class _HttpIncoming extends Stream<List<int>> { 9 class _HttpIncoming extends Stream<List<int>> {
10 final int _transferLength; 10 final int _transferLength;
(...skipping 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after
1542 // TODO(sgjesse): The path set here can contain both query and 1542 // TODO(sgjesse): The path set here can contain both query and
1543 // fragment. They should be cracked and set correctly. 1543 // fragment. They should be cracked and set correctly.
1544 return _openUrl(method, new Uri( 1544 return _openUrl(method, new Uri(
1545 scheme: "http", host: host, port: port, path: path)); 1545 scheme: "http", host: host, port: port, path: path));
1546 } 1546 }
1547 1547
1548 Future<HttpClientRequest> openUrl(String method, Uri url) { 1548 Future<HttpClientRequest> openUrl(String method, Uri url) {
1549 return _openUrl(method, url); 1549 return _openUrl(method, url);
1550 } 1550 }
1551 1551
1552 Future<HttpClientRequest> get(String host, 1552 Future<HttpClientRequest> get(String host, int port, String path)
1553 int port, 1553 => open("get", host, port, path);
1554 String path) {
1555 return open("get", host, port, path);
1556 }
1557 1554
1558 Future<HttpClientRequest> getUrl(Uri url) { 1555 Future<HttpClientRequest> getUrl(Uri url) => _openUrl("get", url);
1559 return _openUrl("get", url);
1560 }
1561 1556
1562 Future<HttpClientRequest> post(String host, 1557 Future<HttpClientRequest> post(String host, int port, String path)
1563 int port, 1558 => open("post", host, port, path);
1564 String path) {
1565 return open("post", host, port, path);
1566 }
1567 1559
1568 Future<HttpClientRequest> postUrl(Uri url) { 1560 Future<HttpClientRequest> postUrl(Uri url) => _openUrl("post", url);
1569 return _openUrl("post", url); 1561
1570 } 1562 Future<HttpClientRequest> put(String host, int port, String path)
1563 => open("put", host, port, path);
1564
1565 Future<HttpClientRequest> putUrl(Uri url) => _openUrl("put", url);
1566
1567 Future<HttpClientRequest> delete(String host, int port, String path)
1568 => open("delete", host, port, path);
1569
1570 Future<HttpClientRequest> deleteUrl(Uri url) => _openUrl("delete", url);
1571
1572 Future<HttpClientRequest> head(String host, int port, String path)
1573 => open("head", host, port, path);
1574
1575 Future<HttpClientRequest> headUrl(Uri url) => _openUrl("head", url);
1576
1577 Future<HttpClientRequest> patch(String host, int port, String path)
1578 => open("patch", host, port, path);
1579
1580 Future<HttpClientRequest> patchUrl(Uri url) => _openUrl("patch", url);
1571 1581
1572 void close({bool force: false}) { 1582 void close({bool force: false}) {
1573 _closing = true; 1583 _closing = true;
1574 // Create flattened copy of _idleConnections, as 'destory' will manipulate 1584 // Create flattened copy of _idleConnections, as 'destory' will manipulate
1575 // it. 1585 // it.
1576 var idle = _idleConnections.values.fold( 1586 var idle = _idleConnections.values.fold(
1577 [], 1587 [],
1578 (l, e) { 1588 (l, e) {
1579 l.addAll(e); 1589 l.addAll(e);
1580 return l; 1590 return l;
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
2606 const _RedirectInfo(this.statusCode, this.method, this.location); 2616 const _RedirectInfo(this.statusCode, this.method, this.location);
2607 } 2617 }
2608 2618
2609 String _getHttpVersion() { 2619 String _getHttpVersion() {
2610 var version = Platform.version; 2620 var version = Platform.version;
2611 // Only include major and minor version numbers. 2621 // Only include major and minor version numbers.
2612 int index = version.indexOf('.', version.indexOf('.') + 1); 2622 int index = version.indexOf('.', version.indexOf('.') + 1);
2613 version = version.substring(0, index); 2623 version = version.substring(0, index);
2614 return 'Dart/$version (dart:io)'; 2624 return 'Dart/$version (dart:io)';
2615 } 2625 }
OLDNEW
« no previous file with comments | « sdk/lib/io/http.dart ('k') | tests/standalone/io/http_client_connect_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698