[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.21-584-g1e41756

ukai at chromium.org ukai at chromium.org
Fri Feb 26 22:18:31 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 80cd41da8cf46329c2c3be12034a789dbb2ad198
Author: ukai at chromium.org <ukai at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Feb 12 08:00:52 2010 +0000

    2010-02-11  Fumitoshi Ukai  <ukai at chromium.org>
    
            Reviewed by Alexey Proskuryakov.
    
            WebSocket ignores HttpOnly cookies, but should use in Handshake.
            https://bugs.webkit.org/show_bug.cgi?id=34289
    
            * websocket/tests/cookies/echo-cookie_wsh.py: Added.
            * websocket/tests/cookies/httponly-cookie-expected.txt: Added.
            * websocket/tests/cookies/httponly-cookie.pl: Added.
    2010-02-11  Fumitoshi Ukai  <ukai at chromium.org>
    
            Reviewed by Alexey Proskuryakov.
    
            WebSocket ignores HttpOnly cookies, but should use in Handshake.
            https://bugs.webkit.org/show_bug.cgi?id=34289
    
            Test: websocket/tests/cookies/httponly-cookie.pl
    
            * platform/CookieJar.h: add cookieRequestHeaderFieldValue()
            * platform/chromium/ChromiumBridge.h:
            * platform/haiku/CookieJarHaiku.cpp:
            (WebCore::cookieRequestHeaderFieldValue):
            * platform/mac/CookieJar.mm:
            (WebCore::cookies):
            (WebCore::cookieRequestHeaderFieldValue):
            * platform/network/android/CookieJarAndroid.cpp:
            (WebCore::cookieRequestHeaderFieldValue):
            * platform/network/chromium/CookieJarChromium.cpp:
            (WebCore::cookieRequestHeaderFieldValue):
            * platform/network/curl/CookieJarCurl.cpp:
            (WebCore::cookieRequestHeaderFieldValue):
            * platform/network/soup/CookieJarSoup.cpp:
            (WebCore::cookieRequestHeaderFieldValue):
            * platform/network/win/CookieJarCFNetWin.cpp:
            (WebCore::cookieRequestHeaderFieldValue):
            * platform/network/win/CookieJarWin.cpp:
            (WebCore::cookieRequestHeaderFieldValue):
            * platform/qt/CookieJarQt.cpp:
            (WebCore::cookieRequestHeaderFieldValue):
            * websockets/WebSocketHandshake.cpp:
            (WebCore::WebSocketHandshake::clientHandshakeMessage): use cookieRequestHeaderFieldValue() instead of cookies() to include HttpOnly cookies.
    2010-02-11  Fumitoshi Ukai  <ukai at chromium.org>
    
            Reviewed by Alexey Proskuryakov.
    
            WebSocket ignores HttpOnly cookies, but should use in Handshake.
            https://bugs.webkit.org/show_bug.cgi?id=34289
    
            Update pywebsocket to 0.4.8, which supports cgi directories.
            run-webkit-tests and run-webkit-websocketserver will run
            pywebsocket, specifying /websocket/test/cookies as cgi directory.
    
            * Scripts/run-webkit-tests:
            * Scripts/run-webkit-websocketserver:
            * pywebsocket/mod_pywebsocket/standalone.py:
            * pywebsocket/setup.py:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54707 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 45bd863..fc0510f 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
+2010-02-11  Fumitoshi Ukai  <ukai at chromium.org>
+
+        Reviewed by Alexey Proskuryakov.
+
+        WebSocket ignores HttpOnly cookies, but should use in Handshake.
+        https://bugs.webkit.org/show_bug.cgi?id=34289
+
+        * websocket/tests/cookies/echo-cookie_wsh.py: Added.
+        * websocket/tests/cookies/httponly-cookie-expected.txt: Added.
+        * websocket/tests/cookies/httponly-cookie.pl: Added.
+
 2010-02-11  Eric Seidel  <eric at webkit.org>
 
         Reviewed by Adam Barth.
diff --git a/LayoutTests/websocket/tests/cookies/echo-cookie_wsh.py b/LayoutTests/websocket/tests/cookies/echo-cookie_wsh.py
new file mode 100644
index 0000000..7a4ac2d
--- /dev/null
+++ b/LayoutTests/websocket/tests/cookies/echo-cookie_wsh.py
@@ -0,0 +1,36 @@
+# Copyright (C) 2010 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+from mod_pywebsocket import msgutil
+
+def web_socket_do_extra_handshake(request):
+    pass
+
+def web_socket_transfer_data(request):
+    msgutil.send_message(request,  request.headers_in['Cookie'])
diff --git a/LayoutTests/websocket/tests/cookies/httponly-cookie-expected.txt b/LayoutTests/websocket/tests/cookies/httponly-cookie-expected.txt
new file mode 100644
index 0000000..37907aa
--- /dev/null
+++ b/LayoutTests/websocket/tests/cookies/httponly-cookie-expected.txt
@@ -0,0 +1,11 @@
+Test WebSocket sends HttpOnly cookies.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+WebSocket open
+WebSocket closed
+PASS cookie is "WK-websocket-test=1; WK-websocket-test-httponly=1"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/websocket/tests/cookies/httponly-cookie.pl b/LayoutTests/websocket/tests/cookies/httponly-cookie.pl
new file mode 100755
index 0000000..d521e0a
--- /dev/null
+++ b/LayoutTests/websocket/tests/cookies/httponly-cookie.pl
@@ -0,0 +1,50 @@
+#!/usr/bin/perl -wT
+use strict;
+
+print "Set-Cookie: WK-websocket-test=1\r\n";
+print "Set-Cookie: WK-websocket-test-httponly=1; HttpOnly\r\n";
+print "\r\n";
+print <<HTML
+<html>
+<head>
+<script src="../../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../../fast/js/resources/js-test-post-function.js"></script>
+</head>
+<body>
+<p>Test WebSocket sends HttpOnly cookies.</p>
+<p>On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".</p>
+<div id="console"></div>
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+var cookie;
+
+function endTest()
+{
+    shouldBe("cookie", '"WK-websocket-test=1; WK-websocket-test-httponly=1"');
+    isSuccessfullyParsed();
+    if (window.layoutTestController)
+       layoutTestController.notifyDone();
+}
+
+var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/cookies/echo-cookie");
+ws.onopen = function() {
+    debug("WebSocket open");
+};
+ws.onmessage = function(evt) {
+    cookie = evt.data;
+    ws.close();
+};
+ws.onclose = function() {
+    debug("WebSocket closed");
+    endTest();
+};
+
+var successfullyParsed = true;
+</script>
+</body>
+</html>
+HTML
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 9e1247a..0b901fa 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,36 @@
+2010-02-11  Fumitoshi Ukai  <ukai at chromium.org>
+
+        Reviewed by Alexey Proskuryakov.
+
+        WebSocket ignores HttpOnly cookies, but should use in Handshake.
+        https://bugs.webkit.org/show_bug.cgi?id=34289
+
+        Test: websocket/tests/cookies/httponly-cookie.pl
+
+        * platform/CookieJar.h: add cookieRequestHeaderFieldValue()
+        * platform/chromium/ChromiumBridge.h:
+        * platform/haiku/CookieJarHaiku.cpp:
+        (WebCore::cookieRequestHeaderFieldValue):
+        * platform/mac/CookieJar.mm:
+        (WebCore::cookies):
+        (WebCore::cookieRequestHeaderFieldValue):
+        * platform/network/android/CookieJarAndroid.cpp:
+        (WebCore::cookieRequestHeaderFieldValue):
+        * platform/network/chromium/CookieJarChromium.cpp:
+        (WebCore::cookieRequestHeaderFieldValue):
+        * platform/network/curl/CookieJarCurl.cpp:
+        (WebCore::cookieRequestHeaderFieldValue):
+        * platform/network/soup/CookieJarSoup.cpp:
+        (WebCore::cookieRequestHeaderFieldValue):
+        * platform/network/win/CookieJarCFNetWin.cpp:
+        (WebCore::cookieRequestHeaderFieldValue):
+        * platform/network/win/CookieJarWin.cpp:
+        (WebCore::cookieRequestHeaderFieldValue):
+        * platform/qt/CookieJarQt.cpp:
+        (WebCore::cookieRequestHeaderFieldValue):
+        * websockets/WebSocketHandshake.cpp:
+        (WebCore::WebSocketHandshake::clientHandshakeMessage): use cookieRequestHeaderFieldValue() instead of cookies() to include HttpOnly cookies.
+
 2010-02-11  Ariya Hidayat  <ariya.hidayat at gmail.com>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebCore/platform/CookieJar.h b/WebCore/platform/CookieJar.h
index 987543e..fb1abee 100644
--- a/WebCore/platform/CookieJar.h
+++ b/WebCore/platform/CookieJar.h
@@ -36,7 +36,9 @@ namespace WebCore {
 
     struct Cookie;
 
+    // cookies omits HttpOnly cookies.
     String cookies(const Document*, const KURL&);
+    String cookieRequestHeaderFieldValue(const Document*, const KURL&);
     void setCookies(Document*, const KURL&, const String&);
     bool cookiesEnabled(const Document*);
     bool getRawCookies(const Document*, const KURL&, Vector<Cookie>&);
diff --git a/WebCore/platform/chromium/ChromiumBridge.h b/WebCore/platform/chromium/ChromiumBridge.h
index 92b4c13..83f9c81 100644
--- a/WebCore/platform/chromium/ChromiumBridge.h
+++ b/WebCore/platform/chromium/ChromiumBridge.h
@@ -85,6 +85,7 @@ namespace WebCore {
         // Cookies ------------------------------------------------------------
         static void setCookies(const KURL& url, const KURL& firstPartyForCookies, const String& value);
         static String cookies(const KURL& url, const KURL& firstPartyForCookies);
+        static String cookieRequestHeaderFieldValue(const KURL& url, const KURL& firstPartyForCookies);
         static bool rawCookies(const KURL& url, const KURL& firstPartyForCookies, Vector<Cookie>*);
         static void deleteCookie(const KURL& url, const String& cookieName);
         static bool cookiesEnabled(const KURL& url, const KURL& firstPartyForCookies);
diff --git a/WebCore/platform/haiku/CookieJarHaiku.cpp b/WebCore/platform/haiku/CookieJarHaiku.cpp
index 831b379..f619f00 100644
--- a/WebCore/platform/haiku/CookieJarHaiku.cpp
+++ b/WebCore/platform/haiku/CookieJarHaiku.cpp
@@ -52,6 +52,12 @@ String cookies(const Document*, const KURL& url)
     return cookieJar.get(url.string());
 }
 
+String cookieRequestHeaderFieldValue(const Document*, const KURL& url)
+{
+    // FIXME: include HttpOnly cookies.
+    return cookieJar.get(url.string());
+}
+
 bool cookiesEnabled(const Document*)
 {
     // FIXME: This should probably be a setting
diff --git a/WebCore/platform/mac/CookieJar.mm b/WebCore/platform/mac/CookieJar.mm
index e1d3e5a..df24b03 100644
--- a/WebCore/platform/mac/CookieJar.mm
+++ b/WebCore/platform/mac/CookieJar.mm
@@ -86,6 +86,18 @@ String cookies(const Document*, const KURL& url)
     return String();
 }
 
+String cookieRequestHeaderFieldValue(const Document*, const KURL& url)
+{
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+
+    NSURL *cookieURL = url;
+    NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:cookieURL];
+    return [[NSHTTPCookie requestHeaderFieldsWithCookies:cookies] objectForKey:@"Cookie"];
+
+    END_BLOCK_OBJC_EXCEPTIONS;
+    return String();
+}
+
 void setCookies(Document* document, const KURL& url, const String& cookieStr)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
diff --git a/WebCore/platform/network/android/CookieJarAndroid.cpp b/WebCore/platform/network/android/CookieJarAndroid.cpp
index ba4b5dc..dd324c5 100644
--- a/WebCore/platform/network/android/CookieJarAndroid.cpp
+++ b/WebCore/platform/network/android/CookieJarAndroid.cpp
@@ -41,6 +41,12 @@ String cookies(const Document*, const KURL& url)
     return PlatformBridge::cookies(url);
 }
 
