[Qt-interest] Persistent HTTP connections
Markus Goetz
Markus.Goetz at nokia.com
Thu Feb 18 10:09:32 CET 2010
ext Mandeep Sandhu wrote:
> HTTP 1.1 supports persistent connection by default, i.e the server
> won't close the connection unless explicitly told so by the client by
> sending the connection close header. Is it true for HTTP requests sent
> out by QNetworkAccessManager?
>
Yes :)
> Once I receive the finish signal, does it automatically send a
> connection close header or is that done only if I call abort() or
> something else?
>
What do you mean? It can't send a header after the request is already
processed&finished
> Basically, I want to send my _second_ http request using the same
> connection that was setup when the first HTTP request was made. If i
> simply make the second request after the first one finished, will it
> reuse the same connection? If not, how can this be achieved?
>
In theory, it should work like that. Have you tried checking with a
network sniffer? If it's not like that, we have a bug (or let's call it
performance regression) in Qt.
To be very sure, I would suggest to not create and send the request from
the finished() slot but one event loop spin after that. You can achieve
this by using a single shot timer set to 0 msec and sending the request
from the timer's slot.
Markus
More information about the Qt-interest-old
mailing list