Author: sebb
Date: Thu Feb  8 16:28:48 2007
New Revision: 505097

URL: http://svn.apache.org/viewvc?view=rev&rev=505097
Log:
Use new Domain/realm fields in HttpClient sampler

Modified:
    
jakarta/jmeter/branches/rel-2-2/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java
    jakarta/jmeter/branches/rel-2-2/xdocs/changes.xml

Modified: 
jakarta/jmeter/branches/rel-2-2/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java?view=diff&rev=505097&r1=505096&r2=505097
==============================================================================
--- 
jakarta/jmeter/branches/rel-2-2/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java
 (original)
+++ 
jakarta/jmeter/branches/rel-2-2/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java
 Thu Feb  8 16:28:48 2007
@@ -468,32 +468,16 @@
                if (authManager != null) {
             Authorization auth = authManager.getAuthForURL(u);
             if (auth != null) {
-                    /*
-                     * TODO: better method...
-                     * HACK: if user contains \ and or @
-                     * then assume it is of the form:
-                     * domain \ user @ realm (without spaces)
-                     */
-                    String user = auth.getUser();
-                    String realm=null;
-                    String domain="";// $NON-NLS-1$
-                    String username="";// $NON-NLS-1$
-                    int bs=user.indexOf('\\'); // $NON-NLS-1$
-                    int at=user.indexOf('@'); // $NON-NLS-1$
-                    if (bs > 0) {
-                        domain=user.substring(0,bs);
-                    }
-                    if (at > 0 && at > bs+1) {
-                        realm=user.substring(at+1);
-                    } else {
-                        at = user.length();
-                    }
-                    username=user.substring(bs+1,at);
+                    String username = auth.getUser();
+                    String realm = auth.getRealm();
+                    String domain = auth.getDomain();
                     if (log.isDebugEnabled()){
-                        log.debug(user + " >  D="+ username + " D="+domain+" 
R="+realm);
+                        log.debug(username + " >  D="+ username + " 
D="+domain+" R="+realm);
                     }
                                        client.getState().setCredentials(
-                            new 
AuthScope(u.getHost(),u.getPort(),realm,AuthScope.ANY_SCHEME),
+                            new AuthScope(u.getHost(),u.getPort(),
+                                       realm.length()==0 ? null : realm //"" 
is not the same as no realm
+                                       ,AuthScope.ANY_SCHEME),
                             // NT Includes other types of Credentials
                             new NTCredentials(
                                                                        
username, 

Modified: jakarta/jmeter/branches/rel-2-2/xdocs/changes.xml
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/xdocs/changes.xml?view=diff&rev=505097&r1=505096&r2=505097
==============================================================================
--- jakarta/jmeter/branches/rel-2-2/xdocs/changes.xml (original)
+++ jakarta/jmeter/branches/rel-2-2/xdocs/changes.xml Thu Feb  8 16:28:48 2007
@@ -40,7 +40,11 @@
 <br/>
 jmeterthread.reversePostProcessors=true
 </p>
-
+<p>
+The HTTP Authorisation Manager now has extra columns for domain and realm, 
+so the temporary work-round of using '\' and '@' in the username to delimit 
the domain and realm
+has been removed.
+</p>
 <h4>New functionality:</h4>
 <ul>
 <li>Added httpclient.parameters.file to allow HttpClient parameters to be 
defined</li>
@@ -52,6 +56,7 @@
 <li>Bug 41457 - Add TCP Sampler option to not re-use connections</li>
 <li>Bug 41522 - Use JUnit sampler name in sample results</li>
 <li>HttpClient now behaves the same as the JDK http sampler for invalid 
certificates etc</li>
+<li>Add Domain and Realm support to HTTP Authorisation Manager</li>
 </ul>
 
 <h4>Bug fixes:</h4>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to