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

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

Issue 14028017: Remove .writeStream, .consume and rewrite IOSink to correctly implement a (sane) well-defined behav… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add new test file. Created 7 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
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 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 * If no charset is provided the default of ISO-8859-1 (Latin 1) will 696 * If no charset is provided the default of ISO-8859-1 (Latin 1) will
697 * be used. 697 * be used.
698 * 698 *
699 * HttpResponse response = ... 699 * HttpResponse response = ...
700 * response.headers.add(HttpHeaders.CONTENT_TYPE, "text/plain"); 700 * response.headers.add(HttpHeaders.CONTENT_TYPE, "text/plain");
701 * response.write(...); // Strings written will be ISO-8859-1 encoded. 701 * response.write(...); // Strings written will be ISO-8859-1 encoded.
702 * 702 *
703 * If an unsupported encoding is used an exception will be thrown if 703 * If an unsupported encoding is used an exception will be thrown if
704 * using one of the write methods taking a string. 704 * using one of the write methods taking a string.
705 */ 705 */
706 abstract class HttpResponse implements IOSink<HttpResponse> { 706 abstract class HttpResponse implements IOSink {
707 // TODO(ajohnsen): Add documentation of how to pipe a file to the response. 707 // TODO(ajohnsen): Add documentation of how to pipe a file to the response.
708 /** 708 /**
709 * Gets and sets the content length of the response. If the size of 709 * Gets and sets the content length of the response. If the size of
710 * the response is not known in advance set the content length to 710 * the response is not known in advance set the content length to
711 * -1 - which is also the default if not set. 711 * -1 - which is also the default if not set.
712 */ 712 */
713 int contentLength; 713 int contentLength;
714 714
715 /** 715 /**
716 * Gets and sets the status code. Any integer value is accepted. For 716 * Gets and sets the status code. Any integer value is accepted. For
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 * If no charset is provided the default of ISO-8859-1 (Latin 1) will 1005 * If no charset is provided the default of ISO-8859-1 (Latin 1) will
1006 * be used. 1006 * be used.
1007 * 1007 *
1008 * HttpClientRequest request = ... 1008 * HttpClientRequest request = ...
1009 * request.headers.add(HttpHeaders.CONTENT_TYPE, "text/plain"); 1009 * request.headers.add(HttpHeaders.CONTENT_TYPE, "text/plain");
1010 * request.write(...); // Strings written will be ISO-8859-1 encoded. 1010 * request.write(...); // Strings written will be ISO-8859-1 encoded.
1011 * 1011 *
1012 * If an unsupported encoding is used an exception will be thrown if 1012 * If an unsupported encoding is used an exception will be thrown if
1013 * using one of the write methods taking a string. 1013 * using one of the write methods taking a string.
1014 */ 1014 */
1015 abstract class HttpClientRequest 1015 abstract class HttpClientRequest implements IOSink {
1016 implements IOSink<HttpClientResponse> {
1017 /** 1016 /**
1018 * Gets and sets the content length of the request. If the size of 1017 * Gets and sets the content length of the request. If the size of
1019 * the request is not known in advance set content length to -1, 1018 * the request is not known in advance set content length to -1,
1020 * which is also the default. 1019 * which is also the default.
1021 */ 1020 */
1022 int contentLength; 1021 int contentLength;
1023 1022
1024 /** 1023 /**
1025 * Returns the request headers. 1024 * Returns the request headers.
1026 */ 1025 */
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1265 class RedirectLimitExceededException extends RedirectException { 1264 class RedirectLimitExceededException extends RedirectException {
1266 const RedirectLimitExceededException(List<RedirectInfo> redirects) 1265 const RedirectLimitExceededException(List<RedirectInfo> redirects)
1267 : super("Redirect limit exceeded", redirects); 1266 : super("Redirect limit exceeded", redirects);
1268 } 1267 }
1269 1268
1270 1269
1271 class RedirectLoopException extends RedirectException { 1270 class RedirectLoopException extends RedirectException {
1272 const RedirectLoopException(List<RedirectInfo> redirects) 1271 const RedirectLoopException(List<RedirectInfo> redirects)
1273 : super("Redirect loop detected", redirects); 1272 : super("Redirect loop detected", redirects);
1274 } 1273 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698