Title: [93008] branches/chromium/835/Source
Revision
93008
Author
[email protected]
Date
2011-08-12 15:59:02 -0700 (Fri, 12 Aug 2011)

Log Message

Need a way to selectively use hixie-76 for websocket connections depending on destination and/or origin
https://bugs.webkit.org/show_bug.cgi?id=65835

Patch by Denis Lagno <[email protected]> on 2011-08-12
Reviewed by Alexey Proskuryakov and Yuta Kitamura.

WebCore: 

No new tests. (because it is temporary solution for transient period between hixie-76 and hybi-NN).

* page/Settings.cpp:
(WebCore::Settings::addHixie76WebSocketProtocolException):
(WebCore::Settings::useHixie76WebSocketProtocol):
* page/Settings.h:
(WebCore::Settings::setUseHixie76WebSocketProtocol):
* websockets/WebSocketChannel.cpp:
(WebCore::WebSocketChannel::WebSocketChannel):

WebKit/chromium: 

* public/WebSettings.h:
* src/WebSettingsImpl.cpp:
(WebKit::WebSettingsImpl::addHixie76WebSocketProtocolException):
* src/WebSettingsImpl.h:

Modified Paths

Diff

Modified: branches/chromium/835/Source/WebCore/ChangeLog (93007 => 93008)


--- branches/chromium/835/Source/WebCore/ChangeLog	2011-08-12 22:56:35 UTC (rev 93007)
+++ branches/chromium/835/Source/WebCore/ChangeLog	2011-08-12 22:59:02 UTC (rev 93008)
@@ -1,3 +1,20 @@
+2011-08-12  Denis Lagno  <[email protected]>
+
+        Need a way to selectively use hixie-76 for websocket connections depending on destination and/or origin
+        https://bugs.webkit.org/show_bug.cgi?id=65835
+
+        Reviewed by Alexey Proskuryakov and Yuta Kitamura.
+
+        No new tests. (because it is temporary solution for transient period between hixie-76 and hybi-NN).
+
+        * page/Settings.cpp:
+        (WebCore::Settings::addHixie76WebSocketProtocolException):
+        (WebCore::Settings::useHixie76WebSocketProtocol):
+        * page/Settings.h:
+        (WebCore::Settings::setUseHixie76WebSocketProtocol):
+        * websockets/WebSocketChannel.cpp:
+        (WebCore::WebSocketChannel::WebSocketChannel):
+
 2011-08-11  David Reveman  <[email protected]>
 
         [Chromium] Temporarily disable layer anti-aliasing on ChromeOS.

Modified: branches/chromium/835/Source/WebCore/page/Settings.cpp (93007 => 93008)


--- branches/chromium/835/Source/WebCore/page/Settings.cpp	2011-08-12 22:56:35 UTC (rev 93007)
+++ branches/chromium/835/Source/WebCore/page/Settings.cpp	2011-08-12 22:59:02 UTC (rev 93008)
@@ -793,4 +793,33 @@
 #endif
 }
 
+#if ENABLE(WEB_SOCKETS)
+void Settings::addHixie76WebSocketProtocolException(const KURL& url)
+{
+    KURL tmp(url);
+    tmp.setPath(String());
+    tmp.setQuery(String());
+    tmp.setUser(String());
+    tmp.setPass(String());
+    tmp.removeFragmentIdentifier();
+    if (tmp.isValid() && (tmp.protocolIs("ws") || tmp.protocolIs("wss")))
+        m_hixie76WebSocketProtocolExceptionList.add(tmp.string());
+}
+
+bool Settings::useHixie76WebSocketProtocol(const KURL& url)
+{
+    if (m_useHixie76WebSocketProtocol)
+        return true;
+    if (m_hixie76WebSocketProtocolExceptionList.isEmpty())
+        return false;
+    KURL tmp(url);
+    tmp.setPath(String());
+    tmp.setQuery(String());
+    tmp.setUser(String());
+    tmp.setPass(String());
+    tmp.removeFragmentIdentifier();
+    return m_hixie76WebSocketProtocolExceptionList.contains(tmp.string());
+}
+#endif
+
 } // namespace WebCore

Modified: branches/chromium/835/Source/WebCore/page/Settings.h (93007 => 93008)


--- branches/chromium/835/Source/WebCore/page/Settings.h	2011-08-12 22:56:35 UTC (rev 93007)
+++ branches/chromium/835/Source/WebCore/page/Settings.h	2011-08-12 22:59:02 UTC (rev 93008)
@@ -32,8 +32,11 @@
 #include "KURL.h"
 #include "Timer.h"
 #include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
 #include <wtf/text/AtomicString.h>
 #include <wtf/text/AtomicStringHash.h>
