Response to return when verifying WebSocket upgrades on HTTP server. 更多...
| 头: |
#include <QHttpServerWebSocketUpgradeResponse>
|
| CMake: |
find_package(Qt6 REQUIRED COMPONENTS HttpServer)
target_link_libraries(mytarget PRIVATE Qt6::HttpServer)
|
| qmake: |
QT += httpserver
|
| Since: | Qt 6.8 |
| 枚举类 | ResponseType { Accept, Deny, PassToNext } |
| 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 ) |
| QHttpServerWebSocketUpgradeResponse | accept () |
| QHttpServerWebSocketUpgradeResponse | deny () |
| QHttpServerWebSocketUpgradeResponse | deny (int status , QByteArray message ) |
| QHttpServerWebSocketUpgradeResponse | passToNext () |
Use this class to return when determining whether a socket upgrade should succeed. If type () 是 Accept upgrade the socket, if type () 是 Deny send an error with the given denyStatus () 和 denyMessage (), and if type () 是 PassToNext proceed to the next registered handler. If all handlers return PassToNext or none exist, QAbstractHttpServer::missingHandler () is executed.
另请参阅 QAbstractHttpServer::addWebSocketUpgradeVerifier () 和 QAbstractHttpServer::missingHandler ().
Response types
| 常量 | 值 | 描述 |
|---|---|---|
QHttpServerWebSocketUpgradeResponse::ResponseType::Accept
|
0
|
Accept the WebSocket upgrade request. |
QHttpServerWebSocketUpgradeResponse::ResponseType::Deny
|
1
|
Deny the WebSocket upgrade request. |
QHttpServerWebSocketUpgradeResponse::ResponseType::PassToNext
|
2
|
Pass the Websocket upgrade decision to the next verifier if any. |
另请参阅 QAbstractHttpServer::addWebSocketUpgradeVerifier () 和 type ().
Copy-constructs an instance of a QHttpServerWebSocketUpgradeResponse object from other .
[noexcept]
QHttpServerWebSocketUpgradeResponse::
~QHttpServerWebSocketUpgradeResponse
()
销毁 QHttpServerWebSocketUpgradeResponse 对象。
[static]
QHttpServerWebSocketUpgradeResponse
QHttpServerWebSocketUpgradeResponse::
accept
()
Creates an instance of QHttpServerWebSocketUpgradeResponse with type () Accept .
另请参阅 ResponseType and type ().
[static]
QHttpServerWebSocketUpgradeResponse
QHttpServerWebSocketUpgradeResponse::
deny
()
Creates an instance of QHttpServerWebSocketUpgradeResponse with type () Deny , denyStatus () 403 and the denyMessage () "Forbidden".
另请参阅 ResponseType , type (), denyStatus (),和 denyMessage ().
[static]
QHttpServerWebSocketUpgradeResponse
QHttpServerWebSocketUpgradeResponse::
deny
(
int
status
,
QByteArray
message
)
Creates an instance of QHttpServerWebSocketUpgradeResponse with type () Deny , denyStatus () status and denyMessage () message .
另请参阅 ResponseType , type (), denyStatus (),和 denyMessage ().
Returns the error message to return if type () 是 Deny .
Returns the error message to return if type () 是 Deny .
Returns the HTTP status code to return if type () 是 Deny .
[static]
QHttpServerWebSocketUpgradeResponse
QHttpServerWebSocketUpgradeResponse::
passToNext
()
Creates an instance of QHttpServerWebSocketUpgradeResponse with type () PassToNext .
另请参阅 ResponseType and type ().
[noexcept]
void
QHttpServerWebSocketUpgradeResponse::
swap
(
QHttpServerWebSocketUpgradeResponse
&
other
)
Swaps the contents of this with other
Returns the type of response.
另请参阅 ResponseType .
[noexcept]
QHttpServerWebSocketUpgradeResponse
&QHttpServerWebSocketUpgradeResponse::
operator=
(
QHttpServerWebSocketUpgradeResponse
&&
other
)
Move-assigns the values of other 到此对象。
Copy-assigns the values of other 到此对象。