mirror of https://github.com/apache/jmeter.git
Bug 63129 - JMeter can not identify encoding during first time page submission
This closes #441 Bugzilla Id: 63129 git-svn-id: https://svn.apache.org/repos/asf/jmeter/trunk@1859523 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
89df5a1e65
commit
74ce954f3e
|
|
@ -831,6 +831,7 @@ proxy_daemon_msg_created_in_bin=created in JMeter bin directory
|
|||
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
|
||||
|
|
|
|||
|
|
@ -820,6 +820,7 @@ proxy_daemon_msg_check_expiration=Le certificat a une durée de validité de {0}
|
|||
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+
|
||||
|
|
|
|||
|
|
@ -38,7 +38,8 @@ public abstract class AbstractSamplerCreator implements SamplerCreator {
|
|||
|
||||
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$
|
||||
|
|
|
|||
|
|
@ -117,9 +117,9 @@ public class Daemon extends Thread implements Stoppable {
|
|||
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) {
|
||||
|
|
|
|||
|
|
@ -386,22 +386,24 @@ public class DefaultSamplerCreator extends AbstractSamplerCreator {
|
|||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 GenericController implements NonTestElement {
|
|||
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 GenericController implements NonTestElement {
|
|||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -164,6 +164,11 @@ public class ProxyControlGui extends LogicControllerGui implements JMeterGUIComp
|
|||
* 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 LogicControllerGui implements JMeterGUIComp
|
|||
|
||||
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 LogicControllerGui implements JMeterGUIComp
|
|||
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 LogicControllerGui implements JMeterGUIComp
|
|||
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 LogicControllerGui implements JMeterGUIComp
|
|||
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 LogicControllerGui implements JMeterGUIComp
|
|||
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 LogicControllerGui implements JMeterGUIComp
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ to view the last major behaviors with the version 5.1.1.
|
|||
<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>
|
||||
|
|
|
|||
Loading…
Reference in New Issue