+String cookieRequestHeaderFieldValue(const Document*, const KURL& url)
+{
+    // FIXME: include HttpOnly cookie.
+    return PlatformBridge::cookies(url);
+}
+
 bool cookiesEnabled(const Document*)
 {
     return PlatformBridge::cookiesEnabled();
diff --git a/WebCore/platform/network/chromium/CookieJarChromium.cpp b/WebCore/platform/network/chromium/CookieJarChromium.cpp
index 35f1c3f..41cf331 100644
--- a/WebCore/platform/network/chromium/CookieJarChromium.cpp
+++ b/WebCore/platform/network/chromium/CookieJarChromium.cpp
@@ -47,6 +47,25 @@ String cookies(const Document* document, const KURL& url)
     return ChromiumBridge::cookies(url, document->firstPartyForCookies());
 }
 
+String cookieRequestHeaderFieldValue(const Document* document, const KURL& url)
+{
+    // FIXME: move in ChromiumBridge?
+    Vector<Cookie> cookies;
+    getRawCookies(document, url, cookies);
+    String cookieLine;
+    // FIXME: Set $Version=v;
+    for (size_t i = 0; i < cookies.size(); i++) {
+        Cookie cookie = cookies[i];
+        if (i > 0)
+            cookieLine += "; ";
+        if (!cookie.name.isEmpty())
+            cookieLine += cookie.name + "=";
+        cookieLine += cookie.value;
+        // FIXME: set $Path, $Domain, ...
+    }
+    return cookieLine;
+}
+
 bool cookiesEnabled(const Document* document)
 {
     return ChromiumBridge::cookiesEnabled(document->cookieURL(), document->firstPartyForCookies());
diff --git a/WebCore/platform/network/curl/CookieJarCurl.cpp b/WebCore/platform/network/curl/CookieJarCurl.cpp
index 3bad4e4..7c906a0 100644
--- a/WebCore/platform/network/curl/CookieJarCurl.cpp
+++ b/WebCore/platform/network/curl/CookieJarCurl.cpp
@@ -39,6 +39,12 @@ String cookies(const Document* /*document*/, const KURL& url)
     return cookieJar.get(url.string());
 }
 
