hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From micha...@apache.org
Subject svn commit: r1666507 - in /httpcomponents/httpclient/branches/HTTPCLIENT-1625: ./ src/main/java/org/apache/http/auth/ src/main/java/org/apache/http/client/config/ src/main/java/org/apache/http/conn/util/ src/test/java/org/apache/http/auth/ src/test/jav...
Date Fri, 13 Mar 2015 16:27:39 GMT
Author: michaelo
Date: Fri Mar 13 16:27:39 2015
New Revision: 1666507

URL: http://svn.apache.org/r1666507
Log:
Merge trunk into branch HTTPCLIENT-1625

Added:
    httpcomponents/httpclient/branches/HTTPCLIENT-1625/src/test/java/org/apache/http/auth/TestAuthScope.java
      - copied unchanged from r1666502, httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/auth/TestAuthScope.java
Modified:
    httpcomponents/httpclient/branches/HTTPCLIENT-1625/   (props changed)
    httpcomponents/httpclient/branches/HTTPCLIENT-1625/src/main/java/org/apache/http/auth/AuthScope.java
    httpcomponents/httpclient/branches/HTTPCLIENT-1625/src/main/java/org/apache/http/client/config/RequestConfig.java
    httpcomponents/httpclient/branches/HTTPCLIENT-1625/src/main/java/org/apache/http/conn/util/InetAddressUtils.java
    httpcomponents/httpclient/branches/HTTPCLIENT-1625/src/test/java/org/apache/http/conn/util/TestInetAddressUtils.java
    httpcomponents/httpclient/branches/HTTPCLIENT-1625/src/test/java/org/apache/http/impl/client/TestBasicCredentialsProvider.java

Propchange: httpcomponents/httpclient/branches/HTTPCLIENT-1625/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Mar 13 16:27:39 2015
@@ -4,3 +4,4 @@
 /httpcomponents/httpclient/branches/branch_4_1/httpclient:755593-811107
 /httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient:1154913-1160573
 /httpcomponents/httpclient/branches/notice-plugin-test/httpclient:1024348-1031454
+/httpcomponents/httpclient/trunk/httpclient:1663433-1666502

