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

Unified Diff: sdk/lib/io/http_impl.dart

Issue 209443005: Add optimized _OneByteString.toLowerCase. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Optimize toLowerCase. Created 6 years, 9 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
Index: sdk/lib/io/http_impl.dart
diff --git a/sdk/lib/io/http_impl.dart b/sdk/lib/io/http_impl.dart
index 207c08d104d4d423ffcc6ea8c197f211c02aa1cc..8dd0bae65df1fa075afad9a95d8c9647449f1e9e 100644
--- a/sdk/lib/io/http_impl.dart
+++ b/sdk/lib/io/http_impl.dart
@@ -364,7 +364,7 @@ class _HttpClientResponse
// Digest authentication only supports the MD5 algorithm.
if (cr.scheme == _AuthenticationScheme.DIGEST &&
(header.parameters["algorithm"] == null ||
- header.parameters["algorithm"].toLowerCase() == "md5")) {
+ _ASCII.toLowerCase(header.parameters["algorithm"]) == "md5")) {
if (cr.nonce == null || cr.nonce == header.parameters["nonce"]) {
// If the nonce is not set then this is the first authenticate
// response for these credentials. Set up authentication state.
@@ -377,7 +377,7 @@ class _HttpClientResponse
// Credentials where found, prepare for retrying the request.
return retry();
} else if (header.parameters["stale"] != null &&
- header.parameters["stale"].toLowerCase() == "true") {
+ _ASCII.toLowerCase(header.parameters["stale"]) == "true") {
// If stale is true retry with new nonce.
cr.nonce = header.parameters["nonce"];
// Credentials where found, prepare for retrying the request.
@@ -926,7 +926,8 @@ class _HttpOutgoing implements StreamConsumer<List<int>> {
if (acceptEncodings != null &&
acceptEncodings
.expand((list) => list.split(","))
- .any((encoding) => encoding.trim().toLowerCase() == "gzip") &&
+ .any((encoding) =>
+ _ASCII.toLowerCase(encoding.trim()) == "gzip") &&
contentEncoding == null) {
outbound.headers.set(HttpHeaders.CONTENT_ENCODING, "gzip");
gzip = true;
@@ -2349,8 +2350,9 @@ class _AuthenticationScheme {
const _AuthenticationScheme(this._scheme);
factory _AuthenticationScheme.fromString(String scheme) {
- if (scheme.toLowerCase() == "basic") return BASIC;
- if (scheme.toLowerCase() == "digest") return DIGEST;
+ scheme = _ASCII.toLowerCase(scheme);
+ if (scheme == "basic") return BASIC;
+ if (scheme == "digest") return DIGEST;
return UNKNOWN;
}

Powered by Google App Engine
This is Rietveld 408576698