Add function to register functions that verifies WebSocket upgrades


The current implementation creates WebSocket connections if a user
sends a request with the upgrade header set to WebSocket and if
there is a handler.

Decouple the routes from the handlers by adding a function to
register callback functions that take a QHttpServerRequest as an
argument and return a QHttpServerWebSocketUpgradeResponse which
can have the types Allow, Deny, and PassToNext. The first Allow
or Deny returned by the callback functions decides the outcome,
while PassToNext is used to execute the next rule. If no callback
functions are registered or all return PassToNext the WebSocket
upgrade fails and missingHandler is executed. It is possible to
customize the status code and message returned when the upgrade
by the handler that has the type Deny.

[ChangeLog][QAbstractHttpServer] Add function to register
callback functions that verifies WebSocket upgrades

Fixes: QTBUG-121462
Change-Id: I5ea2a778f128b2e4212da551c4d96bf25d8576e8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
commit3bd2834b5cd36f15a8015dc035499a2e48d91c3d
parent362d40911887edf5fb8c23cebfed6f62e7c88c2f
authorØystein Heskestad <oystein.heskestad@qt.io>
committerØystein Heskestad <oystein.heskestad@qt.io>
commit timeWed, 29 May 2024 17:45:23 +0200