jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1859523 - in /jmeter/trunk: src/core/org/apache/jmeter/resources/ src/protocol/http/org/apache/jmeter/protocol/http/proxy/ src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/ xdocs/
Date Sun, 19 May 2019 20:55:31 GMT
Author: pmouawad
Date: Sun May 19 20:55:31 2019
New Revision: 1859523

URL: http://svn.apache.org/viewvc?rev=1859523&view=rev
Log:
Bug 63129 - JMeter can not identify encoding during first time page submission

This closes #441
Bugzilla Id: 63129

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
    jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/AbstractSamplerCreator.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Daemon.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/DefaultSamplerCreator.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties?rev=1859523&r1=1859522&r2=1859523&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties Sun May 19 20:55:31
2019
@@ -831,6 +831,7 @@ proxy_daemon_msg_created_in_bin=created
 proxy_daemon_msg_check_expiration=Certificate has a duration validity of {0} days, <br>if
the created one (see below) is newer than the last one you installed, <br>ensure you
remove the old one and install the new one.
 proxy_daemon_msg_install_as_in_doc=You can install it following instructions in <i>Component
Reference</i> documentation <br>See <i>Installing the JMeter CA certificate
for HTTPS recording</i> paragraph.
 proxy_daemon_msg_rootca_cert=Root CA certificate
+proxy_default_encoding=Recording's default encoding
 proxy_domains=HTTPS Domains\:
 proxy_domains_dynamic_mode_tooltip=List of domain names for HTTPS url, ex. jmeter.apache.org
or wildcard domain like *.apache.org. Use comma as separator. 
 proxy_domains_dynamic_mode_tooltip_java6=To activate this field, use a Java 7+ runtime environment

Modified: jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties?rev=1859523&r1=1859522&r2=1859523&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties Sun May 19 20:55:31
2019
@@ -820,6 +820,7 @@ proxy_daemon_msg_check_expiration=Le cer
 proxy_daemon_msg_created_in_bin=créé dans le répertoire bin de JMeter
 proxy_daemon_msg_install_as_in_doc=Vous pouvez l'installer en suivant les instructions de
la documentation <i>Component Reference</i> <br> (voir le paragraphe <i>Installing
the JMeter CA certificate for HTTPS recording</i>)
 proxy_daemon_msg_rootca_cert=Certificat AC raçine \:
+proxy_default_encoding=Encodage par défaut de l'enregistrement
 proxy_domains=Domaines HTTPS \:
 proxy_domains_dynamic_mode_tooltip=Liste de noms de domaine pour les url HTTPS, ex. jmeter.apache.org
ou les domaines wildcard comme *.apache.org. Utiliser la virgule comme séparateur. 
 proxy_domains_dynamic_mode_tooltip_java6=Pour activer ce champ, utiliser un environnement
d'exécution Java 7+

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/AbstractSamplerCreator.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/AbstractSamplerCreator.java?rev=1859523&r1=1859522&r2=1859523&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/AbstractSamplerCreator.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/AbstractSamplerCreator.java
Sun May 19 20:55:31 2019
@@ -38,7 +38,8 @@ public abstract class AbstractSamplerCre
 
     protected static final String HTTP = "http"; // $NON-NLS-1$
     protected static final String HTTPS = "https"; // $NON-NLS-1$
