You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2005/11/20 19:58:38 UTC

svn commit: r345777 - /jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java

Author: sebb
Date: Sun Nov 20 10:58:35 2005
New Revision: 345777

URL: http://svn.apache.org/viewcvs?rev=345777&view=rev
Log:
Use setEncodingAndType etc

Modified:
    jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java

Modified: jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java
URL: http://svn.apache.org/viewcvs/jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java?rev=345777&r1=345776&r2=345777&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java (original)
+++ jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java Sun Nov 20 10:58:35 2005
@@ -27,6 +27,7 @@
 import java.util.zip.GZIPInputStream;
 
 import org.apache.jmeter.protocol.http.control.AuthManager;
+import org.apache.jmeter.protocol.http.control.Authorization;
 import org.apache.jmeter.protocol.http.control.CookieManager;
 import org.apache.jmeter.protocol.http.control.Header;
 import org.apache.jmeter.protocol.http.control.HeaderManager;
@@ -48,7 +49,7 @@
  * 
  */
 public class HTTPSampler extends HTTPSamplerBase {
-	private transient static Logger log = LoggingManager.getLoggerForClass();
+	private static final Logger log = LoggingManager.getLoggerForClass();
 
 	private static final int MAX_CONN_RETRIES = 10; // Maximum connection
 
@@ -361,9 +362,9 @@
 	 */
 	private void setConnectionAuthorization(HttpURLConnection conn, URL u, AuthManager authManager) {
 		if (authManager != null) {
-			String authHeader = authManager.getAuthHeaderForURL(u);
-			if (authHeader != null) {
-				conn.setRequestProperty("Authorization", authHeader);
+			Authorization auth = authManager.getAuthForURL(u);
+			if (auth != null) {
+				conn.setRequestProperty("Authorization", auth.toBasicHeader());
 			}
 		}
 	}
@@ -451,24 +452,7 @@
 
 			String ct = conn.getContentType();// getHeaderField("Content-type");
 			res.setContentType(ct);// e.g. text/html; charset=ISO-8859-1
-			if (ct != null) {
-				// Extract charset and store as DataEncoding
-				// TODO do we need process http-equiv META tags, e.g.:
-				// <META http-equiv="content-type" content="text/html;
-				// charset=foobar">
-				// or can we leave that to the renderer ?
-				String de = ct.toLowerCase();
-				final String cs = "charset=";
-				int cset = de.indexOf(cs);
-				if (cset >= 0) {
-					res.setDataEncoding(de.substring(cset + cs.length()));
-				}
-				if (ct.startsWith("image/")) {
-					res.setDataType(HTTPSampleResult.BINARY);
-				} else {
-					res.setDataType(HTTPSampleResult.TEXT);
-				}
-			}
+            res.setEncodingAndType(ct);
 
 			res.setResponseHeaders(getResponseHeaders(conn));
 			if (res.isRedirect()) {



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