QHttpServerWebSocketUpgradeResponse Class

Response to return when verifying WebSocket upgrades on HTTP server. More...

Header: #include <QHttpServerWebSocketUpgradeResponse>
CMake: find_package(Qt6 REQUIRED COMPONENTS HttpServer)
target_link_libraries(mytarget PRIVATE Qt6::HttpServer)
qmake: QT += httpserver
Since: Qt 6.8
Status: Technical Preview

Public Types

enum class ResponseType { Accept, Deny, PassToNext }

Public Functions

QHttpServerWebSocketUpgradeResponse(const QHttpServerWebSocketUpgradeResponse &other)
~QHttpServerWebSocketUpgradeResponse()
QByteArray denyMessage() &&
const QByteArray &denyMessage() const &
int denyStatus() const
void swap(QHttpServerWebSocketUpgradeResponse &other)
QHttpServerWebSocketUpgradeResponse::ResponseType type() const
QHttpServerWebSocketUpgradeResponse &operator=(QHttpServerWebSocketUpgradeResponse &&other)
QHttpServerWebSocketUpgradeResponse &operator=(const QHttpServerWebSocketUpgradeResponse &other)

Static Public Members

QHttpServerWebSocketUpgradeResponse accept()
QHttpServerWebSocketUpgradeResponse deny()
QHttpServerWebSocketUpgradeResponse deny(int status, QByteArray message)
QHttpServerWebSocketUpgradeResponse passToNext()

Detailed Description

Use this class to return when determining whether a socket upgrade should succeed. If type() is Accept upgrade the socket, if type() is Deny send an error with the given denyStatus() and denyMessage(), and if type() is PassToNext proceed to the next registered handler. If all handlers return PassToNext or none exist, QAbstractHttpServer::missingHandler() is executed.

See also QAbstractHttpServer::addWebSocketUpgradeVerifier() and QAbstractHttpServer::missingHandler().

Member Type Documentation

enum class QHttpServerWebSocketUpgradeResponse::ResponseType

Response types

ConstantValueDescription
QHttpServerWebSocketUpgradeResponse::ResponseType::Accept0Accept the WebSocket upgrade request.
QHttpServerWebSocketUpgradeResponse::ResponseType::Deny1Deny the WebSocket upgrade request.
QHttpServerWebSocketUpgradeResponse::ResponseType::PassToNext2Pass the Websocket upgrade decision to the next verifier if any.

See also QAbstractHttpServer::addWebSocketUpgradeVerifier() and type().

Member Function Documentation

QHttpServerWebSocketUpgradeResponse::QHttpServerWebSocketUpgradeResponse(const QHttpServerWebSocketUpgradeResponse &other)

Copy-constructs an instance of a QHttpServerWebSocketUpgradeResponse object from other.

[noexcept] QHttpServerWebSocketUpgradeResponse::~QHttpServerWebSocketUpgradeResponse()

Destroys a QHttpServerWebSocketUpgradeResponse object.

[static] QHttpServerWebSocketUpgradeResponse QHttpServerWebSocketUpgradeResponse::accept()

Creates an instance of QHttpServerWebSocketUpgradeResponse with type() Accept.

See also ResponseType and type().

[static] QHttpServerWebSocketUpgradeResponse QHttpServerWebSocketUpgradeResponse::deny()

Creates an instance of QHttpServerWebSocketUpgradeResponse with type() Deny, denyStatus() 403 and the denyMessage() "Forbidden".

See also ResponseType, type(), denyStatus(), and denyMessage().

[static] QHttpServerWebSocketUpgradeResponse QHttpServerWebSocketUpgradeResponse::deny(int status, QByteArray message)

Creates an instance of QHttpServerWebSocketUpgradeResponse with type() Deny, denyStatus() status and denyMessage() message.

See also ResponseType, type(), denyStatus(), and denyMessage().

QByteArray QHttpServerWebSocketUpgradeResponse::denyMessage() &&

Returns the error message to return if type() is Deny.

const QByteArray &QHttpServerWebSocketUpgradeResponse::denyMessage() const &

Returns the error message to return if type() is Deny.

int QHttpServerWebSocketUpgradeResponse::denyStatus() const

Returns the HTTP status code to return if type() is Deny.

[static] QHttpServerWebSocketUpgradeResponse QHttpServerWebSocketUpgradeResponse::passToNext()

Creates an instance of QHttpServerWebSocketUpgradeResponse with type() PassToNext.

See also ResponseType and type().

[noexcept] void QHttpServerWebSocketUpgradeResponse::swap(QHttpServerWebSocketUpgradeResponse &other)

Swaps the contents of this with other

QHttpServerWebSocketUpgradeResponse::ResponseType QHttpServerWebSocketUpgradeResponse::type() const

Returns the type of response.

See also ResponseType.

[noexcept] QHttpServerWebSocketUpgradeResponse &QHttpServerWebSocketUpgradeResponse::operator=(QHttpServerWebSocketUpgradeResponse &&other)

Move-assigns the values of other to this object.

QHttpServerWebSocketUpgradeResponse &QHttpServerWebSocketUpgradeResponse::operator=(const QHttpServerWebSocketUpgradeResponse &other)

Copy-assigns the values of other to this object.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.