New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backslashes included in sessionid when using URLRewritingModifier #2097
Comments
Sebb (migrated from Bugzilla): What is the surrounding context for the assignment? |
Jens Hoffrichter (migrated from Bugzilla): I thought that is was because of a session variable passed in along JavaScript, but after some debugging I found out that it was because of a complete URL passed along in JavaScript (probably for a redirect), quote in single quotes, which posed the problem. So if something like this in the response, the URLRewritingModifier might cause a problem: newurl = '/index.html?sessionid=blabla'; I have created a unittest for that (testGrabSessionIdURLinJSON), and updated my patch to include the unit test. Without my patch, the unit test fails, with the patch, it runs fine. I hope this will help you to resolve the issue. Regards, Jens |
Jens Hoffrichter (migrated from Bugzilla): URLRewritingModifier_Backslash_incl_Unittest.patchdiff -Nur jakarta-jmeter-2.3.1/src/protocol/http/org/apache/jmeter/protocol/http/modifier/URLRewritingModifier.java jakarta-jmeter-2.3.1.fixed/src/protocol/http/org/apache/jmeter/protocol/http/modifier/URLRewritingModifier.java
--- jakarta-jmeter-2.3.1/src/protocol/http/org/apache/jmeter/protocol/http/modifier/URLRewritingModifier.java 2007-11-28 14:11:41.000000000 +0100
+++ jakarta-jmeter-2.3.1.fixed/src/protocol/http/org/apache/jmeter/protocol/http/modifier/URLRewritingModifier.java 2008-04-16 17:04:24.303335891 +0200
@@ -169,7 +169,7 @@
parameterRegexp = JMeterUtils.getPatternCache().getPattern(
// ;sessionid=value
- "[;\\?&]" + quotedArg + "=([^\"'>&\\s;]*)[&\\s\"'>;]?$?" + // $NON-NLS-1$
+ "[;\\?&]" + quotedArg + "=([^\"'>&\\s;\\\\]*)[&\\s\"'>;]?$?" + // $NON-NLS-1$
// name="sessionid" value="value"
"|\\s[Nn][Aa][Mm][Ee]\\s*=\\s*[\"']" + quotedArg
diff -Nur jakarta-jmeter-2.3.1/test/src/org/apache/jmeter/protocol/http/modifier/TestURLRewritingModifier.java jakarta-jmeter-2.3.1.fixed/test/src/org/apache/jmeter/protocol/http/modifier/TestURLRewritingModifier.java
--- jakarta-jmeter-2.3.1/test/src/org/apache/jmeter/protocol/http/modifier/TestURLRewritingModifier.java 2007-11-28 14:09:49.000000000 +0100
+++ jakarta-jmeter-2.3.1.fixed/test/src/org/apache/jmeter/protocol/http/modifier/TestURLRewritingModifier.java 2008-04-16 17:05:33.423309105 +0200
@@ -177,6 +177,21 @@
}
}
+ public void testGrabSessionIdURLinJSON() throws Exception {
+ String html = "/index?param1=bla&sessionid=xyzxyzxyz\\'";
+ response = new SampleResult();
+ response.setResponseData(html.getBytes());
+ mod.setArgumentName("sessionid");
+ HTTPSamplerBase sampler = createSampler();
+ sampler.addArgument("sessionid", "xyzxyzxyz");
+ context.setCurrentSampler(sampler);
+ context.setPreviousResult(response);
+ mod.process();
+ Arguments args = sampler.getArguments();
+ assertEquals("xyzxyzxyz", ((Argument) args.getArguments().get(0).getObjectValue())
+ .getValue());
+ }
+
public void testCache() throws Exception {
String[] html = new String[] {
"<input name=\"sid\" value=\"myId\">", |
Sebb (migrated from Bugzilla): If necesary, change the host etc to anonymise the URL. No need for a new test case, I can adjust as necesssary. |
Jens Hoffrichter (migrated from Bugzilla): <a href="#" onclick="$('mailpreview_iframe').src='/webmail/mail_download/?preview=1&fldr=INBOX&id=2&partid=1&mediatype=TEXT%2FPLAIN&encoding=7BIT&charset=us-ascii&textpreview=1&tempid=HUDXReOOE2y2QS2m';" title="Textnachricht anzeigen"> Regards, |
Sebb (migrated from Bugzilla): |
Jens Hoffrichter (migrated from Bugzilla): It is configured as that, without any extra options except "cached" set on in the URLRewritingModifier. Regards, |
Sebb (migrated from Bugzilla): I've added it to SVN: |
Jens Hoffrichter (Bug 44807):
Hello,
When trying to load-test an AJAX heavy web application I ran into the following error:
At some point during my test plan my sessionid was replaced by the sessionid followed by a backslash.
After a bit of digging I found out that this occurred when there was JavaScript of the following type in the page:
sessionidvar = '<sessionidvalue>'; (for being used in an XMLHttpRequest)
I just added the backslash to the "terminating" characters for a normal sessionid (as I don't believe that it would be part of a sessionid anyway), and it worked just fine.
I include the patch to URLRewritingModified.java in here.
Regards,
Jens
Created attachment URLRewritingModifier_Backslash.patch: Patch to fix the mismatching session id
URLRewritingModifier_Backslash.patch
Severity: normal
OS: Linux
The text was updated successfully, but these errors were encountered: