| 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'; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 response.headers.set(HttpHeaders.WWW_AUTHENTICATE, authHeader); | 58 response.headers.set(HttpHeaders.WWW_AUTHENTICATE, authHeader); |
| 59 unauthCount++; | 59 unauthCount++; |
| 60 } | 60 } |
| 61 | 61 |
| 62 var response = request.response; | 62 var response = request.response; |
| 63 if (request.headers[HttpHeaders.AUTHORIZATION] != null) { | 63 if (request.headers[HttpHeaders.AUTHORIZATION] != null) { |
| 64 Expect.equals(1, request.headers[HttpHeaders.AUTHORIZATION].length); | 64 Expect.equals(1, request.headers[HttpHeaders.AUTHORIZATION].length); |
| 65 String authorization = | 65 String authorization = |
| 66 request.headers[HttpHeaders.AUTHORIZATION][0]; | 66 request.headers[HttpHeaders.AUTHORIZATION][0]; |
| 67 HeaderValue header = | 67 HeaderValue header = |
| 68 new HeaderValue.fromString( | 68 HeaderValue.parse( |
| 69 authorization, parameterSeparator: ","); | 69 authorization, parameterSeparator: ","); |
| 70 if (header.value == "basic") { | 70 if (header.value == "basic") { |
| 71 sendUnauthorizedResponse(response); | 71 sendUnauthorizedResponse(response); |
| 72 } else if (!useNextNonce && nonceCount == nonceStaleAfter) { | 72 } else if (!useNextNonce && nonceCount == nonceStaleAfter) { |
| 73 nonce = "87654321"; | 73 nonce = "87654321"; |
| 74 nonceCount = 0; | 74 nonceCount = 0; |
| 75 sendUnauthorizedResponse(response, stale: true); | 75 sendUnauthorizedResponse(response, stale: true); |
| 76 } else { | 76 } else { |
| 77 var uri = header.parameters["uri"]; | 77 var uri = header.parameters["uri"]; |
| 78 var qop = header.parameters["qop"]; | 78 var qop = header.parameters["qop"]; |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 testAuthenticateCallback(null, null); | 384 testAuthenticateCallback(null, null); |
| 385 testAuthenticateCallback("MD5", null); | 385 testAuthenticateCallback("MD5", null); |
| 386 testAuthenticateCallback("MD5", "auth"); | 386 testAuthenticateCallback("MD5", "auth"); |
| 387 testAuthenticateCallback("MD5", "auth-int"); | 387 testAuthenticateCallback("MD5", "auth-int"); |
| 388 testStaleNonce(); | 388 testStaleNonce(); |
| 389 testNextNonce(); | 389 testNextNonce(); |
| 390 // These teste are not normally run. They can be used for locally | 390 // These teste are not normally run. They can be used for locally |
| 391 // testing with another web server (e.g. Apache). | 391 // testing with another web server (e.g. Apache). |
| 392 //testLocalServerDigest(); | 392 //testLocalServerDigest(); |
| 393 } | 393 } |
| OLD | NEW |