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 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 * onDone: () { | 764 * onDone: () { |
765 * res.write('Received ${body.length} for request '); | 765 * res.write('Received ${body.length} for request '); |
766 * res.write(' ${req.method}: ${req.uri.path}'); | 766 * res.write(' ${req.method}: ${req.uri.path}'); |
767 * res.close(); | 767 * res.close(); |
768 * }, | 768 * }, |
769 * onError: handleError); | 769 * onError: handleError); |
770 * } | 770 * } |
771 */ | 771 */ |
772 abstract class HttpRequest implements Stream<List<int>> { | 772 abstract class HttpRequest implements Stream<List<int>> { |
773 /** | 773 /** |
774 * The content length of the request body (read-only). | 774 * The content length of the request body. |
775 * | 775 * |
776 * If the size of the request body is not known in advance, | 776 * If the size of the request body is not known in advance, |
777 * this value is -1. | 777 * this value is -1. |
778 */ | 778 */ |
779 int get contentLength; | 779 int get contentLength; |
780 | 780 |
781 /** | 781 /** |
782 * The method, such as 'GET' or 'POST', for the request (read-only). | 782 * The method, such as 'GET' or 'POST', for the request. |
783 */ | 783 */ |
784 String get method; | 784 String get method; |
785 | 785 |
786 /** | 786 /** |
787 * The URI for the request (read-only). | 787 * The URI for the request. |
788 * | 788 * |
789 * This provides access to the | 789 * This provides access to the |
790 * path, query string, and fragment identifier for the request. | 790 * path, query string, and fragment identifier for the request. |
791 */ | 791 */ |
792 Uri get uri; | 792 Uri get uri; |
793 | 793 |
794 /** | 794 /** |
795 * The requested URI for the request (read-only). | 795 * The requested URI for the request. |
796 * | 796 * |
797 * The returend URI is reconstructed by using http-header fields, to access | 797 * The returend URI is reconstructed by using http-header fields, to access |
798 * otherwise lost information, e.g. host and scheme. | 798 * otherwise lost information, e.g. host and scheme. |
799 * | 799 * |
800 * To reconstruct the scheme, first 'X-Forwarded-Proto' is checked, and then | 800 * To reconstruct the scheme, first 'X-Forwarded-Proto' is checked, and then |
801 * falling back to server type. | 801 * falling back to server type. |
802 * | 802 * |
803 * To reconstruct the host, fisrt 'X-Forwarded-Host' is checked, then 'Host' | 803 * To reconstruct the host, fisrt 'X-Forwarded-Host' is checked, then 'Host' |
804 * and finally calling back to server. | 804 * and finally calling back to server. |
805 */ | 805 */ |
806 Uri get requestedUri; | 806 Uri get requestedUri; |
807 | 807 |
808 /** | 808 /** |
809 * The request headers (read-only). | 809 * The request headers. |
810 */ | 810 */ |
811 HttpHeaders get headers; | 811 HttpHeaders get headers; |
812 | 812 |
813 /** | 813 /** |
814 * The cookies in the request, from the Cookie headers (read-only). | 814 * The cookies in the request, from the Cookie headers. |
815 */ | 815 */ |
816 List<Cookie> get cookies; | 816 List<Cookie> get cookies; |
817 | 817 |
818 /** | 818 /** |
819 * The persistent connection state signaled by the client (read-only). | 819 * The persistent connection state signaled by the client. |
820 */ | 820 */ |
821 bool get persistentConnection; | 821 bool get persistentConnection; |
822 | 822 |
823 /** | 823 /** |
824 * The client certificate of the client making the request (read-only). | 824 * The client certificate of the client making the request. |
825 * | 825 * |
826 * This value is null if the connection is not a secure TLS or SSL connection, | 826 * This value is null if the connection is not a secure TLS or SSL connection, |
827 * or if the server does not request a client certificate, or if the client | 827 * or if the server does not request a client certificate, or if the client |
828 * does not provide one. | 828 * does not provide one. |
829 */ | 829 */ |
830 X509Certificate get certificate; | 830 X509Certificate get certificate; |
831 | 831 |
832 /** | 832 /** |
833 * The session for the given request (read-only). | 833 * The session for the given request. |
834 * | 834 * |
835 * If the session is | 835 * If the session is |
836 * being initialized by this call, [:isNew:] is true for the returned | 836 * being initialized by this call, [:isNew:] is true for the returned |
837 * session. | 837 * session. |
838 * See [HttpServer.sessionTimeout] on how to change default timeout. | 838 * See [HttpServer.sessionTimeout] on how to change default timeout. |
839 */ | 839 */ |
840 HttpSession get session; | 840 HttpSession get session; |
841 | 841 |
842 /** | 842 /** |
843 * The HTTP protocol version used in the request, | 843 * The HTTP protocol version used in the request, |
844 * either "1.0" or "1.1" (read-only). | 844 * either "1.0" or "1.1". |
845 */ | 845 */ |
846 String get protocolVersion; | 846 String get protocolVersion; |
847 | 847 |
848 /** | 848 /** |
849 * Information about the client connection (read-only). | 849 * Information about the client connection. |
850 * | 850 * |
851 * Returns [:null:] if the socket is not available. | 851 * Returns [:null:] if the socket is not available. |
852 */ | 852 */ |
853 HttpConnectionInfo get connectionInfo; | 853 HttpConnectionInfo get connectionInfo; |
854 | 854 |
855 /** | 855 /** |
856 * The [HttpResponse] object, used for sending back the response to the | 856 * The [HttpResponse] object, used for sending back the response to the |
857 * client (read-only). | 857 * client. |
858 * | 858 * |
859 * If the [contentLength] of the body isn't 0, and the body isn't being read, | 859 * If the [contentLength] of the body isn't 0, and the body isn't being read, |
860 * any write calls on the [HttpResponse] automatically drain the request | 860 * any write calls on the [HttpResponse] automatically drain the request |
861 * body. | 861 * body. |
862 */ | 862 */ |
863 HttpResponse get response; | 863 HttpResponse get response; |
864 } | 864 } |
865 | 865 |
866 | 866 |
867 /** | 867 /** |
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1614 class RedirectException implements HttpException { | 1614 class RedirectException implements HttpException { |
1615 final String message; | 1615 final String message; |
1616 final List<RedirectInfo> redirects; | 1616 final List<RedirectInfo> redirects; |
1617 | 1617 |
1618 const RedirectException(this.message, this.redirects); | 1618 const RedirectException(this.message, this.redirects); |
1619 | 1619 |
1620 String toString() => "RedirectException: $message"; | 1620 String toString() => "RedirectException: $message"; |
1621 | 1621 |
1622 Uri get uri => redirects.last.location; | 1622 Uri get uri => redirects.last.location; |
1623 } | 1623 } |
OLD | NEW |