+#include <wtf/text/StringHash.h>
+#include <wtf/text/WTFString.h>
 #include <wtf/unicode/Unicode.h>
 
 namespace WebCore {
@@ -439,8 +442,10 @@
         bool scrollAnimatorEnabled() const { return m_scrollAnimatorEnabled; }
 #endif
 #if ENABLE(WEB_SOCKETS)
-        void setUseHixie76WebSocketProtocol(bool flag) { m_useHixie76WebSocketProtocol = flag; }
-        bool useHixie76WebSocketProtocol() { return m_useHixie76WebSocketProtocol; }
+        void setUseHixie76WebSocketProtocol(bool flag) { m_useHixie76WebSocketProtocol = flag; m_hixie76WebSocketProtocolExceptionList.clear(); }
+        void addHixie76WebSocketProtocolException(const KURL&);
+        // Answers whether hixie-76 should be used for given websocket URL.
+        bool useHixie76WebSocketProtocol(const KURL&);
 #endif
 
         void setMediaPlaybackRequiresUserGesture(bool flag) { m_mediaPlaybackRequiresUserGesture = flag; };
@@ -567,6 +572,9 @@
 
         Timer<Settings> m_loadsImagesAutomaticallyTimer;
         void loadsImagesAutomaticallyTimerFired(Timer<Settings>*);
+#if ENABLE(WEB_SOCKETS)
+        HashSet<String> m_hixie76WebSocketProtocolExceptionList;
+#endif
 
 #if USE(AVFOUNDATION)
         static bool gAVFoundationEnabled;

Modified: branches/chromium/835/Source/WebCore/websockets/WebSocketChannel.cpp (93007 => 93008)


--- branches/chromium/835/Source/WebCore/websockets/WebSocketChannel.cpp	2011-08-12 22:56:35 UTC (rev 93007)
+++ branches/chromium/835/Source/WebCore/websockets/WebSocketChannel.cpp	2011-08-12 22:59:02 UTC (rev 93008)
@@ -102,7 +102,7 @@
     ASSERT(m_context->isDocument());
     Document* document = static_cast<Document*>(m_context);
     if (Settings* settings = document->settings())
-        m_useHixie76Protocol = settings->useHixie76WebSocketProtocol();
+        m_useHixie76Protocol = settings->useHixie76WebSocketProtocol(url);
     m_handshake = adoptPtr(new WebSocketHandshake(url, protocol, context, m_useHixie76Protocol));
 
     if (Page* page = document->page())

Modified: branches/chromium/835/Source/WebKit/chromium/ChangeLog (93007 => 93008)


--- branches/chromium/835/Source/WebKit/chromium/ChangeLog	2011-08-12 22:56:35 UTC (rev 93007)
+++ branches/chromium/835/Source/WebKit/chromium/ChangeLog	2011-08-12 22:59:02 UTC (rev 93008)
@@ -1,3 +1,15 @@
+2011-08-12  Denis Lagno  <[email protected]>
+
+        Need a way to selectively use hixie-76 for websocket connections depending on destination and/or origin
+        https://bugs.webkit.org/show_bug.cgi?id=65835
+
+        Reviewed by Alexey Proskuryakov and Yuta Kitamura.
+
+        * public/WebSettings.h:
+        * src/WebSettingsImpl.cpp:
+        (WebKit::WebSettingsImpl::addHixie76WebSocketProtocolException):
+        * src/WebSettingsImpl.h:
+
 2011-07-26  Brett Wilson  <[email protected]>
 
         Cancel the load when an associated URL loader goes out of scope.

Modified: branches/chromium/835/Source/WebKit/chromium/public/WebSettings.h (93007 => 93008)


--- branches/chromium/835/Source/WebKit/chromium/public/WebSettings.h	2011-08-12 22:56:35 UTC (rev 93007)
+++ branches/chromium/835/Source/WebKit/chromium/public/WebSettings.h	2011-08-12 22:59:02 UTC (rev 93008)
@@ -127,6 +127,7 @@
     virtual void setShouldPrintBackgrounds(bool) = 0;
     virtual void setEnableScrollAnimator(bool) = 0;
     virtual void setHixie76WebSocketProtocolEnabled(bool) = 0;
+    virtual void addHixie76WebSocketProtocolException(const WebURL&) = 0;
 
 protected:
     ~WebSettings() { }

Modified: branches/chromium/835/Source/WebKit/chromium/src/WebSettingsImpl.cpp (93007 => 93008)


--- branches/chromium/835/Source/WebKit/chromium/src/WebSettingsImpl.cpp	2011-08-12 22:56:35 UTC (rev 93007)
+++ branches/chromium/835/Source/WebKit/chromium/src/WebSettingsImpl.cpp	2011-08-12 22:59:02 UTC (rev 93008)
@@ -445,4 +445,13 @@
 #endif
 }
 
+void WebSettingsImpl::addHixie76WebSocketProtocolException(const WebURL& url)
+{
+#if ENABLE(WEB_SOCKETS)
+    m_settings->addHixie76WebSocketProtocolException(url);
+#else
+    UNUSED_PARAM(url);
+#endif
+}
+
 } // namespace WebKit

Modified: branches/chromium/835/Source/WebKit/chromium/src/WebSettingsImpl.h (93007 => 93008)


--- branches/chromium/835/Source/WebKit/chromium/src/WebSettingsImpl.h	2011-08-12 22:56:35 UTC (rev 93007)
+++ branches/chromium/835/Source/WebKit/chromium/src/WebSettingsImpl.h	2011-08-12 22:59:02 UTC (rev 93008)
@@ -120,6 +120,7 @@
     virtual void setShouldPrintBackgrounds(bool);
     virtual void setEnableScrollAnimator(bool);
     virtual void setHixie76WebSocketProtocolEnabled(bool);
+    virtual void addHixie76WebSocketProtocolException(const WebURL&);
 
 private:
     WebCore::Settings* m_settings;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to