diff options
-rw-r--r-- | src/websockets/qwebsockethandshakeresponse.cpp | 5 | ||||
-rw-r--r-- | src/websockets/qwebsocketserver.cpp | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/websockets/qwebsockethandshakeresponse.cpp b/src/websockets/qwebsockethandshakeresponse.cpp index ee57d5c..2241ca2 100644 --- a/src/websockets/qwebsockethandshakeresponse.cpp +++ b/src/websockets/qwebsockethandshakeresponse.cpp @@ -186,8 +186,9 @@ QString QWebSocketHandshakeResponse::getHandshakeResponse( if (origin.isEmpty()) origin = QStringLiteral("*"); QDateTime datetime = QDateTime::currentDateTimeUtc(); - response << QStringLiteral("Server: ") % serverName << - QStringLiteral("Access-Control-Allow-Credentials: false") << + if (!serverName.isEmpty()) + response << QStringLiteral("Server: ") % serverName; + response << QStringLiteral("Access-Control-Allow-Credentials: false") << QStringLiteral("Access-Control-Allow-Methods: GET") << QStringLiteral("Access-Control-Allow-Headers: content-type") << QStringLiteral("Access-Control-Allow-Origin: ") % origin << diff --git a/src/websockets/qwebsocketserver.cpp b/src/websockets/qwebsocketserver.cpp index be66946..5111bfd 100644 --- a/src/websockets/qwebsocketserver.cpp +++ b/src/websockets/qwebsocketserver.cpp @@ -241,7 +241,7 @@ QT_BEGIN_NAMESPACE /*! Constructs a new QWebSocketServer with the given \a serverName. The \a serverName will be used in the HTTP handshake phase to identify the server. - It can be empty, in which case an empty server name will be sent to the client. + It can be empty, in which case no server name will be sent to the client. The \a secureMode parameter indicates whether the server operates over wss (\l{SecureMode}) or over ws (\l{NonSecureMode}). |