单个浏览器页面的几个未使用的会话
测试 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
后来重复最后一个。
我真的很乐意得到一些建议:) 此致
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我假设为
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 thedocroot
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: