Cutelyst 2 released with HTTP/2 support
Cutelyst the Qt/C++ web framework just got a major release update, around one and half year ago Cutelyst v1 got the first release with a stable API/ABI, many improvements where made during this period but now it was time to clean up the mistakes and give room for new features.
Porting applications to v2 is mostly a breeze, since most API changes were done on the Engine class replacing 1 with 2 and recompiling should be enough on most cases, at least this was the case for CMlyst, Stickyst and my personal applications.
Due cleanup Cutelyst Core module got a size reduction, and WSGI module increased a bit due the new HTTP/2 parser. Windows MSVC was finally able to build and test all modules.
WSGI module now defaults to using our custom EPoll event loop (can be switched back to Qt's default one with an environment variable), this allows for a steady performance without degradation when an increased number of simultaneous connections is made.
Validators plugins by Matthias got their share of improvements and a new password quality validator was added, plus manual pages for the tools.
The HTTP/2 parser adds more value to our framework, it's binary nature makes it very easy to implement, in two days most of it was already working but HTTP/2 comes with a dependency, called HPACK which has it's own RFC. HPACK is the header compression mechanism created for HTTP/2 because gzip compression as used in SPDY had security issues when on HTTPS called CRIME .
The problem is that HPACK is not very trivial to implement and it took many hours and made KCalc my best friend when converting hex to binary to decimal and what not...
Cutelyst HTTP/2 parser passes all tests of a tool named h2spec, using h2load it even showed more requests per second than HTTP/1 but it's complicated to benchmark this two different protocols specially with different load tools.
Upgrading from HTTP/1.1 is supported with a switch, as well as enabling H2 on HTTPS using the ALPN negotiation (which is the only option browsers support), H2C or HTTP/2 in clear text is also supported but it's only useful if the client can connect with previous knowledge.
If you know HTTP/2 your question is: "Does it support server push?". No it doesn't at the moment, SERVER_PUSH is a feature that allows the server to send CSS, Javascript without the browser asking for it, so it can avoid the request the browser would do, however this feature isn't magical, it won't make slow websites super fast , it's also hard to do right, and each browser has it's own complicated issues with this feature.
I strongly recommend reading this https://jakearchibald.com/2017/h2-push-tougher-than-i-thought/ .
This does not mean SERVER_PUSH won't be implemented, quite the opposite, due the need to implement it properly I want more time to study the RFC and browsers behavior so that I can provide a good API.
I have also done some last minute performance improvements with the help of KDAB Hotspot/perf, and I must say that the days of profiling with weird/huge perf command line options are gone, awesome tool!
Get it! https://github.com/cutelyst/cutelyst/archive/v2.0.0.tar.gz
If you like it please give us a star on GitHub!
Have fun!