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

Unified Diff: lib/src/authentication_challenge.dart

Issue 1320533002: Add a CaseInsensitiveMap class. (Closed) Base URL: git@github.com:dart-lang/http_parser@master
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/http_parser.dart ('k') | lib/src/case_insensitive_map.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/authentication_challenge.dart
diff --git a/lib/src/authentication_challenge.dart b/lib/src/authentication_challenge.dart
index 3b70fed46e7b77456df378a57bd39515f115b06a..773ee3b81b6c8d45849a234f7de5f19c1f11b8bc 100644
--- a/lib/src/authentication_challenge.dart
+++ b/lib/src/authentication_challenge.dart
@@ -8,6 +8,7 @@ import 'dart:collection';
import 'package:string_scanner/string_scanner.dart';
+import 'case_insensitive_map.dart';
import 'scan.dart';
import 'utils.dart';
@@ -26,7 +27,8 @@ class AuthenticationChallenge {
/// The parameters describing how to authenticate.
///
- /// The semantics of these parameters are scheme-specific.
+ /// The semantics of these parameters are scheme-specific. The keys of this
+ /// map are case-insensitive.
final Map<String, String> parameters;
/// Parses a WWW-Authenticate header, which should contain one or more
@@ -59,7 +61,7 @@ class AuthenticationChallenge {
if (scanner.matches(",") || scanner.isDone) continue;
scanner.expect(token, name: "a token");
- var name = scanner.lastMatch[0].toLowerCase();
+ var name = scanner.lastMatch[0];
scanner.scan(whitespace);
// If there's no "=", then this is another challenge rather than a
@@ -129,7 +131,7 @@ class AuthenticationChallenge {
/// Scans a single authentication parameter and stores its result in [params].
static void _scanAuthParam(StringScanner scanner, Map params) {
scanner.expect(token, name: "a token");
- var name = scanner.lastMatch[0].toLowerCase();
+ var name = scanner.lastMatch[0];
scanner.scan(whitespace);
scanner.expect('=');
scanner.scan(whitespace);
@@ -146,5 +148,6 @@ class AuthenticationChallenge {
/// Creates a new challenge value with [scheme] and [parameters].
AuthenticationChallenge(this.scheme, Map<String, String> parameters)
- : parameters = new UnmodifiableMapView(parameters);
+ : parameters = new UnmodifiableMapView(
+ new CaseInsensitiveMap.from(parameters));
}
« no previous file with comments | « lib/http_parser.dart ('k') | lib/src/case_insensitive_map.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698