单个浏览器页面的几个未使用的会话

发布于 2025-02-03 11:29:44 字数 3363 浏览 1 评论 0 原文

测试 wt :: Wapplication 时,我的行为很奇怪。似乎一个浏览器窗口最多将触发3个会话。只有第一个会话将保留,因为其他2会将在不久之后到期。

有人会遇到类似的问题吗?

wt版本: 4.5.0 Windows Build

Main

int main(int argc, char **argv)
{
    return Wt::WRun(argc, argv, [](const Wt::WEnvironment& env) {
        return std::make_unique<Wt::WApplication>(env);
    });
}

该应用程序被调用:

--approot ../../../approot --docroot "../../../docroot;/styles.css,/images,/sitemaps,/robots.txt" --http-address localhost --http-port 8080

wt log:

[2022-May-30 21:59:45.798] 12704 - [info] "config: reading Wt config file: ../../../approot/wt_config.xml (location = 'exe')"
[2022-May-30 21:59:45.811] 12704 - [info] "WServer/wthttp: initializing built-in wthttpd"
[2022-May-30 21:59:45.822] 12704 - [info] "wthttp: started server: http://127.0.0.1:8080 (localhost)"
[2022-May-30 21:59:45.822] 12704 - [info] "wthttp: started server: http://[::1]:8080 (localhost)"
[2022-May-30 21:59:53.050] 12704 - [info] "Wt: session created (#sessions = 1)"
[2022-May-30 21:59:53.055] 12704 [/ FLh8WMlSxcWspyVs] [info] "WEnvironment: UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36"
127.0.0.1 - - [2022-May-30 21:59:53.073] "GET / HTTP/1.1" 200 4094
[2022-May-30 21:59:53.073] 12704 - [info] "WebRequest: took 23.66 ms"
[2022-May-30 21:59:53.118] 12704 - [info] "Wt: session created (#sessions = 2)"
[2022-May-30 21:59:53.120] 12704 - [info] "Wt: session created (#sessions = 3)"
[2022-May-30 21:59:53.124] 12704 [/ MmvFYbPrMWDpcoxB] [info] "WEnvironment: UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36"
[2022-May-30 21:59:53.126] 12704 [/ J8CGX3nPrlUWZEOU] [info] "WEnvironment: UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36"

chrome> chrome dev-tool网络输出:

  • 获取 http://127.0.0.1:8080/
  • 获取/Resources/themes/default/wt.css“ rel =“ nofollow noreferrer”>
  • http://127.0.0.0.1:8080/resources/resources/themes/themes/default/wt.css /127.0.0.1:8080/resources/webkit-transitions.css“ rel =” nofollow noreferrer“>
  • http: //127.0.0.0.0.1:8080/resources/webkit-transitions.csss.csss.csss.css ://127.0.0.1:8080/?wtd=FLh8WMlSxcWspyVs&sid=2014108110&webGL=true&scrW=1536&scrH=864&tz=120&tzS=Europe%2FBerlin&htmlHistory=true&deployPath=%2F&request =脚本&amp; rand = 833477994“ rel =“ nofollow noreferrer”> http://127.0.0.0.0.1:8080/?wtd = flh8wmlsxcwspyvs&sid=2014108110&amp.amp.amp.amp.amp. amp.amp.amp.amp, amp; 20&amp; tzs =欧洲%2fberlin&amp; htmlhistory = true&amp; deploypath =%2f&amp; request = script&amp; rand = 833477994
  • get http://127.0.0.0.1:8080/images/favicon.ico
  • post http://127.0.0.1:8080/?wtd = flh8wmlsxcwspyvs

后来重复最后一个。

我真的很乐意得到一些建议:) 此致

I have a strange behavior when testing the Wt::WApplication. It seems that a single browser window will trigger up to 3 sessions. Only the first session will remain, as the other 2 will expire shortly after.

Does anybody experience a similar problem?

Wt version: 4.5.0 Windows Build

Main:

int main(int argc, char **argv)
{
    return Wt::WRun(argc, argv, [](const Wt::WEnvironment& env) {
        return std::make_unique<Wt::WApplication>(env);
    });
}

The application is invoked with:

--approot ../../../approot --docroot "../../../docroot;/styles.css,/images,/sitemaps,/robots.txt" --http-address localhost --http-port 8080

Wt Log:

[2022-May-30 21:59:45.798] 12704 - [info] "config: reading Wt config file: ../../../approot/wt_config.xml (location = 'exe')"
[2022-May-30 21:59:45.811] 12704 - [info] "WServer/wthttp: initializing built-in wthttpd"
[2022-May-30 21:59:45.822] 12704 - [info] "wthttp: started server: http://127.0.0.1:8080 (localhost)"
[2022-May-30 21:59:45.822] 12704 - [info] "wthttp: started server: http://[::1]:8080 (localhost)"
[2022-May-30 21:59:53.050] 12704 - [info] "Wt: session created (#sessions = 1)"
[2022-May-30 21:59:53.055] 12704 [/ FLh8WMlSxcWspyVs] [info] "WEnvironment: UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36"
127.0.0.1 - - [2022-May-30 21:59:53.073] "GET / HTTP/1.1" 200 4094
[2022-May-30 21:59:53.073] 12704 - [info] "WebRequest: took 23.66 ms"
[2022-May-30 21:59:53.118] 12704 - [info] "Wt: session created (#sessions = 2)"
[2022-May-30 21:59:53.120] 12704 - [info] "Wt: session created (#sessions = 3)"
[2022-May-30 21:59:53.124] 12704 [/ MmvFYbPrMWDpcoxB] [info] "WEnvironment: UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36"
[2022-May-30 21:59:53.126] 12704 [/ J8CGX3nPrlUWZEOU] [info] "WEnvironment: UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36"

Chrome Dev-Tool network output:

The last one is repeated afterwards.

I would be really happy to get some advice :)
Best regards

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

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

发布评论

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

评论(1

难忘№最初的完美 2025-02-10 11:29:44

我假设为 http://127.0.0.1:8080/resources/... 请求创建了两个额外的会话。将/Resources 添加到 docRoot 静态文件路径列表应防止此类请求启动新会话。

添加 -resources-dir/path/to/wt/install/install/share/wt/resources ,允许wt找到WT本身提供的资源,这也可能很有用。

资源:

I assume the two extra session are created for the http://127.0.0.1:8080/resources/... requests. Adding /resources to the docroot list of static file paths should prevent such requests from starting a new session.

It may also be useful to add --resources-dir /path/to/wt/install/share/Wt/resources, to allow Wt to find those resources provided by Wt itself.

Resources:

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