summaryrefslogtreecommitdiffstats
path: root/WebCore/websockets/WebSocketHandshake.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2009-12-15 10:12:09 +0000
committerSteve Block <steveblock@google.com>2009-12-17 17:41:10 +0000
commit643ca7872b450ea4efacab6188849e5aac2ba161 (patch)
tree6982576c228bcd1a7efe98afed544d840751094c /WebCore/websockets/WebSocketHandshake.cpp
parentd026980fde6eb3b01c1fe49441174e89cd1be298 (diff)
downloadexternal_webkit-643ca7872b450ea4efacab6188849e5aac2ba161.zip
external_webkit-643ca7872b450ea4efacab6188849e5aac2ba161.tar.gz
external_webkit-643ca7872b450ea4efacab6188849e5aac2ba161.tar.bz2
Merge webkit.org at r51976 : Initial merge by git.
Change-Id: Ib0e7e2f0fb4bee5a186610272edf3186f0986b43
Diffstat (limited to 'WebCore/websockets/WebSocketHandshake.cpp')
-rw-r--r--WebCore/websockets/WebSocketHandshake.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/WebCore/websockets/WebSocketHandshake.cpp b/WebCore/websockets/WebSocketHandshake.cpp
index 691fa1c..d1da443 100644
--- a/WebCore/websockets/WebSocketHandshake.cpp
+++ b/WebCore/websockets/WebSocketHandshake.cpp
@@ -74,6 +74,13 @@ static String extractResponseCode(const char* header, int len)
return String(space1 + 1, space2 - space1 - 1);
}
+static String resourceName(const KURL& url)
+{
+ if (url.query().isNull())
+ return url.path();
+ return url.path() + "?" + url.query();
+}
+
WebSocketHandshake::WebSocketHandshake(const KURL& url, const String& protocol, ScriptExecutionContext* context)
: m_url(url)
, m_clientProtocol(protocol)
@@ -139,7 +146,7 @@ String WebSocketHandshake::clientLocation() const
builder.append(String::number(m_url.port()));
}
}
- builder.append(m_url.path());
+ builder.append(resourceName(m_url));
return builder.toString();
}
@@ -148,11 +155,7 @@ CString WebSocketHandshake::clientHandshakeMessage() const
StringBuilder builder;
builder.append("GET ");
- builder.append(m_url.path());
- if (!m_url.query().isEmpty()) {
- builder.append("?");
- builder.append(m_url.query());
- }
+ builder.append(resourceName(m_url));
builder.append(" HTTP/1.1\r\n");
builder.append("Upgrade: WebSocket\r\n");
builder.append("Connection: Upgrade\r\n");