+String cookieRequestHeaderFieldValue(const Document* /*document*/, const KURL& url)
+{
+    // FIXME: include HttpOnly cookie.
+    return cookieJar.get(url.string());
+}
+
 bool cookiesEnabled(const Document* /*document*/)
 {
     return true;
diff --git a/WebCore/platform/network/soup/CookieJarSoup.cpp b/WebCore/platform/network/soup/CookieJarSoup.cpp
index 04becf5..d6479b2 100644
--- a/WebCore/platform/network/soup/CookieJarSoup.cpp
+++ b/WebCore/platform/network/soup/CookieJarSoup.cpp
@@ -93,6 +93,22 @@ String cookies(const Document* /*document*/, const KURL& url)
     return result;
 }
 
+String cookieRequestHeaderFieldValue(const Document* /*document*/, const KURL& url)
+{
+    SoupCookieJar* jar = defaultCookieJar();
+    if (!jar)
+        return String();
+
+    SoupURI* uri = soup_uri_new(url.string().utf8().data());
+    char* cookies = soup_cookie_jar_get_cookies(jar, uri, TRUE);
+    soup_uri_free(uri);
+
+    String result(String::fromUTF8(cookies));
+    g_free(cookies);
+
+    return result;
+}
+
 bool cookiesEnabled(const Document* /*document*/)
 {
     return defaultCookieJar();
diff --git a/WebCore/platform/network/win/CookieJarCFNetWin.cpp b/WebCore/platform/network/win/CookieJarCFNetWin.cpp
index 33b795a..d431289 100644
--- a/WebCore/platform/network/win/CookieJarCFNetWin.cpp
+++ b/WebCore/platform/network/win/CookieJarCFNetWin.cpp
@@ -106,6 +106,20 @@ String cookies(const Document* /*document*/, const KURL& url)
     return (CFStringRef)CFDictionaryGetValue(headerCF.get(), s_cookieCF);
 }
 
