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

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

Issue 14640008: Change the signature for all network bind calls. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments by whesse@ Created 7 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 | « sdk/lib/_internal/compiler/implementation/lib/io_patch.dart ('k') | sdk/lib/io/http_impl.dart » ('j') | 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 /** 57 /**
58 * HTTP server. 58 * HTTP server.
59 */ 59 */
60 abstract class HttpServer implements Stream<HttpRequest> { 60 abstract class HttpServer implements Stream<HttpRequest> {
61 // TODO(ajohnsen): Document with example, once the stream API is final. 61 // TODO(ajohnsen): Document with example, once the stream API is final.
62 // TODO(ajohnsen): Add HttpServer.secure. 62 // TODO(ajohnsen): Add HttpServer.secure.
63 /** 63 /**
64 * Starts listening for HTTP requests on the specified [address] and 64 * Starts listening for HTTP requests on the specified [address] and
65 * [port]. 65 * [port].
66 * 66 *
67 * The default value for [address] is 127.0.0.1, which will allow 67 * The [address] can either be a [String] or an
68 * only incoming connections from the local host. To allow for 68 * [InternetAddress]. If [address] is a [String], [bind] will
69 * incoming connection from the network use either the value 0.0.0.0 69 * perform a [InternetAddress.lookup] and use the first value in the
70 * to bind to all interfaces or the IP address of a specific 70 * list. To listen on the loopback adapter, which will allow only
71 * interface. 71 * incoming connections from the local host, use the value
72 * [InternetAddress.LOOPBACK_IP_V4] or
73 * [InternetAddress.LOOPBACK_IP_V6]. To allow for incoming
74 * connection from the network use either one of the values
75 * [InternetAddress.ANY_IP_V4] or [InternetAddress.ANY_IP_V6] to
76 * bind to all interfaces or the IP address of a specific interface.
72 * 77 *
73 * If [port] has the value [:0:] (the default) an ephemeral port 78 * If an IP version 6 (IPv6) address is used, both IP version 6
74 * will be chosen by the system. The actual port used can be 79 * (IPv6) and version 4 (IPv4) connections will be accepted. To
75 * retrieved using the [:port:] getter. 80 * restrict this to version 6 (IPv6) only, use [HttpServer.listenOn]
81 * with a [ServerSocket] configured for IP version 6 connections
82 * only.
83 *
84 * If [port] has the value [:0:] an ephemeral port will be chosen by
85 * the system. The actual port used can be retrieved using the
86 * [port] getter.
76 * 87 *
77 * The optional argument [backlog] can be used to specify the listen 88 * The optional argument [backlog] can be used to specify the listen
78 * backlog for the underlying OS listen setup. If [backlog] has the 89 * backlog for the underlying OS listen setup. If [backlog] has the
79 * value of [:0:] (the default) a reasonable value will be chosen by 90 * value of [:0:] (the default) a reasonable value will be chosen by
80 * the system. 91 * the system.
81 */ 92 */
82 static Future<HttpServer> bind([String address = "127.0.0.1", 93 static Future<HttpServer> bind(address,
83 int port = 0, 94 int port,
84 int backlog = 0]) 95 {int backlog: 0})
85 => _HttpServer.bind(address, port, backlog); 96 => _HttpServer.bind(address, port, backlog);
86 97
87 /** 98 /**
88 * Starts listening for HTTPS requests on the specified [address] and 99 * The [address] can either be a [String] or an
89 * [port]. If a [port] of 0 is specified the server will choose an 100 * [InternetAddress]. If [address] is a [String], [bind] will
90 * ephemeral port. The optional argument [backlog] can be used to 101 * perform a [InternetAddress.lookup] and use the first value in the
91 * specify the listen backlog for the underlying OS listen 102 * list. To listen on the loopback adapter, which will allow only
92 * setup. 103 * incoming connections from the local host, use the value
104 * [InternetAddress.LOOPBACK_IP_V4] or
105 * [InternetAddress.LOOPBACK_IP_V6]. To allow for incoming
106 * connection from the network use either one of the values
107 * [InternetAddress.ANY_IP_V4] or [InternetAddress.ANY_IP_V6] to
108 * bind to all interfaces or the IP address of a specific interface.
109 *
110 * If an IP version 6 (IPv6) address is used, both IP version 6
111 * (IPv6) and version 4 (IPv4) connections will be accepted. To
112 * restrict this to version 6 (IPv6) only, use [HttpServer.listenOn]
113 * with a [ServerSocket] configured for IP version 6 connections
114 * only.
115 *
116 * If [port] has the value [:0:] an ephemeral port will be chosen by
117 * the system. The actual port used can be retrieved using the
118 * [port] getter.
119 *
120 * The optional argument [backlog] can be used to specify the listen
121 * backlog for the underlying OS listen setup. If [backlog] has the
122 * value of [:0:] (the default) a reasonable value will be chosen by
123 * the system.
93 * 124 *
94 * The certificate with Distinguished Name [certificateName] is looked 125 * The certificate with Distinguished Name [certificateName] is looked
95 * up in the certificate database, and is used as the server certificate. 126 * up in the certificate database, and is used as the server certificate.
96 * if [requestClientCertificate] is true, the server will request clients 127 * if [requestClientCertificate] is true, the server will request clients
97 * to authenticate with a client certificate. 128 * to authenticate with a client certificate.
98 */ 129 */
99 130
100 static Future<HttpServer> bindSecure(String address, 131 static Future<HttpServer> bindSecure(address,
101 int port, 132 int port,
102 {int backlog: 0, 133 {int backlog: 0,
103 String certificateName, 134 String certificateName,
104 bool requestClientCertificate: false}) 135 bool requestClientCertificate: false})
105 => _HttpServer.bindSecure(address, 136 => _HttpServer.bindSecure(address,
106 port, 137 port,
107 backlog, 138 backlog,
108 certificateName, 139 certificateName,
109 requestClientCertificate); 140 requestClientCertificate);
110 141
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 721
691 /** 722 /**
692 * Gets the [HttpResponse] object, used for sending back the response to the 723 * Gets the [HttpResponse] object, used for sending back the response to the
693 * client. 724 * client.
694 */ 725 */
695 HttpResponse get response; 726 HttpResponse get response;
696 } 727 }
697 728
698 729
699 /** 730 /**
700 * HTTP response to be send back to the client. 731 * An [HttpResponse] represents the headers and data to be returned to
732 * a client in response to an HTTP request.
701 * 733 *
702 * This object has a number of properties for setting up the HTTP 734 * This object has a number of properties for setting up the HTTP
703 * header of the response. When the header has been set up the methods 735 * header of the response. When the header has been set up the methods
704 * from the [IOSink] can be used to write the actual body of the HTTP 736 * from the [IOSink] can be used to write the actual body of the HTTP
705 * response. When one of the [IOSink] methods is used for the 737 * response. When one of the [IOSink] methods is used for the
706 * first time the request header is send. Calling any methods that 738 * first time the request header is send. Calling any methods that
707 * will change the header after it is sent will throw an exception. 739 * will change the header after it is sent will throw an exception.
708 * 740 *
709 * When writing string data through the [IOSink] the encoding used 741 * When writing string data through the [IOSink] the encoding used
710 * will be determined from the "charset" parameter of the 742 * will be determined from the "charset" parameter of the
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 class RedirectLimitExceededException extends RedirectException { 1352 class RedirectLimitExceededException extends RedirectException {
1321 const RedirectLimitExceededException(List<RedirectInfo> redirects) 1353 const RedirectLimitExceededException(List<RedirectInfo> redirects)
1322 : super("Redirect limit exceeded", redirects); 1354 : super("Redirect limit exceeded", redirects);
1323 } 1355 }
1324 1356
1325 1357
1326 class RedirectLoopException extends RedirectException { 1358 class RedirectLoopException extends RedirectException {
1327 const RedirectLoopException(List<RedirectInfo> redirects) 1359 const RedirectLoopException(List<RedirectInfo> redirects)
1328 : super("Redirect loop detected", redirects); 1360 : super("Redirect loop detected", redirects);
1329 } 1361 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/lib/io_patch.dart ('k') | sdk/lib/io/http_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698