Commit 139b40a2 authored by tyoshino@chromium.org's avatar tyoshino@chromium.org

Remove cookieRequestHeaderFieldValue() and setCookie() call from WebSocketHandshake

These calls were for non-Chromium port of WebKit to get/set cookies on
WebSocket opening handshake. In Blink, they're no longer necessary.
Chromium intercepts handshakes in the browser process and add/remove
cookies. Any cookie header added by Blink is ignored. Set-cookies are
stripped before forwarded to Blink.

BUG=none

Review URL: https://codereview.chromium.org/209823002

git-svn-id: svn://svn.chromium.org/blink/trunk@170560 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 3708a061
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
#include "core/fileapi/FileReaderLoader.h" #include "core/fileapi/FileReaderLoader.h"
#include "core/frame/LocalFrame.h" #include "core/frame/LocalFrame.h"
#include "core/inspector/InspectorInstrumentation.h" #include "core/inspector/InspectorInstrumentation.h"
#include "core/loader/CookieJar.h"
#include "core/loader/FrameLoader.h" #include "core/loader/FrameLoader.h"
#include "core/loader/FrameLoaderClient.h" #include "core/loader/FrameLoaderClient.h"
#include "core/loader/UniqueIdentifier.h" #include "core/loader/UniqueIdentifier.h"
...@@ -454,13 +453,6 @@ bool MainThreadWebSocketChannel::processOneItemFromBuffer() ...@@ -454,13 +453,6 @@ bool MainThreadWebSocketChannel::processOneItemFromBuffer()
m_document->addConsoleMessage(JSMessageSource, WarningMessageLevel, message, m_sourceURLAtConstruction, m_lineNumberAtConstruction); m_document->addConsoleMessage(JSMessageSource, WarningMessageLevel, message, m_sourceURLAtConstruction, m_lineNumberAtConstruction);
} }
if (!m_handshake->serverSetCookie().isEmpty()) {
if (cookiesEnabled(m_document)) {
// Exception (for sandboxed documents) ignored.
m_document->setCookie(m_handshake->serverSetCookie(), IGNORE_EXCEPTION);
}
}
// FIXME: handle set-cookie2.
WTF_LOG(Network, "MainThreadWebSocketChannel %p Connected", this); WTF_LOG(Network, "MainThreadWebSocketChannel %p Connected", this);
skipBuffer(headerLength); skipBuffer(headerLength);
m_client->didConnect(); m_client->didConnect();
......
...@@ -209,13 +209,6 @@ CString WebSocketHandshake::clientHandshakeMessage() const ...@@ -209,13 +209,6 @@ CString WebSocketHandshake::clientHandshakeMessage() const
if (!m_clientProtocol.isEmpty()) if (!m_clientProtocol.isEmpty())
fields.append("Sec-WebSocket-Protocol: " + m_clientProtocol); fields.append("Sec-WebSocket-Protocol: " + m_clientProtocol);
KURL url = httpURLForAuthenticationAndCookies();
String cookie = cookieRequestHeaderFieldValue(m_document, url);
if (!cookie.isEmpty())
fields.append("Cookie: " + cookie);
// Set "Cookie2: <cookie>" if cookies 2 exists for url?
// Add no-cache headers to avoid compatibility issue. // Add no-cache headers to avoid compatibility issue.
// There are some proxies that rewrite "Connection: upgrade" // There are some proxies that rewrite "Connection: upgrade"
// to "Connection: close" in the response if a request doesn't contain // to "Connection: close" in the response if a request doesn't contain
...@@ -349,16 +342,6 @@ const AtomicString& WebSocketHandshake::serverWebSocketProtocol() const ...@@ -349,16 +342,6 @@ const AtomicString& WebSocketHandshake::serverWebSocketProtocol() const
return m_response.headerFields().get("sec-websocket-protocol"); return m_response.headerFields().get("sec-websocket-protocol");
} }
const AtomicString& WebSocketHandshake::serverSetCookie() const
{
return m_response.headerFields().get("set-cookie");
}
const AtomicString& WebSocketHandshake::serverSetCookie2() const
{
return m_response.headerFields().get("set-cookie2");
}
const AtomicString& WebSocketHandshake::serverUpgrade() const const AtomicString& WebSocketHandshake::serverUpgrade() const
{ {
return m_response.headerFields().get("upgrade"); return m_response.headerFields().get("upgrade");
......
...@@ -67,7 +67,12 @@ public: ...@@ -67,7 +67,12 @@ public:
String clientOrigin() const; String clientOrigin() const;
String clientLocation() const; String clientLocation() const;
// Builds a WebSocket opening handshake string to send to the server.
// Cookie headers will be added later by the platform code for security
// reason.
CString clientHandshakeMessage() const; CString clientHandshakeMessage() const;
// Builds an object representing WebSocket opening handshake to pass to the
// inspector.
PassRefPtr<WebSocketHandshakeRequest> clientHandshakeRequest() const; PassRefPtr<WebSocketHandshakeRequest> clientHandshakeRequest() const;
// We're collecting data for histogram in the destructor. Note that calling // We're collecting data for histogram in the destructor. Note that calling
...@@ -81,8 +86,6 @@ public: ...@@ -81,8 +86,6 @@ public:
String failureReason() const; String failureReason() const;
const AtomicString& serverWebSocketProtocol() const; const AtomicString& serverWebSocketProtocol() const;
const AtomicString& serverSetCookie() const;
const AtomicString& serverSetCookie2() const;
const AtomicString& serverUpgrade() const; const AtomicString& serverUpgrade() const;
const AtomicString& serverConnection() const; const AtomicString& serverConnection() const;
const AtomicString& serverWebSocketAccept() const; const AtomicString& serverWebSocketAccept() const;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment