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

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

Issue 225323005: Update HTTP documentation (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 | « no previous file | no next file » | 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 /** 7 /**
8 * HTTP status codes. 8 * HTTP status codes.
9 */ 9 */
10 abstract class HttpStatus { 10 abstract class HttpStatus {
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 * To reconstruct the scheme, first 'X-Forwarded-Proto' is checked, and then 917 * To reconstruct the scheme, first 'X-Forwarded-Proto' is checked, and then
918 * falling back to server type. 918 * falling back to server type.
919 * 919 *
920 * To reconstruct the host, fisrt 'X-Forwarded-Host' is checked, then 'Host' 920 * To reconstruct the host, fisrt 'X-Forwarded-Host' is checked, then 'Host'
921 * and finally calling back to server. 921 * and finally calling back to server.
922 */ 922 */
923 Uri get requestedUri; 923 Uri get requestedUri;
924 924
925 /** 925 /**
926 * The request headers. 926 * The request headers.
927 *
928 * The request headers are immutable.
Anders Johnsen 2014/04/04 12:56:40 This looks like half a copy of the above line. Con
Søren Gjesse 2014/04/04 13:06:14 Done.
927 */ 929 */
928 HttpHeaders get headers; 930 HttpHeaders get headers;
929 931
930 /** 932 /**
931 * The cookies in the request, from the Cookie headers. 933 * The cookies in the request, from the Cookie headers.
932 */ 934 */
933 List<Cookie> get cookies; 935 List<Cookie> get cookies;
934 936
935 /** 937 /**
936 * The persistent connection state signaled by the client. 938 * The persistent connection state signaled by the client.
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 * the response is not known in advance set the content length to 1039 * the response is not known in advance set the content length to
1038 * -1 - which is also the default if not set. 1040 * -1 - which is also the default if not set.
1039 */ 1041 */
1040 int contentLength; 1042 int contentLength;
1041 1043
1042 /** 1044 /**
1043 * Gets and sets the status code. Any integer value is accepted. For 1045 * Gets and sets the status code. Any integer value is accepted. For
1044 * the official HTTP status codes use the fields from 1046 * the official HTTP status codes use the fields from
1045 * [HttpStatus]. If no status code is explicitly set the default 1047 * [HttpStatus]. If no status code is explicitly set the default
1046 * value [HttpStatus.OK] is used. 1048 * value [HttpStatus.OK] is used.
1049 *
1050 * The status code must be set before the body is written
1051 * to. Setting the status code after writing to the body will throw
Anders Johnsen 2014/04/04 12:56:40 or closed.
Søren Gjesse 2014/04/04 13:06:14 Done.
1052 * a `StateError`.
1047 */ 1053 */
1048 int statusCode; 1054 int statusCode;
1049 1055
1050 /** 1056 /**
1051 * Gets and sets the reason phrase. If no reason phrase is explicitly 1057 * Gets and sets the reason phrase. If no reason phrase is explicitly
1052 * set a default reason phrase is provided. 1058 * set a default reason phrase is provided.
1059 *
1060 * The reason phrase must be set before the body is written
1061 * to. Setting the reason phrase after writing to the body will throw
Anders Johnsen 2014/04/04 12:56:40 ditto.
Søren Gjesse 2014/04/04 13:06:14 Done.
1062 * a `StateError`.
1053 */ 1063 */
1054 String reasonPhrase; 1064 String reasonPhrase;
1055 1065
1056 /** 1066 /**
1057 * Gets and sets the persistent connection state. The initial value 1067 * Gets and sets the persistent connection state. The initial value
1058 * of this property is the persistent connection state from the 1068 * of this property is the persistent connection state from the
1059 * request. 1069 * request.
1060 */ 1070 */
1061 bool persistentConnection; 1071 bool persistentConnection;
1062 1072
1063 /** 1073 /**
1064 * Set and get the [deadline] for the response. The deadline is timed from the 1074 * Set and get the [deadline] for the response. The deadline is timed from the
1065 * time it's set. Setting a new deadline will override any previous deadline. 1075 * time it's set. Setting a new deadline will override any previous deadline.
1066 * When a deadline is exceeded, the response will be closed and any further 1076 * When a deadline is exceeded, the response will be closed and any further
1067 * data ignored. 1077 * data ignored.
1068 * 1078 *
1069 * To disable a deadline, set the [deadline] to `null`. 1079 * To disable a deadline, set the [deadline] to `null`.
1070 * 1080 *
1071 * The [deadline] is `null` by default. 1081 * The [deadline] is `null` by default.
1072 */ 1082 */
1073 Duration deadline; 1083 Duration deadline;
1074 1084
1075 /** 1085 /**
1076 * Returns the response headers. 1086 * Returns the response headers.
1087 *
1088 * The response headers can be modified until the body is written
1089 * to. After that they become immutable.
Anders Johnsen 2014/04/04 12:56:40 ditto.
Søren Gjesse 2014/04/04 13:06:14 Done.
1077 */ 1090 */
1078 HttpHeaders get headers; 1091 HttpHeaders get headers;
1079 1092
1080 /** 1093 /**
1081 * Cookies to set in the client (in the 'set-cookie' header). 1094 * Cookies to set in the client (in the 'set-cookie' header).
1082 */ 1095 */
1083 List<Cookie> get cookies; 1096 List<Cookie> get cookies;
1084 1097
1085 /** 1098 /**
1086 * Respond with a redirect to [location]. 1099 * Respond with a redirect to [location].
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
1544 Uri get uri; 1557 Uri get uri;
1545 1558
1546 /** 1559 /**
1547 * Gets and sets the content length of the request. If the size of 1560 * Gets and sets the content length of the request. If the size of
1548 * the request is not known in advance set content length to -1, 1561 * the request is not known in advance set content length to -1,
1549 * which is also the default. 1562 * which is also the default.
1550 */ 1563 */
1551 int contentLength; 1564 int contentLength;
1552 1565
1553 /** 1566 /**
1554 * Returns the request headers. 1567 * Returns the client request headers.
1568 *
1569 * The client request headers can be modified until the body is
Anders Johnsen 2014/04/04 12:56:40 ditto, and below
Søren Gjesse 2014/04/04 13:06:14 Done.
1570 * written to. After that they become immutable.
1555 */ 1571 */
1556 HttpHeaders get headers; 1572 HttpHeaders get headers;
1557 1573
1558 /** 1574 /**
1559 * Cookies to present to the server (in the 'cookie' header). 1575 * Cookies to present to the server (in the 'cookie' header).
1560 */ 1576 */
1561 List<Cookie> get cookies; 1577 List<Cookie> get cookies;
1562 1578
1563 /** 1579 /**
1564 * A [HttpClientResponse] future that will complete once the response is 1580 * A [HttpClientResponse] future that will complete once the response is
(...skipping 26 matching lines...) Expand all
1591 * .then((HttpClientRequeset request) => request.close()) 1607 * .then((HttpClientRequeset request) => request.close())
1592 * .then((HttpClientResponse response) { 1608 * .then((HttpClientResponse response) {
1593 * response.transform(UTF8.decoder).listen((contents) { 1609 * response.transform(UTF8.decoder).listen((contents) {
1594 * // handle data 1610 * // handle data
1595 * }); 1611 * });
1596 * }); 1612 * });
1597 */ 1613 */
1598 abstract class HttpClientResponse implements Stream<List<int>> { 1614 abstract class HttpClientResponse implements Stream<List<int>> {
1599 /** 1615 /**
1600 * Returns the status code. 1616 * Returns the status code.
1617 *
1618 * The status code must be set before the body is written
1619 * to. Setting the status code after writing to the body will throw
1620 * a `StateError`.
1601 */ 1621 */
1602 int get statusCode; 1622 int get statusCode;
1603 1623
1604 /** 1624 /**
1605 * Returns the reason phrase associated with the status code. 1625 * Returns the reason phrase associated with the status code.
1626 *
1627 * The reason phrase must be set before the body is written
1628 * to. Setting the reason phrase after writing to the body will throw
1629 * a `StateError`.
1606 */ 1630 */
1607 String get reasonPhrase; 1631 String get reasonPhrase;
1608 1632
1609 /** 1633 /**
1610 * Returns the content length of the response body. Returns -1 if the size of 1634 * Returns the content length of the response body. Returns -1 if the size of
1611 * the response body is not known in advance. 1635 * the response body is not known in advance.
1636 *
1637 * If the content length needs to be set, it must be set before the
1638 * body is written to. Setting the reason phrase after writing to
1639 * the body will throw a `StateError`.
1612 */ 1640 */
1613 int get contentLength; 1641 int get contentLength;
1614 1642
1615 /** 1643 /**
1616 * Gets the persistent connection state returned by the server. 1644 * Gets the persistent connection state returned by the server.
1645 *
1646 * if the persistent connection state needs to be set, it must be
1647 * set before the body is written to. Setting the reason phrase
1648 * after writing to the body will throw a `StateError`.
1617 */ 1649 */
1618 bool get persistentConnection; 1650 bool get persistentConnection;
1619 1651
1620 /** 1652 /**
1621 * Returns whether the status code is one of the normal redirect 1653 * Returns whether the status code is one of the normal redirect
1622 * codes [HttpStatus.MOVED_PERMANENTLY], [HttpStatus.FOUND], 1654 * codes [HttpStatus.MOVED_PERMANENTLY], [HttpStatus.FOUND],
1623 * [HttpStatus.MOVED_TEMPORARILY], [HttpStatus.SEE_OTHER] and 1655 * [HttpStatus.MOVED_TEMPORARILY], [HttpStatus.SEE_OTHER] and
1624 * [HttpStatus.TEMPORARY_REDIRECT]. 1656 * [HttpStatus.TEMPORARY_REDIRECT].
1625 */ 1657 */
1626 bool get isRedirect; 1658 bool get isRedirect;
(...skipping 20 matching lines...) Expand all
1647 * even if the URL was already visited. The default value is [:false:]. 1679 * even if the URL was already visited. The default value is [:false:].
1648 * 1680 *
1649 * [redirect] will ignore [maxRedirects] and will always perform the redirect. 1681 * [redirect] will ignore [maxRedirects] and will always perform the redirect.
1650 */ 1682 */
1651 Future<HttpClientResponse> redirect([String method, 1683 Future<HttpClientResponse> redirect([String method,
1652 Uri url, 1684 Uri url,
1653 bool followLoops]); 1685 bool followLoops]);
1654 1686
1655 1687
1656 /** 1688 /**
1657 * Returns the response headers. 1689 * Returns the client response headers.
1690 *
1691 * The client response headers are immutable.
1658 */ 1692 */
1659 HttpHeaders get headers; 1693 HttpHeaders get headers;
1660 1694
1661 /** 1695 /**
1662 * Detach the underlying socket from the HTTP client. When the 1696 * Detach the underlying socket from the HTTP client. When the
1663 * socket is detached the HTTP client will no longer perform any 1697 * socket is detached the HTTP client will no longer perform any
1664 * operations on it. 1698 * operations on it.
1665 * 1699 *
1666 * This is normally used when a HTTP upgrade is negotiated and the 1700 * This is normally used when a HTTP upgrade is negotiated and the
1667 * communication should continue with a different protocol. 1701 * communication should continue with a different protocol.
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1777 class RedirectException implements HttpException { 1811 class RedirectException implements HttpException {
1778 final String message; 1812 final String message;
1779 final List<RedirectInfo> redirects; 1813 final List<RedirectInfo> redirects;
1780 1814
1781 const RedirectException(this.message, this.redirects); 1815 const RedirectException(this.message, this.redirects);
1782 1816
1783 String toString() => "RedirectException: $message"; 1817 String toString() => "RedirectException: $message";
1784 1818
1785 Uri get uri => redirects.last.location; 1819 Uri get uri => redirects.last.location;
1786 } 1820 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698