commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r368699 - in /jakarta/commons/proper/httpclient/trunk: release_notes.txt src/java/org/apache/commons/httpclient/auth/DigestScheme.java src/test/org/apache/commons/httpclient/auth/TestDigestAuth.java
Date Fri, 13 Jan 2006 12:25:01 GMT
Author: olegk
Date: Fri Jan 13 04:24:45 2006
New Revision: 368699

URL: http://svn.apache.org/viewcvs?rev=368699&view=rev
Log:
PR #38043 (Digest auth uses incorrect URI)

Changelog:
* Digest URI changed to include query parameters

Contributed by Oleg Kalnichevski
Reviewed by Michael Becke and Ortwin Gl├╝ck

Modified:
    jakarta/commons/proper/httpclient/trunk/release_notes.txt
    jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/auth/DigestScheme.java
    jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/auth/TestDigestAuth.java

Modified: jakarta/commons/proper/httpclient/trunk/release_notes.txt
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/httpclient/trunk/release_notes.txt?rev=368699&r1=368698&r2=368699&view=diff
==============================================================================
--- jakarta/commons/proper/httpclient/trunk/release_notes.txt (original)
+++ jakarta/commons/proper/httpclient/trunk/release_notes.txt Fri Jan 13 04:24:45 2006
@@ -1,5 +1,8 @@
 Changes since Release 3.0:
 
+ * 38043 - Digest URI changed to include query parameters
+           Contributed by Oleg Kalnichevski <olegk at apache.org>
+
  * 38004 - Fixed bug causing cyclic redirects when virtual host is set
            Contributed by Oleg Kalnichevski <olegk at apache.org>
 

Modified: jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/auth/DigestScheme.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/auth/DigestScheme.java?rev=368699&r1=368698&r2=368699&view=diff
==============================================================================
--- jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/auth/DigestScheme.java
(original)
+++ jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/auth/DigestScheme.java
Fri Jan 13 04:24:45 2006
@@ -304,7 +304,15 @@
                     + credentials.getClass().getName());
         }
         getParameters().put("methodname", method.getName());
-        getParameters().put("uri", method.getPath());
+        StringBuffer buffer = new StringBuffer(method.getPath());
+        String query = method.getQueryString();
+        if (query != null) {
+            if (query.indexOf("?") != 0) {
+                buffer.append("?");
+            }
+            buffer.append(method.getQueryString());
+        }
+        getParameters().put("uri", buffer.toString());
         String charset = getParameter("charset");
         if (charset == null) {
             getParameters().put("charset", method.getParams().getCredentialCharset());

Modified: jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/auth/TestDigestAuth.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/auth/TestDigestAuth.java?rev=368699&r1=368698&r2=368699&view=diff
==============================================================================
--- jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/auth/TestDigestAuth.java
(original)
+++ jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/auth/TestDigestAuth.java
Fri Jan 13 04:24:45 2006
@@ -126,6 +126,22 @@
         assertEquals("e95a7ddf37c2eab009568b1ed134f89a", table.get("response"));
     }
 
+    public void testDigestAuthenticationWithQueryStringInDigestURI() throws Exception {
+        String challenge = "Digest realm=\"realm1\", nonce=\"f2a3f18799759d4f1a1c068b92b573cb\"";
+        UsernamePasswordCredentials cred = new UsernamePasswordCredentials("username","password");
+        FakeHttpMethod method = new FakeHttpMethod("/");
+        method.setQueryString("param=value");
+        AuthScheme authscheme = new DigestScheme();
+        authscheme.processChallenge(challenge);
+        String response = authscheme.authenticate(cred, method);
+        Map table = AuthChallengeParser.extractParams(response);
+        assertEquals("username", table.get("username"));
+        assertEquals("realm1", table.get("realm"));
+        assertEquals("/?param=value", table.get("uri"));
+        assertEquals("f2a3f18799759d4f1a1c068b92b573cb", table.get("nonce"));
+        assertEquals("a847f58f5fef0bc087bcb9c3eb30e042", table.get("response"));
+    }
+
     public void testDigestAuthenticationWithMultipleRealms() throws Exception {
         String challenge1 = "Digest realm=\"realm1\", nonce=\"abcde\"";
         String challenge2 = "Digest realm=\"realm2\", nonce=\"123546\"";



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message