Modified: httpcomponents/httpclient/branches/HTTPCLIENT-1625/src/main/java/org/apache/http/auth/AuthScope.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/HTTPCLIENT-1625/src/main/java/org/apache/http/auth/AuthScope.java?rev=1666507&r1=1666506&r2=1666507&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/HTTPCLIENT-1625/src/main/java/org/apache/http/auth/AuthScope.java
(original)
+++ httpcomponents/httpclient/branches/HTTPCLIENT-1625/src/main/java/org/apache/http/auth/AuthScope.java
Fri Mar 13 16:27:39 2015
@@ -129,7 +129,7 @@ public class AuthScope {
             final String realm,
             final String schemeName) {
         Args.notNull(origin, "Host");
-        this.host = origin.getHostName();
+        this.host = origin.getHostName().toLowerCase(Locale.ROOT);
         this.port = origin.getPort() < 0 ? ANY_PORT : origin.getPort();
         this.realm = realm == null ? ANY_REALM : realm;
         this.scheme = schemeName == null ? ANY_SCHEME : schemeName.toUpperCase(Locale.ROOT);

Modified: httpcomponents/httpclient/branches/HTTPCLIENT-1625/src/main/java/org/apache/http/client/config/RequestConfig.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/HTTPCLIENT-1625/src/main/java/org/apache/http/client/config/RequestConfig.java?rev=1666507&r1=1666506&r2=1666507&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/HTTPCLIENT-1625/src/main/java/org/apache/http/client/config/RequestConfig.java
(original)
+++ httpcomponents/httpclient/branches/HTTPCLIENT-1625/src/main/java/org/apache/http/client/config/RequestConfig.java
Fri Mar 13 16:27:39 2015
@@ -325,7 +325,8 @@ public class RequestConfig implements Cl
     @Override
     public String toString() {
         final StringBuilder builder = new StringBuilder();
-        builder.append(", expectContinueEnabled=").append(expectContinueEnabled);
+        builder.append("[");
+        builder.append("expectContinueEnabled=").append(expectContinueEnabled);
         builder.append(", proxy=").append(proxy);
         builder.append(", localAddress=").append(localAddress);
         builder.append(", cookieSpec=").append(cookieSpec);

Modified: httpcomponents/httpclient/branches/HTTPCLIENT-1625/src/main/java/org/apache/http/conn/util/InetAddressUtils.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/HTTPCLIENT-1625/src/main/java/org/apache/http/conn/util/InetAddressUtils.java?rev=1666507&r1=1666506&r2=1666507&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/HTTPCLIENT-1625/src/main/java/org/apache/http/conn/util/InetAddressUtils.java
(original)
+++ httpcomponents/httpclient/branches/HTTPCLIENT-1625/src/main/java/org/apache/http/conn/util/InetAddressUtils.java
Fri Mar 13 16:27:39 2015
@@ -43,7 +43,8 @@ public class InetAddressUtils {
     }
 
     private static final String IPV4_BASIC_PATTERN_STRING =
-            "(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}" + // initial 3 fields,
0-255 followed by .
+            "(([1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){1}" + // initial first
field, 1-255
+            "(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){2}" + // following 2 fields,
0-255 followed by .
              "([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])"; // final field, 0-255
 
     private static final Pattern IPV4_PATTERN =

Modified: httpcomponents/httpclient/branches/HTTPCLIENT-1625/src/test/java/org/apache/http/conn/util/TestInetAddressUtils.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/HTTPCLIENT-1625/src/test/java/org/apache/http/conn/util/TestInetAddressUtils.java?rev=1666507&r1=1666506&r2=1666507&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/HTTPCLIENT-1625/src/test/java/org/apache/http/conn/util/TestInetAddressUtils.java
(original)
+++ httpcomponents/httpclient/branches/HTTPCLIENT-1625/src/test/java/org/apache/http/conn/util/TestInetAddressUtils.java
Fri Mar 13 16:27:39 2015
@@ -48,6 +48,7 @@ public class TestInetAddressUtils {
         Assert.assertFalse(InetAddressUtils.isIPv4Address("g.ar.ba.ge"));
         Assert.assertFalse(InetAddressUtils.isIPv4Address("192.168.0"));
         Assert.assertFalse(InetAddressUtils.isIPv4Address("256.255.255.255"));
+        Assert.assertFalse(InetAddressUtils.isIPv4Address("0.168.0.0"));    //IP address
that starts with zero not allowed
     }
 
     @Test

Modified: httpcomponents/httpclient/branches/HTTPCLIENT-1625/src/test/java/org/apache/http/impl/client/TestBasicCredentialsProvider.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/HTTPCLIENT-1625/src/test/java/org/apache/http/impl/client/TestBasicCredentialsProvider.java?rev=1666507&r1=1666506&r2=1666507&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/HTTPCLIENT-1625/src/test/java/org/apache/http/impl/client/TestBasicCredentialsProvider.java
(original)
+++ httpcomponents/httpclient/branches/HTTPCLIENT-1625/src/test/java/org/apache/http/impl/client/TestBasicCredentialsProvider.java
Fri Mar 13 16:27:39 2015
@@ -26,6 +26,7 @@
  */
 package org.apache.http.impl.client;
 
+import org.apache.http.HttpHost;
 import org.apache.http.auth.AuthScope;
 import org.apache.http.auth.Credentials;
 import org.apache.http.auth.UsernamePasswordCredentials;
@@ -125,39 +126,13 @@ public class TestBasicCredentialsProvide
     }
 
     @Test
-    public void testScopeMatching() {
-        final AuthScope authscope1 = new AuthScope("somehost", 80, "somerealm", "somescheme");
-        final AuthScope authscope2 = new AuthScope("someotherhost", 80, "somerealm", "somescheme");
-        Assert.assertTrue(authscope1.match(authscope2) < 0);
-
-        int m1 = authscope1.match(
-            new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, AuthScope.ANY_REALM, "somescheme"));
-        int m2 = authscope1.match(
-            new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, "somerealm", AuthScope.ANY_SCHEME));
-        Assert.assertTrue(m2 > m1);
-
-        m1 = authscope1.match(
-            new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, AuthScope.ANY_REALM, "somescheme"));
-        m2 = authscope1.match(
-            new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, "somerealm", AuthScope.ANY_SCHEME));
-        Assert.assertTrue(m2 > m1);
-
-        m1 = authscope1.match(
-            new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, "somerealm", "somescheme"));
-        m2 = authscope1.match(
-            new AuthScope(AuthScope.ANY_HOST, 80, AuthScope.ANY_REALM, AuthScope.ANY_SCHEME));
-        Assert.assertTrue(m2 > m1);
-
-        m1 = authscope1.match(
-            new AuthScope(AuthScope.ANY_HOST, 80, "somerealm", "somescheme"));
-        m2 = authscope1.match(
-            new AuthScope("somehost", AuthScope.ANY_PORT, AuthScope.ANY_REALM, AuthScope.ANY_SCHEME));
-        Assert.assertTrue(m2 > m1);
-
-        m1 = authscope1.match(AuthScope.ANY);
-        m2 = authscope1.match(
-            new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, AuthScope.ANY_REALM, "somescheme"));
-        Assert.assertTrue(m2 > m1);
+    public void testMixedCaseHostname() throws Exception {
+        final HttpHost httpHost = new HttpHost("hOsT", 80);
+        final BasicCredentialsProvider state = new BasicCredentialsProvider();
+        final Credentials expected = new UsernamePasswordCredentials("name", "pass");
+        state.setCredentials(new AuthScope(httpHost), expected);
+        final Credentials got = state.getCredentials(DEFSCOPE);
+        Assert.assertEquals(expected, got);
     }
 
     @Test



Mime
View raw message