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

Unified Diff: sdk/lib/io/http.dart

Issue 18049002: Document HttpServer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/http.dart
diff --git a/sdk/lib/io/http.dart b/sdk/lib/io/http.dart
index 29d561dc3101543991c2e6e1b2b18de1c5cb40db..5ac4b094c0b44866bac5a6caa5c11701e727150e 100644
--- a/sdk/lib/io/http.dart
+++ b/sdk/lib/io/http.dart
@@ -55,11 +55,30 @@ abstract class HttpStatus {
/**
- * HTTP server.
+ * The [HttpServer] class implements the server side of the HTTP
+ * protocol. The [HttpServer] is a [Stream] of [HttpRequest]s, where the
+ * [HttpRequest] class have a [HttpResponse] associated, through the response
Bill Hesse 2013/06/27 10:21:03 Instead of ", where the ...", how about "Each [Htt
Anders Johnsen 2013/06/27 10:28:35 Done.
+ * field.
+ *
+ * Incomplete requests where all or parts of the header is missing, are
+ * ignored and no exceptions are generated for them. Likewise, when writing to a
Bill Hesse 2013/06/27 10:21:03 no exceptions or HttpRequest objects are generated
Anders Johnsen 2013/06/27 10:28:35 Done.
+ * [HttpResponse], any Socket exceptions are ignore and any future data is
Bill Hesse 2013/06/27 10:21:03 [Socket] exceptions? ignored What does "any f
Anders Johnsen 2013/06/27 10:28:35 Done.
+ * ignored.
+ *
+ * The [HttpRequest] implements a [Stream] and provided the body as such. If the
Bill Hesse 2013/06/27 10:21:03 The [HttpRequest] exposes the request headers, and
Anders Johnsen 2013/06/27 10:28:35 Done.
+ * body is unread, it'll be drained when the [HttpResponse] is being written
+ * to or closed.
+ *
+ * The following example shows how to bind a [HttpServer] to a IPv6
+ * [InternetAddress] on port 80, and listening to requests.
+ *
+ * HttpServer.bind(InternetAddress.ANY_IP_V6, 80).then((server) {
+ * server.listen((HttpRequest request) {
+ * // Handle requests.
Bill Hesse 2013/06/27 10:21:03 Would it be misleading to just show request.respon
Anders Johnsen 2013/06/27 10:28:35 I think so. I want the example to just show how to
+ * });
+ * });
*/
abstract class HttpServer implements Stream<HttpRequest> {
- // TODO(ajohnsen): Document with example, once the stream API is final.
- // TODO(ajohnsen): Add HttpServer.secure.
/**
* Starts listening for HTTP requests on the specified [address] and
* [port].
« 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