azadkuh / qhttp

a light-weight and asynchronous HTTP library (both server & client) in Qt5 and c++14
MIT License
484 stars 158 forks source link

Consider moving back to C++11 #35

Closed droidmonkey closed 4 years ago

droidmonkey commented 7 years ago

Motivation

C++14 is still not widely supported by Linux baselines. Furthermore, the v3.0 release is FAR superior to the v2.1 release, yet the requirement for C++14 largely has nothing to do with that superiority.

We are looking to integrate qhttp into KeePassXC but we cannot move to C++14 due to backwards compatibility.

Details

There are only two places in the code that require the use of C++14:

httpparser.hxx#L98 which can easily be fixed by changing the auto to TImpl* since you are static casting it anyway.

httpwriter.hxx#L87 This loop block was rewritten in C++14 syntax for no obvious gain. It can be easily reverted back to the C++11 equivalent:

        for ( auto cit = TBase::iheaders.constBegin(); cit != TBase::iheaders.constEnd(); cit++ ) {
            const QByteArray& field = cit.key();
            const QByteArray& value = cit.value();

            writeHeader(field, value);
        }
oliviermaridat commented 7 years ago

For a project of my company, I did patch successfully qhttp v3.0 to move back to C++11 (and also supports Qt 5.3 which was another requirement for us). As @droidmonkey said, it was not that big.

oliviermaridat commented 7 years ago

For your information, I released the backport here: https://github.com/oliviermaridat/qhttp