 Chromium Code Reviews
 Chromium Code Reviews Issue 11299228:
  Add HttpsServer class and test.  (Closed) 
  Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
    
  
    Issue 11299228:
  Add HttpsServer class and test.  (Closed) 
  Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart| 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 abstract class 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; | 
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 55 /** | 55 /** | 
| 56 * HTTP server. | 56 * HTTP server. | 
| 57 */ | 57 */ | 
| 58 abstract class HttpServer { | 58 abstract class HttpServer { | 
| 59 factory HttpServer() => new _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 * The optional argument [certificate_name] is used by the HttpsServer | 
| 67 * class, which shares the same interface. | |
| 68 * See [addRequestHandler] and [defaultRequestHandler] for | |
| 67 * information on how incoming HTTP requests are handled. | 69 * information on how incoming HTTP requests are handled. | 
| 68 */ | 70 */ | 
| 69 void listen(String host, int port, {int backlog: 128}); | 71 void listen(String host, | 
| 
Mads Ager (google)
2012/11/29 09:45:24
When we are splitting out the abstract classes I d
 | |
| 72 int port, | |
| 73 {int backlog: 128, | |
| 74 String certificate_name}); | |
| 
Mads Ager (google)
2012/11/29 09:45:24
I would indent this line by one more char, but tha
 | |
| 70 | 75 | 
| 71 /** | 76 /** | 
| 72 * Attach the HTTP server to an existing [:ServerSocket:]. If the | 77 * Attach the HTTP server to an existing [:ServerSocket:]. If the | 
| 73 * [HttpServer] is closed, the [HttpServer] will just detach itself, | 78 * [HttpServer] is closed, the [HttpServer] will just detach itself, | 
| 74 * and not close [serverSocket]. | 79 * and not close [serverSocket]. | 
| 75 */ | 80 */ | 
| 76 void listenOn(ServerSocket serverSocket); | 81 void listenOn(ServerSocket serverSocket); | 
| 77 | 82 | 
| 78 /** | 83 /** | 
| 79 * Adds a request handler to the list of request handlers. The | 84 * Adds a request handler to the list of request handlers. The | 
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 | 125 | 
| 121 /** | 126 /** | 
| 122 * Returns a [:HttpConnectionsInfo:] object with an overview of the | 127 * Returns a [:HttpConnectionsInfo:] object with an overview of the | 
| 123 * current connection handled by the server. | 128 * current connection handled by the server. | 
| 124 */ | 129 */ | 
| 125 HttpConnectionsInfo connectionsInfo(); | 130 HttpConnectionsInfo connectionsInfo(); | 
| 126 } | 131 } | 
| 127 | 132 | 
| 128 | 133 | 
| 129 /** | 134 /** | 
| 135 * HTTPS server. | |
| 136 */ | |
| 137 abstract class HttpsServer implements HttpServer { | |
| 138 factory HttpsServer() => new _HttpServer.httpsServer(); | |
| 139 } | |
| 140 | |
| 141 | |
| 142 /** | |
| 130 * Overview information of the [:HttpServer:] socket connections. | 143 * Overview information of the [:HttpServer:] socket connections. | 
| 131 */ | 144 */ | 
| 132 class HttpConnectionsInfo { | 145 class HttpConnectionsInfo { | 
| 133 /** | 146 /** | 
| 134 * Total number of socket connections. | 147 * Total number of socket connections. | 
| 135 */ | 148 */ | 
| 136 int total = 0; | 149 int total = 0; | 
| 137 | 150 | 
| 138 /** | 151 /** | 
| 139 * Number of active connections where actual request/response | 152 * Number of active connections where actual request/response | 
| (...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1093 class RedirectLimitExceededException extends RedirectException { | 1106 class RedirectLimitExceededException extends RedirectException { | 
| 1094 const RedirectLimitExceededException(List<RedirectInfo> redirects) | 1107 const RedirectLimitExceededException(List<RedirectInfo> redirects) | 
| 1095 : super("Redirect limit exceeded", redirects); | 1108 : super("Redirect limit exceeded", redirects); | 
| 1096 } | 1109 } | 
| 1097 | 1110 | 
| 1098 | 1111 | 
| 1099 class RedirectLoopException extends RedirectException { | 1112 class RedirectLoopException extends RedirectException { | 
| 1100 const RedirectLoopException(List<RedirectInfo> redirects) | 1113 const RedirectLoopException(List<RedirectInfo> redirects) | 
| 1101 : super("Redirect loop detected", redirects); | 1114 : super("Redirect loop detected", redirects); | 
| 1102 } | 1115 } | 
| OLD | NEW |