Make scheme & realm comparisons case insensitive.
This is a manual cherry pick of change
https://github.com/square/okhttp/pull/345
bug: 11473660
Change-Id: Ic757bec6c63ebad7f06922c16120f9b6161b7691
diff --git a/src/main/java/com/squareup/okhttp/internal/http/HttpAuthenticator.java b/src/main/java/com/squareup/okhttp/internal/http/HttpAuthenticator.java
index 63f39e4..1ad3689 100644
--- a/src/main/java/com/squareup/okhttp/internal/http/HttpAuthenticator.java
+++ b/src/main/java/com/squareup/okhttp/internal/http/HttpAuthenticator.java
@@ -39,7 +39,7 @@
@Override public Credential authenticate(
Proxy proxy, URL url, List<Challenge> challenges) throws IOException {
for (Challenge challenge : challenges) {
- if (!"Basic".equals(challenge.getScheme())) {
+ if (!"Basic".equalsIgnoreCase(challenge.getScheme())) {
continue;
}
@@ -56,7 +56,7 @@
@Override public Credential authenticateProxy(
Proxy proxy, URL url, List<Challenge> challenges) throws IOException {
for (Challenge challenge : challenges) {
- if (!"Basic".equals(challenge.getScheme())) {
+ if (!"Basic".equalsIgnoreCase(challenge.getScheme())) {
continue;
}
@@ -146,7 +146,7 @@
// It needs to be fixed to handle any scheme and any parameters
// http://code.google.com/p/android/issues/detail?id=11140
- if (!value.regionMatches(pos, "realm=\"", 0, "realm=\"".length())) {
+ if (!value.regionMatches(true, pos, "realm=\"", 0, "realm=\"".length())) {
break; // Unexpected challenge parameter; give up!
}