RESOLVED FIXED 39864
Fix WebSocketHandshakeRequest so that it fits the new handshake protocol
https://bugs.webkit.org/show_bug.cgi?id=39864
Summary Fix WebSocketHandshakeRequest so that it fits the new handshake protocol
Yuta Kitamura
Reported 2010-05-27 23:55:46 PDT
The new WebSocket specification (draft 76 and later) allows a browser to send header fields in arbitrary order. Thus we can use a HTTPHeaderMap to store header fields instead of Vector of pairs of a field name and a field value.
Attachments
Patch (7.42 KB, patch)
2010-05-28 00:01 PDT, Yuta Kitamura
no flags
Patch (Add Key1, 2 and 3) (8.46 KB, patch)
2010-05-30 23:05 PDT, Yuta Kitamura
ap: review+
morrita: commit-queue-
Yuta Kitamura
Comment 1 2010-05-28 00:01:29 PDT
Fumitoshi Ukai
Comment 2 2010-05-28 00:57:36 PDT
Comment on attachment 57299 [details] Patch > diff --git a/WebCore/websockets/WebSocketHandshake.cpp b/WebCore/websockets/WebSocketHandshake.cpp > index ea4f5e5657c53c2532e6d90aec410e0d79976be3..9b1fa591278af51db482e4885adce0a7ec511e3a 100644 > --- a/WebCore/websockets/WebSocketHandshake.cpp > +++ b/WebCore/websockets/WebSocketHandshake.cpp > @@ -279,14 +279,20 @@ WebSocketHandshakeRequest WebSocketHandshake::clientHandshakeRequest() const > // Keep the following consistent with clientHandshakeMessage(). > // FIXME: do we need to store m_secWebSocketKey1, m_secWebSocketKey2 and > // m_key3 in WebSocketHandshakeRequest? > - WebSocketHandshakeRequest request(m_url, clientOrigin(), m_clientProtocol); > + WebSocketHandshakeRequest request("GET", m_url); > + request.addHeaderField("Upgrade", "WebSocket"); > + request.addHeaderField("Connection", "Upgrade"); > + request.addHeaderField("Host", hostName(m_url, m_secure)); > + request.addHeaderField("Origin", clientOrigin()); > + if (!m_clientProtocol.isEmpty()) > + request.addHeaderField("Sec-WebSocket-Protocol:", m_clientProtocol); Don't we want to add Sec-WebSocket-Key1, Key2 ? How about key3 ?
Yuta Kitamura
Comment 3 2010-05-30 19:34:47 PDT
(In reply to comment #2) > (From update of attachment 57299 [details]) > > > diff --git a/WebCore/websockets/WebSocketHandshake.cpp b/WebCore/websockets/WebSocketHandshake.cpp > > index ea4f5e5657c53c2532e6d90aec410e0d79976be3..9b1fa591278af51db482e4885adce0a7ec511e3a 100644 > > --- a/WebCore/websockets/WebSocketHandshake.cpp > > +++ b/WebCore/websockets/WebSocketHandshake.cpp > > @@ -279,14 +279,20 @@ WebSocketHandshakeRequest WebSocketHandshake::clientHandshakeRequest() const > > // Keep the following consistent with clientHandshakeMessage(). > > // FIXME: do we need to store m_secWebSocketKey1, m_secWebSocketKey2 and > > // m_key3 in WebSocketHandshakeRequest? > > - WebSocketHandshakeRequest request(m_url, clientOrigin(), m_clientProtocol); > > + WebSocketHandshakeRequest request("GET", m_url); > > + request.addHeaderField("Upgrade", "WebSocket"); > > + request.addHeaderField("Connection", "Upgrade"); > > + request.addHeaderField("Host", hostName(m_url, m_secure)); > > + request.addHeaderField("Origin", clientOrigin()); > > + if (!m_clientProtocol.isEmpty()) > > + request.addHeaderField("Sec-WebSocket-Protocol:", m_clientProtocol); > > Don't we want to add Sec-WebSocket-Key1, Key2 ? > How about key3 ? I think we should have them. Let me update the patch.
Yuta Kitamura
Comment 4 2010-05-30 23:05:48 PDT
Created attachment 57435 [details] Patch (Add Key1, 2 and 3)
Alexey Proskuryakov
Comment 5 2010-06-17 10:35:56 PDT
Comment on attachment 57435 [details] Patch (Add Key1, 2 and 3) r=me
Yuta Kitamura
Comment 6 2010-06-17 19:32:11 PDT
(In reply to comment #5) > (From update of attachment 57435 [details]) > r=me Thank you!
Hajime Morrita
Comment 7 2010-06-22 01:47:13 PDT
Comment on attachment 57435 [details] Patch (Add Key1, 2 and 3) I'll land this manually.
Hajime Morrita
Comment 8 2010-06-22 02:00:29 PDT
Note You need to log in before you can comment on or make changes to this bug.