summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2015-02-24 12:21:34 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2015-02-24 12:21:34 +0000
commitb01068a406f6ebf51e103dd541f36fd6ef144805 (patch)
tree9a1d2d634ce28672a72dfd1c7565f95cc82c2cb4 /src
parent9989055693ac6225ae3e6f8153862765b0cd5e7e (diff)
parentb797778da01f72e64cda8680f29f3fa8434ffb0a (diff)
downloadqtwebsockets-b01068a406f6ebf51e103dd541f36fd6ef144805.tar.gz
Merge "Merge remote-tracking branch 'origin/5.4' into 5.5" into refs/staging/5.5
Diffstat (limited to 'src')
-rw-r--r--src/websockets/doc/qtwebsockets.qdocconf6
-rw-r--r--src/websockets/qwebsockethandshakerequest.cpp18
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);