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

Side by Side Diff: tests/standalone/io/http_auth_digest_test.dart

Issue 14595008: Fix digest authentication to use the correct URI (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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/io/http_impl.dart ('k') | no next file » | 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 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
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"];
79 var cnonce = header.parameters["cnonce"]; 79 var cnonce = header.parameters["cnonce"];
80 var nc = header.parameters["nc"]; 80 var nc = header.parameters["nc"];
81 Expect.equals("digest", header.value.toLowerCase()); 81 Expect.equals("digest", header.value.toLowerCase());
82 Expect.equals("dart", header.parameters["username"]); 82 Expect.equals("dart", header.parameters["username"]);
83 Expect.equals(realm, header.parameters["realm"]); 83 Expect.equals(realm, header.parameters["realm"]);
84 Expect.equals("MD5", header.parameters["algorithm"]); 84 Expect.equals("MD5", header.parameters["algorithm"]);
85 Expect.equals(nonce, header.parameters["nonce"]); 85 Expect.equals(nonce, header.parameters["nonce"]);
86 Expect.equals(request.uri.path, uri); 86 Expect.equals(request.uri.toString(), uri);
87 if (qop != null) { 87 if (qop != null) {
88 // A server qop of auth-int is downgraded to none by the client. 88 // A server qop of auth-int is downgraded to none by the client.
89 Expect.equals("auth", serverQop); 89 Expect.equals("auth", serverQop);
90 Expect.equals("auth", header.parameters["qop"]); 90 Expect.equals("auth", header.parameters["qop"]);
91 Expect.isNotNull(cnonce); 91 Expect.isNotNull(cnonce);
92 Expect.isNotNull(nc); 92 Expect.isNotNull(nc);
93 Expect.isFalse(ncs.contains(nc)); 93 Expect.isFalse(ncs.contains(nc));
94 ncs.add(nc); 94 ncs.add(nc);
95 } else { 95 } else {
96 Expect.isNull(cnonce); 96 Expect.isNull(cnonce);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 return response.fold(null, (x, y) {}); 194 return response.fold(null, (x, y) {});
195 }); 195 });
196 } 196 }
197 197
198 client.addCredentials( 198 client.addCredentials(
199 Uri.parse("http://127.0.0.1:${server.port}/digest"), 199 Uri.parse("http://127.0.0.1:${server.port}/digest"),
200 "test", 200 "test",
201 new HttpClientDigestCredentials("dart", "password")); 201 new HttpClientDigestCredentials("dart", "password"));
202 202
203 var futures = []; 203 var futures = [];
204 for (int i = 0; i < 5; i++) { 204 for (int i = 0; i < 2; i++) {
205 String uriBase = "http://127.0.0.1:${server.port}/digest";
205 futures.add( 206 futures.add(
206 makeRequest( 207 makeRequest(
207 Uri.parse("http://127.0.0.1:${server.port}/digest"))); 208 Uri.parse(uriBase)));
209 futures.add(
210 makeRequest(
211 Uri.parse("$uriBase?querystring")));
212 futures.add(
213 makeRequest(
214 Uri.parse("$uriBase?querystring#fragment")));
208 } 215 }
209 Future.wait(futures).then((_) { 216 Future.wait(futures).then((_) {
210 server.shutdown(); 217 server.shutdown();
211 client.close(); 218 client.close();
212 }); 219 });
213 }); 220 });
214 } 221 }
215 222
216 void testAuthenticateCallback(String algorithm, String qop) { 223 void testAuthenticateCallback(String algorithm, String qop) {
217 Server.start(algorithm, qop).then((server) { 224 Server.start(algorithm, qop).then((server) {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 testAuthenticateCallback(null, null); 391 testAuthenticateCallback(null, null);
385 testAuthenticateCallback("MD5", null); 392 testAuthenticateCallback("MD5", null);
386 testAuthenticateCallback("MD5", "auth"); 393 testAuthenticateCallback("MD5", "auth");
387 testAuthenticateCallback("MD5", "auth-int"); 394 testAuthenticateCallback("MD5", "auth-int");
388 testStaleNonce(); 395 testStaleNonce();
389 testNextNonce(); 396 testNextNonce();
390 // These teste are not normally run. They can be used for locally 397 // These teste are not normally run. They can be used for locally
391 // testing with another web server (e.g. Apache). 398 // testing with another web server (e.g. Apache).
392 //testLocalServerDigest(); 399 //testLocalServerDigest();
393 } 400 }
OLDNEW
« no previous file with comments | « sdk/lib/io/http_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698