| OLD | NEW |
| 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 http_server; | 5 library http_server.virtual_host; |
| 6 | 6 |
| 7 import 'dart:async'; |
| 8 import 'dart:io'; |
| 7 | 9 |
| 8 /** | 10 /** |
| 9 * The [VirtualHost] class is a utility class for handling multiple hosts on | 11 * The [VirtualHost] class is a utility class for handling multiple hosts on |
| 10 * multiple sources, by using a named-based approach. | 12 * multiple sources, by using a named-based approach. |
| 11 */ | 13 */ |
| 12 abstract class VirtualHost { | 14 abstract class VirtualHost { |
| 13 /** | 15 /** |
| 14 * Get the [Stream] of [HttpRequest]s, not matching any hosts. If unused, the | 16 * Get the [Stream] of [HttpRequest]s, not matching any hosts. If unused, the |
| 15 * default implementation will result in a [HttpHeaders.FORBIDDEN] response. | 17 * default implementation will result in a [HttpHeaders.FORBIDDEN] response. |
| 16 */ | 18 */ |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 142 |
| 141 void _unhandled(HttpRequest request) { | 143 void _unhandled(HttpRequest request) { |
| 142 if (_unhandledController != null) { | 144 if (_unhandledController != null) { |
| 143 _unhandledController.add(request); | 145 _unhandledController.add(request); |
| 144 return; | 146 return; |
| 145 } | 147 } |
| 146 request.response.statusCode = HttpStatus.FORBIDDEN; | 148 request.response.statusCode = HttpStatus.FORBIDDEN; |
| 147 request.response.close(); | 149 request.response.close(); |
| 148 } | 150 } |
| 149 } | 151 } |
| OLD | NEW |