是否有一个 HTTP 标头字段/hack 来告诉浏览器不要通过管道传输其请求?

发布于 2024-08-02 08:16:19 字数 133 浏览 3 评论 0原文

我正在微控制器上实现一个简约的 Web 服务器应用程序。当我的网页上有多个图像(或 CSS/JS)时,浏览器会创建多个连接并获取它们。但单片机却赶不上这一点。有没有办法告诉浏览器停止管道并一一获取它们?

注意::“连接:关闭”已经就位。

I am implementing a minimalistic web server application on a Microcontroller. When I have several images (or CSS/JS) on the web page, the browser creates several connections and fetches them. But the Microcontroller can not catch up with this. Is there a way to tell the browser to stop pipelining and fetch them one by one ?

Note :: "Connection: close" is already in place.

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

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

发布评论

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

评论(3

渡你暖光 2024-08-09 08:16:19

我认为 Connection:close 是完全错误的消息。当浏览器创建多个连接时,它实际上管道化其请求 - 因此 ISTM 表明您希望浏览器管道化,而不是创建并行连接。

因此,实现这一目标的第一步是使用 HTTP 1.1,并保持连接打开。然后浏览器将重用 TCP 连接来进行进一步的请求。这应该能让微控制器赶上。

现在,浏览器可能仍会尝试创建额外的并行连接。对此最好的反应是不接受任何这些联系。因此,限制您正在服务的并行连接数量(独立于客户端),并且仅在读取完之前的请求后才读取新请求。这样做时,更喜欢从已建立的连接中读取而不是接受新连接。

如果您有权访问控制器的 TCP 堆栈,您也许能够知道连接来自哪个主机,因此您可以接受来自其他浏览器的连接,同时限制来自同一浏览器的连接数量(这是您无法做到的)常规套接字 API)。

I think Connection:close is exactly the wrong message. When the browser creates multiple connections, it precisely does not pipeline its requests - so ISTM that you want the browser to pipeline, instead of creating parallel connections.

So one step towards that would be to use HTTP 1.1, and keep the connection open. The browser would then reuse the TCP connection for further requests. This should allow the microcontroller to catch up.

Now, the browser might still try to create additional, parallel connections. The best reaction to that is to not accept any of these connections. So limit the number of parallel connections that you are serving (independent of client), and only read new requests when you are done reading the previous ones. In doing so, prefer to read from established connections over accepting new connections.

If you have access to the TCP stack of the controller, you might be able to tell what host a connection comes from, so you can accept connections from other browsers while limiting the number of connections from the same browser (something that you cannot do in the regular socket API).

温暖的光 2024-08-09 08:16:19

“管道化”是另外一回事。这意味着用户代理在同一连接上发送其他请求,尽管第一个请求尚未完成(请参阅 http://greenbytes.de/tech/webdav/rfc2616.html#pipelined)。

“连接:关闭”似乎不相关;话虽这么说:您是否有理由不希望重用连接?

关于你的问题:不,我认为你不能阻止客户这样做。您是否尝试限制服务器上打开连接的最大数量?

"Pipelining" is something else; it means that the user agent sends additional requests on the same connection although the first one didn't complete yet (see http://greenbytes.de/tech/webdav/rfc2616.html#pipelining).

"Connection: close" doesn't seem to be relevant; that being said: is there a reason why you don't want the connection reused?

With respect to your question: no, I don't think you can prevent clients from doing that. Did you try limiting the maximum number of open connections on your server?

羅雙樹 2024-08-09 08:16:19

同样的问题...但是,与 Opera 不同,Firefox 加载我的网站速度非常快。我没有发明任何比在初始阶段拒绝连接更好的东西:SYN。我只是用 RST 标志来回答。但可能它不适合 Opera。
我的设备仅支持两个同时连接。

Same problem... However, Firefox loads my site very fast unlike Opera. I have not invented anything better than rejecting connections at an initial stage: SYN. I'm just answering with RST flag. But probably it doesn't suit Opera.
My device supports only two simultaneous connections.

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