切换到 SSL 时 JMeter 停止发送 JSESSIONID cookie

发布于 2024-10-18 17:48:09 字数 278 浏览 3 评论 0原文

我有一个在 http 下运行良好的测试计划,并且 Cookie 管理器正确地将我的会话保持在适当的位置。当切换到 ssl 时,它还能够与同一台服务器进行通信,甚至认为一切正常,因为它会收到 200 响应,其中包含我们关于未登录的自定义消息。

要重现该行为,我所需要做的就是从http 到 https。测试仍然能够与服务器通信,但我可以在“查看表中的结果”日志中看到cookie在http下有一个JSESSIONID,在https下为空。 ssl 下的每个请求都会通过 JSESSIONID 的 Set-Cookie 进行应答。

I have a test plan that runs fine under http, and the Cookie Manager is correctly keeping my sessions in place. It is also capable of talking to the same server when switched to ssl, and even thinks everything is working correctly because it gets a 200 response with our custom message about not being logged in.

All I need to do to reproduce the behavior is switch from http to https. The test is still able to talk to the server, but I can see in the "View Results in Table" log that cookies has a JSESSIONID under http, and is empty under https. And each request under ssl is answered with a Set-Cookie for JSESSIONID.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦途 2024-10-25 17:48:09

有趣的场景。 Jmeter 日志文件是否提供任何线索?

难道 Jmeter 需要证书的副本才能正确存储 SSL cookie?控制台会显示握手问题,可以通过将证书添加到密钥库中来解决:
http://www.java-samples.com/showtutorial.php?tutorialid=210

您可以通过将 cookie 值写入变量并记录其值来进行进一步的调试:

接收到的Cookie可以存储为JMeter线程变量(2.3.2之后的JMeter版本默认不再这样做)。要将 cookies 保存为变量,请定义属性“CookieManager.save.cookies=true”。此外,cookie 名称在存储之前以“COOKIE_”为前缀(这可以避免局部变量的意外损坏)。要恢复到原始行为,请定义属性“CookieManager.name.prefix=”(一个或多个空格)。如果启用,名为 TEST 的 cookie 的值可称为 ${COOKIE_TEST}。

来源:http://jmeter.apache.org/usermanual/component_reference.html#HTTP_Cookie_Manager

编辑:有人问我的具体问题是如何解决的。事实证明,这与 ssl 没有任何关系,但其他不相关的标头的格式变化很小,因此我们用来匹配它们的正则表达式开始失败。因此,我首先查看您的标头并比较您发布 http 与 https 时的差异

Interesting scenario. Does the Jmeter log file offer any clues?

Could it be that Jmeter needs a copy of the certificate to properly store the SSL cookie? The console would display a handshake problem, which can be resolved by adding the certificate into the key store:
http://www.java-samples.com/showtutorial.php?tutorialid=210

You might be able to do some further debug by writing out the cookie value to a variable and logging its value:

Received Cookies can be stored as JMeter thread variables (versions of JMeter after 2.3.2 no longer do this by default). To save cookies as variables, define the property "CookieManager.save.cookies=true". Also, cookies names are prefixed with "COOKIE_" before they are stored (this avoids accidental corruption of local variables) To revert to the original behaviour, define the property "CookieManager.name.prefix= " (one or more spaces). If enabled, the value of a cookie with the name TEST can be referred to as ${COOKIE_TEST}.

Source: http://jmeter.apache.org/usermanual/component_reference.html#HTTP_Cookie_Manager

Edit: Somebody asked how my specific problem was solved. It turned out not to have anything to do with ssl specifically, but that other unrelated headers changed very slightly in their format, so the regex we were using to match on them started failing. So I'd start there with looking at your headers and comparing the difference between when you post http vs https

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文