[Interest] Does QNetworkAccessManager support HTTP persistent connections? (keep-alive)

Giuseppe D'Angelo giuseppe.dangelo at kdab.com
Sat Jul 28 00:28:07 CEST 2018


Hi,

On 26/07/18 17:01, Sze Howe Koh wrote:
> To clarify: Did the server respond to your GET with "Connection:
> keep-alive" instead of "Connection: close", when you downloaded a
> metadata file (*meta.7z)?
> 
> I sent requests from 3 different programs with different user-agents
> (plus 1 request from a VM). All of them got "Connection: close" from
> the server.

It's clearly a server-side configuration problem.

Personal guess: I've just issues a GET for the URL you pasted above, got 
this reply in Firefox:

> HTTP/1.1 200 OK
> Date: Fri, 27 Jul 2018 22:12:14 GMT
> Server: Apache/2.2.15 (CentOS)
> X-Prefix: 91.160.0.0/12
> X-AS: 12322
> Last-Modified: Mon, 29 May 2017 20:00:54 GMT
> ETag: "2a011fd-7fb-550af2502e980"
> Accept-Ranges: bytes
> Content-Length: 2043
> Connection: close
> Content-Type: text/plain; charset=UTF-8

The key part is the server string: Apache 2.2.15 on CentOS. Which means 
CentOS 6, which made me ring an alarm bell in my head.

Quick check, download

> http://mirror.centos.org/centos/6/os/x86_64/Packages/httpd-2.2.15-69.el6.centos.x86_64.rpm

Extract the RPM, and there it is, in all of its glory, a KeepAlive Off 
by default in Apache's master configuration file:

> $ grep -nr KeepAlive .
> ./etc/httpd/conf/httpd.conf:73:# KeepAlive: Whether or not to allow persistent connections (more than
> ./etc/httpd/conf/httpd.conf:76:KeepAlive Off


This is a CentOS 6 specific change, as Apache's 2.2.15 default 
httpd.conf _obviously_ ships with KeepAlive On:

> httpd-2.2.15$ grep -nr KeepAlive
> docs/conf/extra/httpd-default.conf.in:16:KeepAlive On

Cargo cult sysadminning FTW!

(Luckily, it seems to have been removed in CentOS 7).


> Interestingly, all 3 requests from Windows got a RST from the server,
> but the request from my Linux VM didn't. (All of them got "Connection:
> close", however). Is this a clue, or a red herring?

Red herring.

-- 
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4007 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180728/67fa5092/attachment.bin>


More information about the Interest mailing list