+String cookieRequestHeaderFieldValue(const Document* /*document*/, const KURL& url)
+{
+    CFHTTPCookieStorageRef cookieStorage = currentCookieStorage();
+    if (!cookieStorage)
+        return String();
+
+    RetainPtr<CFURLRef> urlCF(AdoptCF, url.createCFURL());
+
+    bool secure = url.protocolIs("https");
+    RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieStorageCopyCookiesForURL(cookieStorage, urlCF.get(), secure));
+    RetainPtr<CFDictionaryRef> headerCF(AdoptCF, CFHTTPCookieCopyRequestHeaderFields(kCFAllocatorDefault, cookiesCF.get()));
+    return (CFStringRef)CFDictionaryGetValue(headerCF.get(), s_cookieCF);
+}
+
 bool cookiesEnabled(const Document* /*document*/)
 {
     CFHTTPCookieStorageAcceptPolicy policy = CFHTTPCookieStorageAcceptPolicyOnlyFromMainDocumentDomain;
diff --git a/WebCore/platform/network/win/CookieJarWin.cpp b/WebCore/platform/network/win/CookieJarWin.cpp
index 6576e07..2bdd6b3 100644
--- a/WebCore/platform/network/win/CookieJarWin.cpp
+++ b/WebCore/platform/network/win/CookieJarWin.cpp
@@ -59,6 +59,12 @@ String cookies(const Document* /*document*/, const KURL& url)
     return String::adopt(buffer);
 }
 