-
+    protected static final String DEFAULT_ENCODING_KEY = "__defaultEncoding"; // $NON-NLS-1$
+    
     /** FileType to be used for the temporary binary files*/
     private static final String BINARY_FILE_SUFFIX =
         JMeterUtils.getPropDefault("proxy.binary.filesuffix",// $NON-NLS-1$

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Daemon.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Daemon.java?rev=1859523&r1=1859522&r2=1859523&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Daemon.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Daemon.java Sun May
19 20:55:31 2019
@@ -117,9 +117,9 @@ public class Daemon extends Thread imple
         log.info("Test Script Recorder up and running!");
 
         // Maps to contain page and form encodings
-        // TODO - do these really need to be shared between all Proxy instances?
         Map<String, String> pageEncodings = Collections.synchronizedMap(new HashMap<String,
String>());
         Map<String, String> formEncodings = Collections.synchronizedMap(new HashMap<String,
String>());
+        pageEncodings.put(AbstractSamplerCreator.DEFAULT_ENCODING_KEY, target.getDefaultEncoding());
 
         try {
             while (running) {

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/DefaultSamplerCreator.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/DefaultSamplerCreator.java?rev=1859523&r1=1859522&r2=1859523&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/DefaultSamplerCreator.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/DefaultSamplerCreator.java
Sun May 19 20:55:31 2019
@@ -386,22 +386,24 @@ public class DefaultSamplerCreator exten
         }
         else {
             // Check if we know the encoding of the page
-            if (pageEncodings != null) {
-                synchronized (pageEncodings) {
-                    contentEncoding = pageEncodings.get(urlWithoutQuery);
-                }
+            synchronized (pageEncodings) {
+                contentEncoding = pageEncodings.get(urlWithoutQuery);
+                log.debug("Computed encoding:{} for url:{}", contentEncoding, urlWithoutQuery);
             }
             // Check if we know the encoding of the form
-            if (formEncodings != null) {
-                synchronized (formEncodings) {
-                    String formEncoding = formEncodings.get(urlWithoutQuery);
-                    // Form encoding has priority over page encoding
-                    if (formEncoding != null) {
-                        contentEncoding = formEncoding;
-                    }
+            synchronized (formEncodings) {
+                String formEncoding = formEncodings.get(urlWithoutQuery);
+                // Form encoding has priority over page encoding
+                if (formEncoding != null) {
+                    contentEncoding = formEncoding;
+                    log.debug("Computed encoding:{} for url:{}", contentEncoding, urlWithoutQuery);
                 }
             }
         }
+        if (contentEncoding == null) {
+            contentEncoding = pageEncodings.get(DEFAULT_ENCODING_KEY);
+            log.debug("Defaulting to encoding:{} for url:{}", contentEncoding, urlWithoutQuery);
+        }
         return contentEncoding;
     }
 

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java?rev=1859523&r1=1859522&r2=1859523&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
Sun May 19 20:55:31 2019
@@ -25,6 +25,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.lang.reflect.InvocationTargetException;
 import java.net.MalformedURLException;
+import java.nio.charset.StandardCharsets;
 import java.security.GeneralSecurityException;
 import java.security.KeyStore;
 import java.security.UnrecoverableKeyException;
@@ -163,6 +164,8 @@ public class ProxyControl extends Generi
     private static final String PREFIX_HTTP_SAMPLER_NAME = "ProxyControlGui.proxy_prefix_http_sampler_name";
// $NON-NLS-1$
     
     private static final String PROXY_PAUSE_HTTP_SAMPLER = "ProxyControlGui.proxy_pause_http_sampler";
// $NON-NLS-1$
+    
+    private static final String DEFAULT_ENCODING_PROPERTY = "ProxyControlGui.default_encoding";
// $NON-NLS-1$
 
     private static final String REGEX_MATCH = "ProxyControlGui.regex_match"; // $NON-NLS-1$
 
@@ -406,6 +409,13 @@ public class ProxyControl extends Generi
         setProperty(new IntegerProperty(HTTP_SAMPLER_NAMING_MODE, httpNamingMode));
     }
     
+    public String getDefaultEncoding() {
+        return getPropertyAsString(DEFAULT_ENCODING_PROPERTY, StandardCharsets.UTF_8.name());
+    }
+    public void setDefaultEncoding(String defaultEncoding) {
+        setProperty(DEFAULT_ENCODING_PROPERTY, defaultEncoding);
+    }
+    
     public void setPrefixHTTPSampleName(String prefixHTTPSampleName) {
         setProperty(PREFIX_HTTP_SAMPLER_NAME, prefixHTTPSampleName);
     }

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java?rev=1859523&r1=1859522&r2=1859523&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java
Sun May 19 20:55:31 2019
@@ -164,6 +164,11 @@ public class ProxyControlGui extends Log
      * Set/clear the Download images box on the samplers (default is false)
      */
     private JCheckBox samplerDownloadImages;
+    
+    /**
+     * Default enccoding for parsing
+     */
+    private JTextField defaultEncoding;
 
     /**
      * To choose between a prefix or a transaction name
@@ -220,6 +225,8 @@ public class ProxyControlGui extends Log
 
     private transient RecorderDialog recorderDialog;
 
+    private Component labelDefaultEncoding;
+
     //+ action names
     private static final String ACTION_STOP = "stop"; // $NON-NLS-1$
 
@@ -308,6 +315,7 @@ public class ProxyControlGui extends Log
             model.setUseKeepAlive(useKeepAlive.isSelected());
             model.setSamplerDownloadImages(samplerDownloadImages.isSelected());
             model.setHTTPSampleNamingMode(httpSampleNamingMode.getSelectedIndex());
+            model.setDefaultEncoding(defaultEncoding.getText());
             model.setPrefixHTTPSampleName(prefixHTTPSampleName.getText());
             model.setProxyPauseHTTPSample(proxyPauseHTTPSample.getText());
             model.setNotifyChildSamplerListenerOfFilteredSamplers(notifyChildSamplerListenerOfFilteredSamplersCB.isSelected());
@@ -372,6 +380,7 @@ public class ProxyControlGui extends Log
         samplerDownloadImages.setSelected(model.getSamplerDownloadImages());
         httpSampleNamingMode.setSelectedIndex(model.getHTTPSampleNamingMode());
         prefixHTTPSampleName.setText(model.getPrefixHTTPSampleName());
+        defaultEncoding.setText(model.getDefaultEncoding());
         proxyPauseHTTPSample.setText(model.getProxyPauseHTTPSample());
         notifyChildSamplerListenerOfFilteredSamplersCB.setSelected(model.getNotifyChildSamplerListenerOfFilteredSamplers());
         regexMatch.setSelected(model.getRegexMatch());
@@ -913,6 +922,8 @@ public class ProxyControlGui extends Log
         httpSampleNamingMode.setName(HTTP_SAMPLER_NAMING_MODE);
         httpSampleNamingMode.addItemListener(this);
         
+        defaultEncoding = new JTextField(15);
+        
         prefixHTTPSampleName = new JTextField(20);
         prefixHTTPSampleName.addKeyListener(this);
         prefixHTTPSampleName.setName(PREFIX_HTTP_SAMPLER_NAME);
@@ -923,6 +934,9 @@ public class ProxyControlGui extends Log
         proxyPauseHTTPSample.setActionCommand(ENABLE_RESTART);
         JLabel labelProxyPause = new JLabel(JMeterUtils.getResString("proxy_pause_http_sampler"));
// $NON-NLS-1$
         labelProxyPause.setLabelFor(proxyPauseHTTPSample);
+        
+        JLabel labelDefaultEncoding = new JLabel(JMeterUtils.getResString("proxy_default_encoding"));
// $NON-NLS-1$
+        labelDefaultEncoding.setLabelFor(defaultEncoding);
               
         GridBagLayout gridBagLayout = new GridBagLayout();
         GridBagConstraints gbc = new GridBagConstraints();
@@ -950,6 +964,16 @@ public class ProxyControlGui extends Log
         gbc.fill = GridBagConstraints.HORIZONTAL;
         panel.add(proxyPauseHTTPSample, gbc.clone());
         gbc.weightx = 1;
+        
+        gbc.gridx = 0;
+        gbc.gridy++;
+        panel.add(labelDefaultEncoding, gbc.clone());
+        gbc.gridx++;
+        gbc.weightx = 3;
+        gbc.fill = GridBagConstraints.HORIZONTAL;
+        panel.add(defaultEncoding, gbc.clone());
+        gbc.weightx = 1;
+        
         gbc.gridx = 0;
         gbc.gridy++;
         gbc.fill=GridBagConstraints.VERTICAL;

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1859523&r1=1859522&r2=1859523&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Sun May 19 20:55:31 2019
@@ -135,6 +135,7 @@ to view the last major behaviors with th
 <ul>
     <li><bug>63298</bug>HTTP Requests with encoded URLs are being sent
in decoded format</li>
     <li><bug>63364</bug>When setting <code>subresults.disable_renaming=true</code>,
sub results are still renamed using their parent SampleLabel while they shouldn't. Contributed
by Ubik Load Pack (support at ubikloadpack.com)</li>
+    <li><bug>63129</bug>JMeter can not identify encoding during first time
page submission</li>
 </ul>
 
 <h3>Other Samplers</h3>



Mime
View raw message