Author: sebb
Date: Tue Nov  6 09:24:23 2007
New Revision: 592492

URL: http://svn.apache.org/viewvc?rev=592492&view=rev
Log:
Proxy Server now removes If-Modified-Since headers by default.

Modified:
    jakarta/jmeter/trunk/bin/jmeter.properties
    
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
    jakarta/jmeter/trunk/xdocs/changes.xml
    jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml

Modified: jakarta/jmeter/trunk/bin/jmeter.properties
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/bin/jmeter.properties?rev=592492&r1=592491&r2=592492&view=diff
==============================================================================
--- jakarta/jmeter/trunk/bin/jmeter.properties (original)
+++ jakarta/jmeter/trunk/bin/jmeter.properties Tue Nov  6 09:24:23 2007
@@ -340,6 +340,10 @@
 # Default content-type exclude filter to use
 #proxy.content_type_exclude=image/.*|text/css|application/.*
 
+# Default headers to remove from Header Manager elements
+# (Cookie and Authorization are always removed)
+#proxy.headers.remove=If-Modified-Since
+
 #---------------------------------------------------------------------------
 # JMeter Proxy configuration
 #---------------------------------------------------------------------------

Modified: 
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java?rev=592492&r1=592491&r2=592492&view=diff
==============================================================================
--- 
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
 (original)
+++ 
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
 Tue Nov  6 09:24:23 2007
@@ -35,7 +35,9 @@
 import org.apache.jmeter.protocol.http.util.HTTPConstants;
 import org.apache.jmeter.samplers.SampleResult;
 import org.apache.jmeter.testelement.TestElement;
+import org.apache.jmeter.util.JMeterUtils;
 import org.apache.jorphan.logging.LoggingManager;
+import org.apache.jorphan.util.JOrphanUtils;
 import org.apache.log.Logger;
 
 /**
@@ -46,10 +48,25 @@
  * 
  */
 public class Proxy extends Thread {
-    private static final Logger log = LoggingManager.getLoggerForClass();
+       private static final Logger log = LoggingManager.getLoggerForClass();
 
     private static final String NEW_LINE = "\n"; // $NON-NLS-1$
 
+    private static final String[] headersToRemove;
+
+    // Allow list of headers to be overridden
+       private static final String PROXY_HEADERS_REMOVE = 
"proxy.headers.remove"; // $NON-NLS-1$
+
+       private static final String PROXY_HEADERS_REMOVE_DEFAULT = 
"If-Modified-Since"; // $NON-NLS-1$
+
+    private static final String PROXY_HEADERS_REMOVE_SEPARATOR = ","; // 
$NON-NLS-1$
+
+    static {
+       String removeList = 
JMeterUtils.getPropDefault(PROXY_HEADERS_REMOVE,PROXY_HEADERS_REMOVE_DEFAULT);
+       headersToRemove = 
JOrphanUtils.split(removeList,PROXY_HEADERS_REMOVE_SEPARATOR);
+       log.info("Proxy will remove the headers: "+removeList);
+    }
+
        /** Socket to client. */
        private Socket clientSocket = null;
 
@@ -180,7 +197,11 @@
                         * We don't want to store any cookies in the generated 
test plan
                         */
                        headers.removeHeaderNamed("cookie");// Always remove 
cookies // $NON-NLS-1$
-                       headers.removeHeaderNamed("Authorization");// Always 
remove cookies // $NON-NLS-1$
+                       headers.removeHeaderNamed("Authorization");// Always 
remove authorization // $NON-NLS-1$
+                       // Remove additional headers
+                       for(int i=0; i < headersToRemove.length; i++){
+                               headers.removeHeaderNamed(headersToRemove[i]);
+                       }
                } catch (UnknownHostException uhe) {
                        log.warn("Server Not Found.", uhe);
                        writeErrorToClient(HttpReplyHdr.formServerNotFound());

Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=592492&r1=592491&r2=592492&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Tue Nov  6 09:24:23 2007
@@ -40,6 +40,8 @@
 <br></br>
 To revert to the earlier behaviour, define the JMeter property: 
server.rmi.create=false.
 </li>
+<li>The Proxy server removes If-Modified-Since headers from generated Header 
Managers.
+To revert to the previous behaviour, define the property proxy.headers.remove 
with no value</li>
 </ul>
 
 <h4>Bug fixes</h4>
@@ -85,6 +87,8 @@
 <li>Bug 43678 - Handle META tag http-equiv charset</li>
 <li>Bug 42555 - [I18N] Proposed corrections for the french translation</li>
 <li>Bug 43727 - Test Action does not support variables or functions</li>
+<li>The Proxy server removes If-Modified-Since headers from generated Header 
Managers by default.
+To change the list of removed headers, define the property 
proxy.headers.remove as a comma-separated list of headers to remove</li>
 </ul>
 
 <h4>Non-functional Improvements</h4>

Modified: jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=592492&r1=592491&r2=592492&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml (original)
+++ jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml Tue Nov  6 
09:24:23 2007
@@ -3508,7 +3508,13 @@
            If you are using grouping, please ensure that you leave the 
required gap between clicks.
         </property>
         <!-- TODO:property name="Group Separation Interval">Inactivity time 
between two requests needed to consider them in two separate 
groups.</property-->
-               <property name="Capture HTTP Headers" required="Yes">Should 
headers be added to the plan?</property>
+               <property name="Capture HTTP Headers" required="Yes">Should 
headers be added to the plan?
+               If specified, a Header Manager will be added to each HTTP 
Sampler.
+               The Proxy server always removes Cookie and Authorization 
headers from the generated Header Managers.
+               By default it also removes If-Modified-Since headers.
+        To change which additional headers are removed, define the JMeter 
property <b>proxy.headers.remove</b>
+        as a comma-separated list of headers.
+        </property>
                <property name="Add Assertions" required="Yes">Add a blank 
assertion to each sampler?</property>
                <property name="Regex Matching" required="Yes">Use Regex 
Matching when replacing variables?</property>
         <property name="Type" required="Yes">Which type of sampler to generate 
(the Java default or HTTPClient)</property>



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

Reply via email to