| 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 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 import 'dart:async'; | 6 import 'dart:async'; |
| 7 import 'dart:crypto'; | 7 import 'dart:crypto'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 import 'dart:isolate'; | 9 import 'dart:isolate'; |
| 10 import 'dart:uri'; | 10 import 'dart:uri'; |
| 11 import 'dart:utf'; | 11 import 'dart:utf'; |
| 12 | 12 |
| 13 class Server { | 13 class Server { |
| 14 HttpServer server; | 14 HttpServer server; |
| 15 bool passwordChanged = false; | 15 bool passwordChanged = false; |
| 16 | 16 |
| 17 Future<Server> start() { | 17 Future<Server> start() { |
| 18 var completer = new Completer(); | 18 var completer = new Completer(); |
| 19 HttpServer.bind().then((s) { | 19 HttpServer.bind("127.0.0.1", 0).then((s) { |
| 20 server = s; | 20 server = s; |
| 21 server.listen((HttpRequest request) { | 21 server.listen((HttpRequest request) { |
| 22 var response = request.response; | 22 var response = request.response; |
| 23 if (request.uri.path == "/passwdchg") { | 23 if (request.uri.path == "/passwdchg") { |
| 24 passwordChanged = true; | 24 passwordChanged = true; |
| 25 response.close(); | 25 response.close(); |
| 26 return; | 26 return; |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 String username; | 29 String username; |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 main() { | 260 main() { |
| 261 testUrlUserInfo(); | 261 testUrlUserInfo(); |
| 262 testBasicNoCredentials(); | 262 testBasicNoCredentials(); |
| 263 testBasicCredentials(); | 263 testBasicCredentials(); |
| 264 testBasicAuthenticateCallback(); | 264 testBasicAuthenticateCallback(); |
| 265 // These teste are not normally run. They can be used for locally | 265 // These teste are not normally run. They can be used for locally |
| 266 // testing with another web server (e.g. Apache). | 266 // testing with another web server (e.g. Apache). |
| 267 //testLocalServerBasic(); | 267 //testLocalServerBasic(); |
| 268 //testLocalServerDigest(); | 268 //testLocalServerDigest(); |
| 269 } | 269 } |
| OLD | NEW |