Usage of QNetworkAccessManager
Ben Cooksley
bcooksley at kde.org
Thu Jul 14 06:33:37 UTC 2016
Hi all,
Just my regular reminder regarding usage of QNetworkAccessManager in
your applications and libraries, especially when it comes to
interacting with kde.org infrastructure.
Unfortunately, from it's first iteration in Qt 4 QNetworkAccessManager
was shipped with a severe and fundamental defect in that it does not
follow HTTP redirects by default. Due to Qt behavioural and other
compatibility promises they can never change this behaviour, not even
in Qt 6.
Please therefore ensure your application handles redirects
appropriately (the form of the code will depend on the version of Qt
in use) if you decide to use QNAM.
Failure to do so can, depending on your code, lead to crashes or hangs
within your applications. If I recall right the Qt Installer Framework
(Qt 4) crashes when it encounters a redirect (it caused the Necessitas
SDK installer to crash anyway).
Not handling redirects restricts the ability of Sysadmin to change
infrastructure as needed - so please ensure you get this right.
If you'd like to avoid all of this: just use KIO - which gets it right
and handles redirects out of the box for you.
Cheers,
Ben
More information about the Plasma-devel
mailing list