diff options
author | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2015-02-24 12:21:34 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2015-02-24 12:21:34 +0000 |
commit | b01068a406f6ebf51e103dd541f36fd6ef144805 (patch) | |
tree | 9a1d2d634ce28672a72dfd1c7565f95cc82c2cb4 /src/websockets | |
parent | 9989055693ac6225ae3e6f8153862765b0cd5e7e (diff) | |
parent | b797778da01f72e64cda8680f29f3fa8434ffb0a (diff) | |
download | qtwebsockets-b01068a406f6ebf51e103dd541f36fd6ef144805.tar.gz |
Merge "Merge remote-tracking branch 'origin/5.4' into 5.5" into refs/staging/5.5
Diffstat (limited to 'src/websockets')
-rw-r--r-- | src/websockets/doc/qtwebsockets.qdocconf | 6 | ||||
-rw-r--r-- | src/websockets/qwebsockethandshakerequest.cpp | 18 |
2 files changed, 20 insertions, 4 deletions
diff --git a/src/websockets/doc/qtwebsockets.qdocconf b/src/websockets/doc/qtwebsockets.qdocconf index 3f87cef..2e1e15b 100644 --- a/src/websockets/doc/qtwebsockets.qdocconf +++ b/src/websockets/doc/qtwebsockets.qdocconf @@ -37,7 +37,7 @@ qhp.QtWebSockets.subprojects.examples.sortPages = true tagfile = ../../../doc/qtwebsockets/qtwebsockets.tags -depends += qtcore qtnetwork qtdoc +depends += qtcore qtnetwork qtdoc qmake headerdirs += .. \ ../../imports @@ -50,6 +50,10 @@ sourcedirs += .. \ exampledirs += ../../../examples/websockets \ snippets +examples.fileextensions += "*.html" + +imagedirs += ../../../examples/websockets/doc/images + manifestmeta.thumbnail.names += "QtWebSockets/*" navigation.landingpage = "Qt WebSockets" diff --git a/src/websockets/qwebsockethandshakerequest.cpp b/src/websockets/qwebsockethandshakerequest.cpp index 47586a7..436ac93 100644 --- a/src/websockets/qwebsockethandshakerequest.cpp +++ b/src/websockets/qwebsockethandshakerequest.cpp @@ -222,10 +222,22 @@ void QWebSocketHandshakeRequest::readHandshake(QTextStream &textStream) headerLine = textStream.readLine(); } - const QString host = m_headers.value(QStringLiteral("host"), QString()); m_requestUrl = QUrl::fromEncoded(resourceName.toLatin1()); - if (m_requestUrl.isRelative()) + QString host = m_headers.value(QStringLiteral("host"), QString()); + if (m_requestUrl.isRelative()) { + // see http://tools.ietf.org/html/rfc6455#page-17 + // No. 4 item in "The requirements for this handshake" + int idx = host.indexOf(":"); + bool ok = false; + int port; + if (idx != -1) { + port = host.rightRef(host.length() - idx - 1).toInt(&ok); + host.truncate(idx); + } m_requestUrl.setHost(host); + if (ok) + m_requestUrl.setPort(port); + } if (m_requestUrl.scheme().isEmpty()) { const QString scheme = isSecure() ? QStringLiteral("wss") : QStringLiteral("ws"); m_requestUrl.setScheme(scheme); @@ -260,7 +272,7 @@ void QWebSocketHandshakeRequest::readHandshake(QTextStream &textStream) connectionValues << (*c).trimmed(); //optional headers - m_origin = m_headers.value(QStringLiteral("sec-websocket-origin"), QString()); + m_origin = m_headers.value(QStringLiteral("origin"), QString()); const QStringList protocolLines = m_headers.values(QStringLiteral("sec-websocket-protocol")); for (QStringList::const_iterator pl = protocolLines.begin(); pl != protocolLines.end(); ++pl) { QStringList protocols = (*pl).split(QStringLiteral(","), QString::SkipEmptyParts); |