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

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

Issue 277783002: dart:io HttpServer.serverHeader - tweaks to doc comments (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 * 87 *
88 * The HttpRequest exposes the request headers and provides the request body, 88 * The HttpRequest exposes the request headers and provides the request body,
89 * if it exists, as a Stream of data. If the body is unread, it is drained 89 * if it exists, as a Stream of data. If the body is unread, it is drained
90 * when the server writes to the HttpResponse or closes it. 90 * when the server writes to the HttpResponse or closes it.
91 * 91 *
92 * ## Bind with a secure HTTPS connection 92 * ## Bind with a secure HTTPS connection
93 * 93 *
94 * Use [bindSecure] to create an HTTPS server. 94 * Use [bindSecure] to create an HTTPS server.
95 * 95 *
96 * The server presents a certificate to the client. In the following 96 * The server presents a certificate to the client. In the following
97 * example, the certificate is named `localhost_cert` and comes from 97 * example, the certificate is named `localhost_cert` and comes from
98 * the database found in the `pkcert` directory. 98 * the database found in the `pkcert` directory.
99 * 99 *
100 * import 'dart:io'; 100 * import 'dart:io';
101 * import "dart:isolate"; 101 * import "dart:isolate";
102 * 102 *
103 * main() { 103 * main() {
104 * var testPkcertDatabase = Platform.script.resolve('pkcert') 104 * var testPkcertDatabase = Platform.script.resolve('pkcert')
105 * .toFilePath(); 105 * .toFilePath();
106 * SecureSocket.initialize(database: testPkcertDatabase, 106 * SecureSocket.initialize(database: testPkcertDatabase,
107 * password: 'dartdart'); 107 * password: 'dartdart');
108 * 108 *
109 * HttpServer 109 * HttpServer
(...skipping 28 matching lines...) Expand all
138 * socket.write('Hello, client.'); 138 * socket.write('Hello, client.');
139 * }); 139 * });
140 * }); 140 * });
141 * } 141 * }
142 * 142 *
143 * ## Other resources 143 * ## Other resources
144 * 144 *
145 * * HttpServer is a Stream. Refer to the [Stream] class for information 145 * * HttpServer is a Stream. Refer to the [Stream] class for information
146 * about the streaming qualities of an HttpServer. 146 * about the streaming qualities of an HttpServer.
147 * Pausing the subscription of the stream, pauses at the OS level. 147 * Pausing the subscription of the stream, pauses at the OS level.
148 * 148 *
149 * * The [http_server](https://pub.dartlang.org/packages/http_server) 149 * * The [http_server](https://pub.dartlang.org/packages/http_server)
150 * package on pub.dartlang.org contains a set of high-level classes that, 150 * package on pub.dartlang.org contains a set of high-level classes that,
151 * together with this class, makes it easy to provide content through HTTP 151 * together with this class, makes it easy to provide content through HTTP
152 * servers. 152 * servers.
153 */ 153 */
154 abstract class HttpServer implements Stream<HttpRequest> { 154 abstract class HttpServer implements Stream<HttpRequest> {
155 /** 155 /**
156 * Set and get the default value of the `Server` header for all responses 156 * Get and set the default value of the `Server` header for all responses
157 * generated by this [HttpServer]. By default, it's disabled. 157 * generated by this [HttpServer].
158 * 158 *
159 * If the serverHeader is set to `null`, no default `Server` header will be 159 * If [serverHeader] is `null`, no `Server` header will be added to each
160 * added to each response. 160 * response.
161 *
162 * The default value is `null`.
161 */ 163 */
162 String serverHeader; 164 String serverHeader;
163 165
164 /** 166 /**
165 * Get or set the timeout used for idle keep-alive connections. If no further 167 * Get or set the timeout used for idle keep-alive connections. If no further
166 * request is seen within [idleTimeout] after the previous request was 168 * request is seen within [idleTimeout] after the previous request was
167 * completed, the connection is dropped. 169 * completed, the connection is dropped.
168 * 170 *
169 * Default is 120 seconds. 171 * Default is 120 seconds.
170 * 172 *
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 982
981 /** 983 /**
982 * An HTTP response, which returns the headers and data 984 * An HTTP response, which returns the headers and data
983 * from the server to the client in response to an HTTP request. 985 * from the server to the client in response to an HTTP request.
984 * 986 *
985 * Every HttpRequest object provides access to the associated [HttpResponse] 987 * Every HttpRequest object provides access to the associated [HttpResponse]
986 * object through the `response` property. 988 * object through the `response` property.
987 * The server sends its response to the client by writing to the 989 * The server sends its response to the client by writing to the
988 * HttpResponse object. 990 * HttpResponse object.
989 * 991 *
990 * ## Writing the response 992 * ## Writing the response
991 * 993 *
992 * This class implements [IOSink]. 994 * This class implements [IOSink].
993 * After the header has been set up, the methods 995 * After the header has been set up, the methods
994 * from IOSink, such as `writeln()`, can be used to write 996 * from IOSink, such as `writeln()`, can be used to write
995 * the body of the HTTP response. 997 * the body of the HTTP response.
996 * Use the `close()` method to close the response and send it to the client. 998 * Use the `close()` method to close the response and send it to the client.
997 * 999 *
998 * server.listen((HttpRequest request) { 1000 * server.listen((HttpRequest request) {
999 * request.response.write('Hello, world!'); 1001 * request.response.write('Hello, world!');
1000 * request.response.close(); 1002 * request.response.close();
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
1911 class RedirectException implements HttpException { 1913 class RedirectException implements HttpException {
1912 final String message; 1914 final String message;
1913 final List<RedirectInfo> redirects; 1915 final List<RedirectInfo> redirects;
1914 1916
1915 const RedirectException(this.message, this.redirects); 1917 const RedirectException(this.message, this.redirects);
1916 1918
1917 String toString() => "RedirectException: $message"; 1919 String toString() => "RedirectException: $message";
1918 1920
1919 Uri get uri => redirects.last.location; 1921 Uri get uri => redirects.last.location;
1920 } 1922 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698