| 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 /** | 5 /** |
| 6 * HTTP status codes. | 6 * HTTP status codes. |
| 7 */ | 7 */ |
| 8 abstract class HttpStatus { | 8 abstract class HttpStatus { |
| 9 static const int CONTINUE = 100; | 9 static const int CONTINUE = 100; |
| 10 static const int SWITCHING_PROTOCOLS = 101; | 10 static const int SWITCHING_PROTOCOLS = 101; |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 abstract class HeaderValue { | 357 abstract class HeaderValue { |
| 358 /** | 358 /** |
| 359 * Creates a new header value object setting the value part. | 359 * Creates a new header value object setting the value part. |
| 360 */ | 360 */ |
| 361 factory HeaderValue([String value = ""]) => new _HeaderValue(value); | 361 factory HeaderValue([String value = ""]) => new _HeaderValue(value); |
| 362 | 362 |
| 363 /** | 363 /** |
| 364 * Creates a new header value object from parsing a header value | 364 * Creates a new header value object from parsing a header value |
| 365 * string with both value and optional parameters. | 365 * string with both value and optional parameters. |
| 366 */ | 366 */ |
| 367 factory HeaderValue.fromString(String value) { | 367 factory HeaderValue.fromString(String value, |
| 368 return new _HeaderValue.fromString(value); | 368 [String parameterSeparator = ";"]) { |
| 369 return new _HeaderValue.fromString(value, parameterSeparator); |
| 369 } | 370 } |
| 370 | 371 |
| 371 /** | 372 /** |
| 372 * Gets and sets the header value. | 373 * Gets and sets the header value. |
| 373 */ | 374 */ |
| 374 String value; | 375 String value; |
| 375 | 376 |
| 376 /** | 377 /** |
| 377 * Gets the map of parameters. | 378 * Gets the map of parameters. |
| 378 */ | 379 */ |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 * Opens a HTTP connection using the POST method. See [open] for details. | 703 * Opens a HTTP connection using the POST method. See [open] for details. |
| 703 */ | 704 */ |
| 704 HttpClientConnection post(String host, int port, String path); | 705 HttpClientConnection post(String host, int port, String path); |
| 705 | 706 |
| 706 /** | 707 /** |
| 707 * Opens a HTTP connection using the POST method. See [openUrl] for details. | 708 * Opens a HTTP connection using the POST method. See [openUrl] for details. |
| 708 */ | 709 */ |
| 709 HttpClientConnection postUrl(Uri url); | 710 HttpClientConnection postUrl(Uri url); |
| 710 | 711 |
| 711 /** | 712 /** |
| 713 * Sets the function to be called when a site is requesting |
| 714 * authentication. The URL requested and the security realm from the |
| 715 * server are passed in the arguments [url] and [realm]. |
| 716 * |
| 717 * If credentials exists the function should add these using |
| 718 * [addCredentials] before returning. |
| 719 * |
| 720 * If the function returns true the request will be retried using |
| 721 * the updated credentials. Otherwise response processing will |
| 722 * continue normally. |
| 723 */ |
| 724 set authenticate(bool f(Uri url, String scheme, String realm)); |
| 725 |
| 726 /** |
| 727 * Add credentials to be used for authorizing HTTP requests. |
| 728 */ |
| 729 void addCredentials(Uri url, String realm, HttpClientCredentials credentials); |
| 730 |
| 731 /** |
| 712 * Sets the function used to resolve the proxy server to be used for | 732 * Sets the function used to resolve the proxy server to be used for |
| 713 * opening a HTTP connection to the specified [url]. If this | 733 * opening a HTTP connection to the specified [url]. If this |
| 714 * function is not set, direct connections will always be used. | 734 * function is not set, direct connections will always be used. |
| 715 * | 735 * |
| 716 * The string returned by [f] must be in the format used by browser | 736 * The string returned by [f] must be in the format used by browser |
| 717 * PAC (proxy auto-config) scripts. That is either | 737 * PAC (proxy auto-config) scripts. That is either |
| 718 * | 738 * |
| 719 * "DIRECT" | 739 * "DIRECT" |
| 720 * | 740 * |
| 721 * for using a direct connection or | 741 * for using a direct connection or |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 */ | 917 */ |
| 898 List<Cookie> get cookies; | 918 List<Cookie> get cookies; |
| 899 | 919 |
| 900 /** | 920 /** |
| 901 * Returns the input stream for the response. This is used to read | 921 * Returns the input stream for the response. This is used to read |
| 902 * the response data. | 922 * the response data. |
| 903 */ | 923 */ |
| 904 InputStream get inputStream; | 924 InputStream get inputStream; |
| 905 } | 925 } |
| 906 | 926 |
| 927 |
| 928 abstract class HttpClientCredentials { } |
| 929 |
| 930 |
| 931 /** |
| 932 * Represent credentials for basic authentication. |
| 933 */ |
| 934 abstract class HttpClientBasicCredentials extends HttpClientCredentials { |
| 935 factory HttpClientBasicCredentials(String username, String password) => |
| 936 new _HttpClientBasicCredentials(username, password); |
| 937 } |
| 938 |
| 939 |
| 940 /** |
| 941 * Represent credentials for digest authentication. |
| 942 */ |
| 943 abstract class HttpClientDigestCredentials extends HttpClientCredentials { |
| 944 factory HttpClientDigestCredentials(String username, String password) => |
| 945 new _HttpClientDigestCredentials(username, password); |
| 946 } |
| 947 |
| 948 |
| 907 /** | 949 /** |
| 908 * Connection information. | 950 * Connection information. |
| 909 */ | 951 */ |
| 910 abstract class HttpConnectionInfo { | 952 abstract class HttpConnectionInfo { |
| 911 String get remoteHost; | 953 String get remoteHost; |
| 912 int get remotePort; | 954 int get remotePort; |
| 913 int get localPort; | 955 int get localPort; |
| 914 } | 956 } |
| 915 | 957 |
| 916 | 958 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 965 class RedirectLimitExceededException extends RedirectException { | 1007 class RedirectLimitExceededException extends RedirectException { |
| 966 const RedirectLimitExceededException(List<RedirectInfo> redirects) | 1008 const RedirectLimitExceededException(List<RedirectInfo> redirects) |
| 967 : super("Redirect limit exceeded", redirects); | 1009 : super("Redirect limit exceeded", redirects); |
| 968 } | 1010 } |
| 969 | 1011 |
| 970 | 1012 |
| 971 class RedirectLoopException extends RedirectException { | 1013 class RedirectLoopException extends RedirectException { |
| 972 const RedirectLoopException(List<RedirectInfo> redirects) | 1014 const RedirectLoopException(List<RedirectInfo> redirects) |
| 973 : super("Redirect loop detected", redirects); | 1015 : super("Redirect loop detected", redirects); |
| 974 } | 1016 } |
| OLD | NEW |