| 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 interface 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; |
| 11 static const int OK = 200; | 11 static const int OK = 200; |
| 12 static const int CREATED = 201; | 12 static const int CREATED = 201; |
| 13 static const int ACCEPTED = 202; | 13 static const int ACCEPTED = 202; |
| 14 static const int NON_AUTHORITATIVE_INFORMATION = 203; | 14 static const int NON_AUTHORITATIVE_INFORMATION = 203; |
| 15 static const int NO_CONTENT = 204; | 15 static const int NO_CONTENT = 204; |
| 16 static const int RESET_CONTENT = 205; | 16 static const int RESET_CONTENT = 205; |
| 17 static const int PARTIAL_CONTENT = 206; | 17 static const int PARTIAL_CONTENT = 206; |
| 18 static const int MULTIPLE_CHOICES = 300; | 18 static const int MULTIPLE_CHOICES = 300; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 48 static const int GATEWAY_TIMEOUT = 504; | 48 static const int GATEWAY_TIMEOUT = 504; |
| 49 static const int HTTP_VERSION_NOT_SUPPORTED = 505; | 49 static const int HTTP_VERSION_NOT_SUPPORTED = 505; |
| 50 // Client generated status code. | 50 // Client generated status code. |
| 51 static const int NETWORK_CONNECT_TIMEOUT_ERROR = 599; | 51 static const int NETWORK_CONNECT_TIMEOUT_ERROR = 599; |
| 52 } | 52 } |
| 53 | 53 |
| 54 | 54 |
| 55 /** | 55 /** |
| 56 * HTTP server. | 56 * HTTP server. |
| 57 */ | 57 */ |
| 58 interface HttpServer default _HttpServer { | 58 abstract class HttpServer { |
| 59 HttpServer(); | 59 factory HttpServer() => new _HttpServer(); |
| 60 | 60 |
| 61 /** | 61 /** |
| 62 * Start listening for HTTP requests on the specified [host] and | 62 * Start listening for HTTP requests on the specified [host] and |
| 63 * [port]. If a [port] of 0 is specified the server will choose an | 63 * [port]. If a [port] of 0 is specified the server will choose an |
| 64 * ephemeral port. The optional argument [backlog] can be used to | 64 * ephemeral port. The optional argument [backlog] can be used to |
| 65 * specify the listen backlog for the underlying OS listen | 65 * specify the listen backlog for the underlying OS listen |
| 66 * setup. See [addRequestHandler] and [defaultRequestHandler] for | 66 * setup. See [addRequestHandler] and [defaultRequestHandler] for |
| 67 * information on how incoming HTTP requests are handled. | 67 * information on how incoming HTTP requests are handled. |
| 68 */ | 68 */ |
| 69 void listen(String host, int port, [int backlog]); | 69 void listen(String host, int port, [int backlog]); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 115 |
| 116 | 116 |
| 117 /** | 117 /** |
| 118 * Access to the HTTP headers for requests and responses. In some | 118 * Access to the HTTP headers for requests and responses. In some |
| 119 * situations the headers will be imutable and the mutating methods | 119 * situations the headers will be imutable and the mutating methods |
| 120 * will then throw exceptions. | 120 * will then throw exceptions. |
| 121 * | 121 * |
| 122 * For all operation on HTTP headers the header name is | 122 * For all operation on HTTP headers the header name is |
| 123 * case-insensitive. | 123 * case-insensitive. |
| 124 */ | 124 */ |
| 125 interface HttpHeaders default _HttpHeaders { | 125 abstract class HttpHeaders { |
| 126 static const ACCEPT = "Accept"; | 126 static const ACCEPT = "Accept"; |
| 127 static const ACCEPT_CHARSET = "Accept-Charset"; | 127 static const ACCEPT_CHARSET = "Accept-Charset"; |
| 128 static const ACCEPT_ENCODING = "Accept-Encoding"; | 128 static const ACCEPT_ENCODING = "Accept-Encoding"; |
| 129 static const ACCEPT_LANGUAGE = "Accept-Language"; | 129 static const ACCEPT_LANGUAGE = "Accept-Language"; |
| 130 static const ACCEPT_RANGES = "Accept-Ranges"; | 130 static const ACCEPT_RANGES = "Accept-Ranges"; |
| 131 static const AGE = "Age"; | 131 static const AGE = "Age"; |
| 132 static const ALLOW = "Allow"; | 132 static const ALLOW = "Allow"; |
| 133 static const AUTHORIZATION = "Authorization"; | 133 static const AUTHORIZATION = "Authorization"; |
| 134 static const CACHE_CONTROL = "Cache-Control"; | 134 static const CACHE_CONTROL = "Cache-Control"; |
| 135 static const CONNECTION = "Connection"; | 135 static const CONNECTION = "Connection"; |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 * | 347 * |
| 348 * To parse the header values use the [:fromString:] constructor. | 348 * To parse the header values use the [:fromString:] constructor. |
| 349 * | 349 * |
| 350 * HttpRequest request = ...; | 350 * HttpRequest request = ...; |
| 351 * List<String> values = request.headers[HttpHeaders.ACCEPT]; | 351 * List<String> values = request.headers[HttpHeaders.ACCEPT]; |
| 352 * values.forEach((value) { | 352 * values.forEach((value) { |
| 353 * HeaderValue v = new HeaderValue.fromString(value); | 353 * HeaderValue v = new HeaderValue.fromString(value); |
| 354 * // Use v.value and v.parameters | 354 * // Use v.value and v.parameters |
| 355 * }); | 355 * }); |
| 356 */ | 356 */ |
| 357 interface HeaderValue default _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 HeaderValue([String 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 HeaderValue.fromString(String value); | 367 factory HeaderValue.fromString(String value) { |
| 368 return new _HeaderValue.fromString(value); |
| 369 } |
| 368 | 370 |
| 369 /** | 371 /** |
| 370 * Gets and sets the header value. | 372 * Gets and sets the header value. |
| 371 */ | 373 */ |
| 372 String value; | 374 String value; |
| 373 | 375 |
| 374 /** | 376 /** |
| 375 * Gets the map of parameters. | 377 * Gets the map of parameters. |
| 376 */ | 378 */ |
| 377 Map<String, String> get parameters; | 379 Map<String, String> get parameters; |
| 378 | 380 |
| 379 /** | 381 /** |
| 380 * Returns the formatted string representation in the form: | 382 * Returns the formatted string representation in the form: |
| 381 * | 383 * |
| 382 * value; parameter1=value1; parameter2=value2 | 384 * value; parameter1=value1; parameter2=value2 |
| 383 */ | 385 */ |
| 384 String toString(); | 386 String toString(); |
| 385 } | 387 } |
| 386 | 388 |
| 387 | 389 |
| 388 /** | 390 /** |
| 389 * Representation of a content type. | 391 * Representation of a content type. |
| 390 */ | 392 */ |
| 391 interface ContentType extends HeaderValue default _ContentType { | 393 abstract class ContentType implements HeaderValue { |
| 392 /** | 394 /** |
| 393 * Creates a new content type object setting the primary type and | 395 * Creates a new content type object setting the primary type and |
| 394 * sub type. If either is not passed their values will be the empty | 396 * sub type. |
| 395 * string. | |
| 396 */ | 397 */ |
| 397 ContentType([String primaryType, String subType]); | 398 factory ContentType([String primaryType = "", String subType = ""]) { |
| 399 return new _ContentType(primaryType, subType); |
| 400 } |
| 398 | 401 |
| 399 /** | 402 /** |
| 400 * Creates a new content type object from parsing a Content-Type | 403 * Creates a new content type object from parsing a Content-Type |
| 401 * header value. As primary type, sub type and parameter names and | 404 * header value. As primary type, sub type and parameter names and |
| 402 * values are not case sensitive all these values will be converted | 405 * values are not case sensitive all these values will be converted |
| 403 * to lower case. Parsing this string | 406 * to lower case. Parsing this string |
| 404 * | 407 * |
| 405 * text/html; charset=utf-8 | 408 * text/html; charset=utf-8 |
| 406 * | 409 * |
| 407 * will create a content type object with primary type [:text:], sub | 410 * will create a content type object with primary type [:text:], sub |
| 408 * type [:html:] and parameter [:charset:] with value [:utf-8:]. | 411 * type [:html:] and parameter [:charset:] with value [:utf-8:]. |
| 409 */ | 412 */ |
| 410 ContentType.fromString(String value); | 413 factory ContentType.fromString(String value) { |
| 414 return new _ContentType.fromString(value); |
| 415 } |
| 411 | 416 |
| 412 /** | 417 /** |
| 413 * Gets and sets the content type in the form "primaryType/subType". | 418 * Gets and sets the content type in the form "primaryType/subType". |
| 414 */ | 419 */ |
| 415 String value; | 420 String value; |
| 416 | 421 |
| 417 /** | 422 /** |
| 418 * Gets and sets the primary type. | 423 * Gets and sets the primary type. |
| 419 */ | 424 */ |
| 420 String primaryType; | 425 String primaryType; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 431 } | 436 } |
| 432 | 437 |
| 433 | 438 |
| 434 /** | 439 /** |
| 435 * Representation of a cookie. For cookies received by the server as | 440 * Representation of a cookie. For cookies received by the server as |
| 436 * Cookie header values only [:name:] and [:value:] fields will be | 441 * Cookie header values only [:name:] and [:value:] fields will be |
| 437 * set. When building a cookie for the Set-Cookie header in the server | 442 * set. When building a cookie for the Set-Cookie header in the server |
| 438 * and when receiving cookies in the client as Set-Cookie headers all | 443 * and when receiving cookies in the client as Set-Cookie headers all |
| 439 * fields can be used. | 444 * fields can be used. |
| 440 */ | 445 */ |
| 441 interface Cookie default _Cookie { | 446 abstract class Cookie { |
| 442 /** | 447 /** |
| 443 * Creates a new cookie optionally setting the name and value. | 448 * Creates a new cookie optionally setting the name and value. |
| 444 */ | 449 */ |
| 445 Cookie([String name, String value]); | 450 factory Cookie([String name, String value]) => new _Cookie(name, value); |
| 446 | 451 |
| 447 /** | 452 /** |
| 448 * Creates a new cookie by parsing a header value from a Set-Cookie | 453 * Creates a new cookie by parsing a header value from a Set-Cookie |
| 449 * header. | 454 * header. |
| 450 */ | 455 */ |
| 451 Cookie.fromSetCookieValue(String value); | 456 factory Cookie.fromSetCookieValue(String value) { |
| 457 return new _Cookie.fromSetCookieValue(value); |
| 458 } |
| 452 | 459 |
| 453 /** | 460 /** |
| 454 * Gets and sets the name. | 461 * Gets and sets the name. |
| 455 */ | 462 */ |
| 456 String name; | 463 String name; |
| 457 | 464 |
| 458 /** | 465 /** |
| 459 * Gets and sets the value. | 466 * Gets and sets the value. |
| 460 */ | 467 */ |
| 461 String value; | 468 String value; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 * string representation can be used for for setting the Cookie or | 503 * string representation can be used for for setting the Cookie or |
| 497 * Set-Cookie headers | 504 * Set-Cookie headers |
| 498 */ | 505 */ |
| 499 String toString(); | 506 String toString(); |
| 500 } | 507 } |
| 501 | 508 |
| 502 | 509 |
| 503 /** | 510 /** |
| 504 * Http request delivered to the HTTP server callback. | 511 * Http request delivered to the HTTP server callback. |
| 505 */ | 512 */ |
| 506 interface HttpRequest default _HttpRequest { | 513 abstract class HttpRequest { |
| 507 /** | 514 /** |
| 508 * Returns the content length of the request body. If the size of | 515 * Returns the content length of the request body. If the size of |
| 509 * the request body is not known in advance this -1. | 516 * the request body is not known in advance this -1. |
| 510 */ | 517 */ |
| 511 int get contentLength; | 518 int get contentLength; |
| 512 | 519 |
| 513 /** | 520 /** |
| 514 * Returns the persistent connection state signaled by the client. | 521 * Returns the persistent connection state signaled by the client. |
| 515 */ | 522 */ |
| 516 bool get persistentConnection; | 523 bool get persistentConnection; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 * Get information about the client connection. Returns [null] if the socket | 573 * Get information about the client connection. Returns [null] if the socket |
| 567 * isn't available. | 574 * isn't available. |
| 568 */ | 575 */ |
| 569 HttpConnectionInfo get connectionInfo; | 576 HttpConnectionInfo get connectionInfo; |
| 570 } | 577 } |
| 571 | 578 |
| 572 | 579 |
| 573 /** | 580 /** |
| 574 * HTTP response to be send back to the client. | 581 * HTTP response to be send back to the client. |
| 575 */ | 582 */ |
| 576 interface HttpResponse default _HttpResponse { | 583 abstract class HttpResponse { |
| 577 /** | 584 /** |
| 578 * Gets and sets the content length of the response. If the size of | 585 * Gets and sets the content length of the response. If the size of |
| 579 * the response is not known in advance set the content length to | 586 * the response is not known in advance set the content length to |
| 580 * -1 - which is also the default if not set. | 587 * -1 - which is also the default if not set. |
| 581 */ | 588 */ |
| 582 int contentLength; | 589 int contentLength; |
| 583 | 590 |
| 584 /** | 591 /** |
| 585 * Gets and sets the status code. Any integer value is accepted, but | 592 * Gets and sets the status code. Any integer value is accepted, but |
| 586 * for the official HTTP status codes use the fields from | 593 * for the official HTTP status codes use the fields from |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 | 649 |
| 643 /** | 650 /** |
| 644 * HTTP client factory. The [HttpClient] handles all the sockets associated | 651 * HTTP client factory. The [HttpClient] handles all the sockets associated |
| 645 * with the [HttpClientConnection]s and when the endpoint supports it, it will | 652 * with the [HttpClientConnection]s and when the endpoint supports it, it will |
| 646 * try to reuse opened sockets for several requests to support HTTP 1.1 | 653 * try to reuse opened sockets for several requests to support HTTP 1.1 |
| 647 * persistent connections. This means that sockets will be kept open for some | 654 * persistent connections. This means that sockets will be kept open for some |
| 648 * time after a requests have completed, unless HTTP procedures indicate that it | 655 * time after a requests have completed, unless HTTP procedures indicate that it |
| 649 * must be closed as part of completing the request. Use [:HttpClient.shutdown:] | 656 * must be closed as part of completing the request. Use [:HttpClient.shutdown:] |
| 650 * to force close the idle sockets. | 657 * to force close the idle sockets. |
| 651 */ | 658 */ |
| 652 interface HttpClient default _HttpClient { | 659 abstract class HttpClient { |
| 653 static const int DEFAULT_HTTP_PORT = 80; | 660 static const int DEFAULT_HTTP_PORT = 80; |
| 654 | 661 |
| 655 HttpClient(); | 662 factory HttpClient() => new _HttpClient(); |
| 656 | 663 |
| 657 /** | 664 /** |
| 658 * Opens a HTTP connection. The returned [HttpClientConnection] is | 665 * Opens a HTTP connection. The returned [HttpClientConnection] is |
| 659 * used to register callbacks for asynchronous events on the HTTP | 666 * used to register callbacks for asynchronous events on the HTTP |
| 660 * connection. The "Host" header for the request will be set to the | 667 * connection. The "Host" header for the request will be set to the |
| 661 * value [host]:[port]. This can be overridden through the | 668 * value [host]:[port]. This can be overridden through the |
| 662 * HttpClientRequest interface before the request is sent. NOTE if | 669 * HttpClientRequest interface before the request is sent. NOTE if |
| 663 * [host] is an IP address this will still be set in the "Host" | 670 * [host] is an IP address this will still be set in the "Host" |
| 664 * header. | 671 * header. |
| 665 */ | 672 */ |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 /** | 717 /** |
| 711 * A [HttpClientConnection] is returned by all [HttpClient] methods | 718 * A [HttpClientConnection] is returned by all [HttpClient] methods |
| 712 * that initiate a connection to an HTTP server. The handlers will be | 719 * that initiate a connection to an HTTP server. The handlers will be |
| 713 * called as the connection state progresses. | 720 * called as the connection state progresses. |
| 714 * | 721 * |
| 715 * The setting of all handlers is optional. If [onRequest] is not set | 722 * The setting of all handlers is optional. If [onRequest] is not set |
| 716 * the request will be send without any additional headers and an | 723 * the request will be send without any additional headers and an |
| 717 * empty body. If [onResponse] is not set the response will be read | 724 * empty body. If [onResponse] is not set the response will be read |
| 718 * and discarded. | 725 * and discarded. |
| 719 */ | 726 */ |
| 720 interface HttpClientConnection { | 727 abstract class HttpClientConnection { |
| 721 /** | 728 /** |
| 722 * Sets the handler that is called when the connection is established. | 729 * Sets the handler that is called when the connection is established. |
| 723 */ | 730 */ |
| 724 void set onRequest(void callback(HttpClientRequest request)); | 731 void set onRequest(void callback(HttpClientRequest request)); |
| 725 | 732 |
| 726 /** | 733 /** |
| 727 * Sets callback to be called when the request has been send and | 734 * Sets callback to be called when the request has been send and |
| 728 * the response is ready for processing. The callback is called when | 735 * the response is ready for processing. The callback is called when |
| 729 * all headers of the response are received and data is ready to be | 736 * all headers of the response are received and data is ready to be |
| 730 * received. | 737 * received. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 * Get information about the client connection. Returns [null] if the socket | 786 * Get information about the client connection. Returns [null] if the socket |
| 780 * isn't available. | 787 * isn't available. |
| 781 */ | 788 */ |
| 782 HttpConnectionInfo get connectionInfo; | 789 HttpConnectionInfo get connectionInfo; |
| 783 } | 790 } |
| 784 | 791 |
| 785 | 792 |
| 786 /** | 793 /** |
| 787 * HTTP request for a client connection. | 794 * HTTP request for a client connection. |
| 788 */ | 795 */ |
| 789 interface HttpClientRequest default _HttpClientRequest { | 796 abstract class HttpClientRequest { |
| 790 /** | 797 /** |
| 791 * Gets and sets the content length of the request. If the size of | 798 * Gets and sets the content length of the request. If the size of |
| 792 * the request is not known in advance set content length to -1, | 799 * the request is not known in advance set content length to -1, |
| 793 * which is also the default. | 800 * which is also the default. |
| 794 */ | 801 */ |
| 795 int contentLength; | 802 int contentLength; |
| 796 | 803 |
| 797 /** | 804 /** |
| 798 * Returns the request headers. | 805 * Returns the request headers. |
| 799 */ | 806 */ |
| (...skipping 19 matching lines...) Expand all Loading... |
| 819 * send. Calling any methods that will change the header after | 826 * send. Calling any methods that will change the header after |
| 820 * having retrieved the output stream will throw an exception. | 827 * having retrieved the output stream will throw an exception. |
| 821 */ | 828 */ |
| 822 OutputStream get outputStream; | 829 OutputStream get outputStream; |
| 823 } | 830 } |
| 824 | 831 |
| 825 | 832 |
| 826 /** | 833 /** |
| 827 * HTTP response for a client connection. | 834 * HTTP response for a client connection. |
| 828 */ | 835 */ |
| 829 interface HttpClientResponse default _HttpClientResponse { | 836 abstract class HttpClientResponse { |
| 830 /** | 837 /** |
| 831 * Returns the status code. | 838 * Returns the status code. |
| 832 */ | 839 */ |
| 833 int get statusCode; | 840 int get statusCode; |
| 834 | 841 |
| 835 /** | 842 /** |
| 836 * Returns the reason phrase associated with the status code. | 843 * Returns the reason phrase associated with the status code. |
| 837 */ | 844 */ |
| 838 String get reasonPhrase; | 845 String get reasonPhrase; |
| 839 | 846 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 869 /** | 876 /** |
| 870 * Returns the input stream for the response. This is used to read | 877 * Returns the input stream for the response. This is used to read |
| 871 * the response data. | 878 * the response data. |
| 872 */ | 879 */ |
| 873 InputStream get inputStream; | 880 InputStream get inputStream; |
| 874 } | 881 } |
| 875 | 882 |
| 876 /** | 883 /** |
| 877 * Connection information. | 884 * Connection information. |
| 878 */ | 885 */ |
| 879 interface HttpConnectionInfo { | 886 abstract class HttpConnectionInfo { |
| 880 String get remoteHost; | 887 String get remoteHost; |
| 881 int get remotePort; | 888 int get remotePort; |
| 882 int get localPort; | 889 int get localPort; |
| 883 } | 890 } |
| 884 | 891 |
| 885 | 892 |
| 886 /** | 893 /** |
| 887 * Redirect information. | 894 * Redirect information. |
| 888 */ | 895 */ |
| 889 interface RedirectInfo { | 896 abstract class RedirectInfo { |
| 890 /** | 897 /** |
| 891 * Returns the status code used for the redirect. | 898 * Returns the status code used for the redirect. |
| 892 */ | 899 */ |
| 893 int get statusCode; | 900 int get statusCode; |
| 894 | 901 |
| 895 /** | 902 /** |
| 896 * Returns the method used for the redirect. | 903 * Returns the method used for the redirect. |
| 897 */ | 904 */ |
| 898 String get method; | 905 String get method; |
| 899 | 906 |
| 900 /** | 907 /** |
| 901 * Returns the location for the redirect. | 908 * Returns the location for the redirect. |
| 902 */ | 909 */ |
| 903 Uri get location; | 910 Uri get location; |
| 904 } | 911 } |
| 905 | 912 |
| 906 | 913 |
| 907 /** | 914 /** |
| 908 * When detaching a socket from either the [:HttpServer:] or the | 915 * When detaching a socket from either the [:HttpServer:] or the |
| 909 * [:HttpClient:] due to a HTTP connection upgrade there might be | 916 * [:HttpClient:] due to a HTTP connection upgrade there might be |
| 910 * unparsed data already read from the socket. This unparsed data | 917 * unparsed data already read from the socket. This unparsed data |
| 911 * together with the detached socket is returned in an instance of | 918 * together with the detached socket is returned in an instance of |
| 912 * this class. | 919 * this class. |
| 913 */ | 920 */ |
| 914 interface DetachedSocket default _DetachedSocket { | 921 abstract class DetachedSocket { |
| 915 Socket get socket; | 922 Socket get socket; |
| 916 List<int> get unparsedData; | 923 List<int> get unparsedData; |
| 917 } | 924 } |
| 918 | 925 |
| 919 | 926 |
| 920 class HttpException implements Exception { | 927 class HttpException implements Exception { |
| 921 const HttpException([String this.message = ""]); | 928 const HttpException([String this.message = ""]); |
| 922 String toString() => "HttpException: $message"; | 929 String toString() => "HttpException: $message"; |
| 923 final String message; | 930 final String message; |
| 924 } | 931 } |
| 925 | 932 |
| 926 | 933 |
| 927 class RedirectException extends HttpException { | 934 class RedirectException extends HttpException { |
| 928 const RedirectException(String message, | 935 const RedirectException(String message, |
| 929 List<RedirectInfo> this.redirects) : super(message); | 936 List<RedirectInfo> this.redirects) : super(message); |
| 930 final List<RedirectInfo> redirects; | 937 final List<RedirectInfo> redirects; |
| 931 } | 938 } |
| 932 | 939 |
| 933 | 940 |
| 934 class RedirectLimitExceededException extends RedirectException { | 941 class RedirectLimitExceededException extends RedirectException { |
| 935 const RedirectLimitExceededException(List<RedirectInfo> redirects) | 942 const RedirectLimitExceededException(List<RedirectInfo> redirects) |
| 936 : super("Redirect limit exceeded", redirects); | 943 : super("Redirect limit exceeded", redirects); |
| 937 } | 944 } |
| 938 | 945 |
| 939 | 946 |
| 940 class RedirectLoopException extends RedirectException { | 947 class RedirectLoopException extends RedirectException { |
| 941 const RedirectLoopException(List<RedirectInfo> redirects) | 948 const RedirectLoopException(List<RedirectInfo> redirects) |
| 942 : super("Redirect loop detected", redirects); | 949 : super("Redirect loop detected", redirects); |
| 943 } | 950 } |
| OLD | NEW |