| OLD | NEW |
| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 * generated by this [HttpServer]. | 157 * generated by this [HttpServer]. |
| 158 * | 158 * |
| 159 * If [serverHeader] is `null`, no `Server` header will be added to each | 159 * If [serverHeader] is `null`, no `Server` header will be added to each |
| 160 * response. | 160 * response. |
| 161 * | 161 * |
| 162 * The default value is `null`. | 162 * The default value is `null`. |
| 163 */ | 163 */ |
| 164 String serverHeader; | 164 String serverHeader; |
| 165 | 165 |
| 166 /** | 166 /** |
| 167 * Default set of headers added to all response objects. |
| 168 * |
| 169 * By default the following headers are in this set: |
| 170 * |
| 171 * Content-Type: text/plain; charset=utf-8 |
| 172 * X-Frame-Options: SAMEORIGIN |
| 173 * X-Content-Type-Options: nosniff |
| 174 * X-XSS-Protection: 1; mode=block |
| 175 * |
| 176 * If the `Server` header is added here and the `serverHeader` is set as |
| 177 * well then the value of `serverHeader` takes precedence. |
| 178 */ |
| 179 HttpHeaders get defaultResponseHeaders; |
| 180 |
| 181 /** |
| 167 * Get or set the timeout used for idle keep-alive connections. If no further | 182 * Get or set the timeout used for idle keep-alive connections. If no further |
| 168 * request is seen within [idleTimeout] after the previous request was | 183 * request is seen within [idleTimeout] after the previous request was |
| 169 * completed, the connection is dropped. | 184 * completed, the connection is dropped. |
| 170 * | 185 * |
| 171 * Default is 120 seconds. | 186 * Default is 120 seconds. |
| 172 * | 187 * |
| 173 * Note that it may take up to `2 * idleTimeout` before a idle connection is | 188 * Note that it may take up to `2 * idleTimeout` before a idle connection is |
| 174 * aborted. | 189 * aborted. |
| 175 * | 190 * |
| 176 * To disable, set [idleTimeout] to `null`. | 191 * To disable, set [idleTimeout] to `null`. |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 */ | 588 */ |
| 574 void forEach(void f(String name, List<String> values)); | 589 void forEach(void f(String name, List<String> values)); |
| 575 | 590 |
| 576 /** | 591 /** |
| 577 * Disables folding for the header named [name] when sending the HTTP | 592 * Disables folding for the header named [name] when sending the HTTP |
| 578 * header. By default, multiple header values are folded into a | 593 * header. By default, multiple header values are folded into a |
| 579 * single header line by separating the values with commas. The | 594 * single header line by separating the values with commas. The |
| 580 * 'set-cookie' header has folding disabled by default. | 595 * 'set-cookie' header has folding disabled by default. |
| 581 */ | 596 */ |
| 582 void noFolding(String name); | 597 void noFolding(String name); |
| 598 |
| 599 /** |
| 600 * Remove all headers. Some headers have system supplied values and |
| 601 * for these the system supplied values will still be added to the |
| 602 * collection of values for the header. |
| 603 */ |
| 604 void clear(); |
| 583 } | 605 } |
| 584 | 606 |
| 585 | 607 |
| 586 /** | 608 /** |
| 587 * Representation of a header value in the form: | 609 * Representation of a header value in the form: |
| 588 * | 610 * |
| 589 * [:value; parameter1=value1; parameter2=value2:] | 611 * [:value; parameter1=value1; parameter2=value2:] |
| 590 * | 612 * |
| 591 * [HeaderValue] can be used to conveniently build and parse header | 613 * [HeaderValue] can be used to conveniently build and parse header |
| 592 * values on this form. | 614 * values on this form. |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 */ | 828 */ |
| 807 bool secure; | 829 bool secure; |
| 808 | 830 |
| 809 /** | 831 /** |
| 810 * Gets and sets whether this cookie is HTTP only. | 832 * Gets and sets whether this cookie is HTTP only. |
| 811 */ | 833 */ |
| 812 bool httpOnly; | 834 bool httpOnly; |
| 813 | 835 |
| 814 /** | 836 /** |
| 815 * Creates a new cookie optionally setting the name and value. | 837 * Creates a new cookie optionally setting the name and value. |
| 838 * |
| 839 * By default the value of `httpOnly` will be set to `true`. |
| 816 */ | 840 */ |
| 817 factory Cookie([String name, String value]) => new _Cookie(name, value); | 841 factory Cookie([String name, String value]) => new _Cookie(name, value); |
| 818 | 842 |
| 819 /** | 843 /** |
| 820 * Creates a new cookie by parsing a header value from a 'set-cookie' | 844 * Creates a new cookie by parsing a header value from a 'set-cookie' |
| 821 * header. | 845 * header. |
| 822 */ | 846 */ |
| 823 factory Cookie.fromSetCookieValue(String value) { | 847 factory Cookie.fromSetCookieValue(String value) { |
| 824 return new _Cookie.fromSetCookieValue(value); | 848 return new _Cookie.fromSetCookieValue(value); |
| 825 } | 849 } |
| (...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1953 class RedirectException implements HttpException { | 1977 class RedirectException implements HttpException { |
| 1954 final String message; | 1978 final String message; |
| 1955 final List<RedirectInfo> redirects; | 1979 final List<RedirectInfo> redirects; |
| 1956 | 1980 |
| 1957 const RedirectException(this.message, this.redirects); | 1981 const RedirectException(this.message, this.redirects); |
| 1958 | 1982 |
| 1959 String toString() => "RedirectException: $message"; | 1983 String toString() => "RedirectException: $message"; |
| 1960 | 1984 |
| 1961 Uri get uri => redirects.last.location; | 1985 Uri get uri => redirects.last.location; |
| 1962 } | 1986 } |
| OLD | NEW |