+String cookieRequestHeaderFieldValue(const Document* document, const KURL& url)
+{
+    // FIXME: include HttpOnly cookie
+    return cookies(document, url);
+}
+
 bool cookiesEnabled(const Document* /*document*/)
 {
     return true;
diff --git a/WebCore/platform/qt/CookieJarQt.cpp b/WebCore/platform/qt/CookieJarQt.cpp
index b621e7e..01d1756 100644
--- a/WebCore/platform/qt/CookieJarQt.cpp
+++ b/WebCore/platform/qt/CookieJarQt.cpp
@@ -103,6 +103,26 @@ String cookies(const Document* document, const KURL& url)
     return resultCookies.join(QLatin1String("; "));
 }
 
+String cookieRequestHeaderFieldValue(const Document* document, const KURL &url)
+{
+    QUrl u(url);
+    QNetworkCookieJar* jar = cookieJar(document);
+    if (!jar)
+        return String();
+
+    QList<QNetworkCookie> cookies = jar->cookiesForUrl(u);
+    if (cookies.isEmpty())
+        return String();
+
+    QStringList resultCookies;
+    foreach (QNetworkCookie networkCookie, cookies) {
+        resultCookies.append(QString::fromAscii(
+                             networkCookie.toRawForm(QNetworkCookie::NameAndValueOnly).constData()));
+    }
+
+    return resultCookies.join(QLatin1String("; "));
+}
+
 bool cookiesEnabled(const Document* document)
 {
     QNetworkCookieJar* jar = cookieJar(document);
diff --git a/WebCore/websockets/WebSocketHandshake.cpp b/WebCore/websockets/WebSocketHandshake.cpp
index 883f84b..4471096 100644
--- a/WebCore/websockets/WebSocketHandshake.cpp
+++ b/WebCore/websockets/WebSocketHandshake.cpp
@@ -36,6 +36,7 @@
 
 #include "AtomicString.h"
 #include "CString.h"
+#include "Cookie.h"
 #include "CookieJar.h"
 #include "Document.h"
 #include "HTTPHeaderMap.h"
@@ -186,7 +187,7 @@ CString WebSocketHandshake::clientHandshakeMessage() const
     // Set "Authorization: <credentials>" if authentication information exists for url.
     if (m_context->isDocument()) {
         Document* document = static_cast<Document*>(m_context);
-        String cookie = cookies(document, url);
+        String cookie = cookieRequestHeaderFieldValue(document, url);
         if (!cookie.isEmpty()) {
             builder.append("Cookie: ");
             builder.append(cookie);
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 2552bb8..64f9452 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,19 @@
+2010-02-11  Fumitoshi Ukai  <ukai at chromium.org>
+
+        Reviewed by Alexey Proskuryakov.
+
+        WebSocket ignores HttpOnly cookies, but should use in Handshake.
+        https://bugs.webkit.org/show_bug.cgi?id=34289
+
+        Update pywebsocket to 0.4.8, which supports cgi directories.
+        run-webkit-tests and run-webkit-websocketserver will run
+        pywebsocket, specifying /websocket/test/cookies as cgi directory.
+
+        * Scripts/run-webkit-tests:
+        * Scripts/run-webkit-websocketserver:
+        * pywebsocket/mod_pywebsocket/standalone.py:
+        * pywebsocket/setup.py:
+
 2010-02-11  Jesus Sanchez-Palencia  <jesus.palencia at openbossa.org>
 
         Reviewed by Dan Bernstein.
diff --git a/WebKitTools/Scripts/run-webkit-tests b/WebKitTools/Scripts/run-webkit-tests
index 89d3ecb..809e078 100755
--- a/WebKitTools/Scripts/run-webkit-tests
+++ b/WebKitTools/Scripts/run-webkit-tests
@@ -1398,6 +1398,7 @@ sub openWebSocketServerIfNeeded()
         "-d", "$webSocketHandlerDir",
         "-s", "$webSocketHandlerScanDir",
         "-m", "$webSocketHandlerMapFile",
+        "-x", "/websocket/tests/cookies",
         "-l", "$logFile",
         "--strict",
     );
diff --git a/WebKitTools/Scripts/run-webkit-websocketserver b/WebKitTools/Scripts/run-webkit-websocketserver
index bbc5af6..64a724d 100755
--- a/WebKitTools/Scripts/run-webkit-websocketserver
+++ b/WebKitTools/Scripts/run-webkit-websocketserver
@@ -75,6 +75,7 @@ sub openWebSocketServer()
         "-d", "$webSocketHandlerDir",
         "-s", "$webSocketHandlerScanDir",
         "-m", "$webSocketHandlerMapFile",
+        "-x", "/websocket/tests/cookies",
     );
 
     $ENV{"PYTHONPATH"} = $webSocketPythonPath;
diff --git a/WebKitTools/pywebsocket/mod_pywebsocket/standalone.py b/WebKitTools/pywebsocket/mod_pywebsocket/standalone.py
index 0e6a349..8628ff9 100644
--- a/WebKitTools/pywebsocket/mod_pywebsocket/standalone.py
+++ b/WebKitTools/pywebsocket/mod_pywebsocket/standalone.py
@@ -58,6 +58,7 @@ used for each request.
 """
 
 import BaseHTTPServer
+import CGIHTTPServer
 import SimpleHTTPServer
 import SocketServer
 import logging
@@ -202,8 +203,8 @@ class WebSocketServer(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer):
         # trailing comma.
 
 
-class WebSocketRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
-    """SimpleHTTPRequestHandler specialized for Web Socket."""
+class WebSocketRequestHandler(CGIHTTPServer.CGIHTTPRequestHandler):
+    """CGIHTTPRequestHandler specialized for Web Socket."""
 
     def setup(self):
         """Override SocketServer.StreamRequestHandler.setup."""
@@ -222,7 +223,7 @@ class WebSocketRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
         self._handshaker = handshake.Handshaker(
                 self._request, self._dispatcher,
                 WebSocketRequestHandler.options.strict)
-        SimpleHTTPServer.SimpleHTTPRequestHandler.__init__(
+        CGIHTTPServer.CGIHTTPRequestHandler.__init__(
                 self, *args, **keywords)
 
     def _print_warnings_if_any(self):
@@ -236,7 +237,7 @@ class WebSocketRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
 
         Return True to continue processing for HTTP(S), False otherwise.
         """
-        result = SimpleHTTPServer.SimpleHTTPRequestHandler.parse_request(self)
+        result = CGIHTTPServer.CGIHTTPRequestHandler.parse_request(self)
         if result:
             try:
                 self._handshaker.do_handshake()
@@ -268,6 +269,16 @@ class WebSocketRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
         # For example, HTTP status code is logged by this method.
         logging.warn('%s - %s' % (self.address_string(), (args[0] % args[1:])))
 
+    def is_cgi(self):
+        """Test whether self.path corresponds to a CGI script.
+
+        Add extra check that self.path doesn't contains .."""
+        if CGIHTTPServer.CGIHTTPRequestHandler.is_cgi(self):
+            if '..' in self.path:
+                return False
+            return True
+        return False
+
 
 def _configure_logging(options):
     logger = logging.getLogger()
@@ -329,6 +340,12 @@ def _main():
     parser.add_option('-d', '--document_root', dest='document_root',
                       default='.',
                       help='Document root directory.')
+    parser.add_option('-x', '--cgi_paths', dest='cgi_paths',
+                      default=None,
+                      help=('CGI paths relative to document_root.'
+                            'Comma-separated. (e.g -x /cgi,/htbin) '
+                            'Files under document_root/cgi_path are handled '
+                            'as CGI programs. Must be executable.'))
     parser.add_option('-t', '--tls', dest='use_tls', action='store_true',
                       default=False, help='use TLS (wss://)')
     parser.add_option('-k', '--private_key', dest='private_key',
@@ -359,6 +376,11 @@ def _main():
     _configure_logging(options)
 
     SocketServer.TCPServer.request_queue_size = options.request_queue_size
+    CGIHTTPServer.CGIHTTPRequestHandler.cgi_directories = []
+
+    if options.cgi_paths:
+        CGIHTTPServer.CGIHTTPRequestHandler.cgi_directories = \
+            options.cgi_paths.split(',')
 
     if options.use_tls:
         if not _HAS_OPEN_SSL:
diff --git a/WebKitTools/pywebsocket/setup.py b/WebKitTools/pywebsocket/setup.py
index a49c943..9729322 100644
--- a/WebKitTools/pywebsocket/setup.py
+++ b/WebKitTools/pywebsocket/setup.py
@@ -56,7 +56,7 @@ setup(author='Yuzo Fujishima',
       name=_PACKAGE_NAME,
       packages=[_PACKAGE_NAME],
       url='http://code.google.com/p/pywebsocket/',
-      version='0.4.7.1',
+      version='0.4.8',
       )
 
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list