Chrome、Chromium、Firefox 在 QtWebApp 上两次请求页面
Posted
技术标签:
【中文标题】Chrome、Chromium、Firefox 在 QtWebApp 上两次请求页面【英文标题】:Chrome, Chromium, Firefox requesting page twice on QtWebApp 【发布时间】:2014-02-07 10:21:42 【问题描述】:我正在尝试使用 QtWebApp
创建一个简单的 Web 应用服务器,但 Chrome、Firefox 和 chromium 总是请求页面两次
HttpListener: Listening on port 8084
HttpConnectionHandler (0x642770): constructed
HttpConnectionHandler (0x6436e0): constructed
HttpConnectionHandler (0x642770): thread started
HttpConnectionHandler (0x642770): handle new connection
HttpConnectionHandler (0x642770): received request
request start --> with chrome/firefox/chromium
HttpConnectionHandler (0x6436e0): thread started
HttpConnectionHandler (0x6436e0): handle new connection
request end
HttpConnectionHandler (0x642770): received request
request start --> i'm not refreshing the page but this appear
HttpConnectionHandler (0x6436e0): read timeout occured
HttpConnectionHandler (0x6436e0): disconnected
request end
HttpConnectionHandler (0x642770): read timeout occured
HttpConnectionHandler (0x642770): disconnected
HttpConnectionHandler (0x6436e0): thread stopped
HttpConnectionHandler (0x6436e0): destroyed
HttpConnectionHandlerPool: Removed connection handler (0x6436e0), pool size is now 1
HttpConnectionHandler (0x642770): handle new connection
HttpConnectionHandler (0x642770): received request
request start --> when using curl
request end
HttpConnectionHandler (0x642770): disconnected
HttpConnectionHandler (0x6436e0): disconnected
HttpConnectionHandler (0x642770): read timeout occured
HttpConnectionHandler (0x642770): disconnected
HttpConnectionHandler (0x6436e0): thread stopped
HttpConnectionHandler (0x6436e0): destroyed
我对 curl 的回应是:
> GET / HTTP/1.1
> User-Agent: curl/7.35.0
> Host: localhost:8084
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: text/html; charset=ISO-8859-1
< Transfer-Encoding: chunked
<
* Connection #0 to host localhost left intact
<html><body>-4417809641995</body></html>
在 Chrome 开发者工具 > 网络选项卡上,它只被请求过一次。
来源:How to create QtWebApp application
是这个浏览器的问题还是Controller的类?
【问题讨论】:
随机猜测:他们可能会在第二个请求中请求/favicon.ico
?
啊是的,没错 XD 非常感谢你.. "/favicon.ico"
【参考方案1】:
正如Florian Sowade
评论所说,第二个请求是/favicon.ico
【讨论】:
以上是关于Chrome、Chromium、Firefox 在 QtWebApp 上两次请求页面的主要内容,如果未能解决你的问题,请参考以下文章
如何使用更改和删除事件在 firefox 和 chrome/chromium 上上传和列出目录
Windows 上的 HTML5 地理位置比 Linux(Firefox、Chrome、[Chromium])更准确