[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

kov at webkit.org kov at webkit.org
Mon Feb 21 00:27:28 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 5572386b27c050695e48eddadfd4c62e65a1d728
Author: kov at webkit.org <kov at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Jan 31 19:37:17 2011 +0000

    2011-01-31  Dan Winship  <danw at gnome.org>
    
            Reviewed by Gustavo Noronha Silva.
    
            wss (websockets ssl) support for gtk via new gio TLS support
            https://bugs.webkit.org/show_bug.cgi?id=50344
    
            Add a GPollableOutputStream typedef for TLS WebSockets support
    
            * wtf/gobject/GTypedefs.h:
    2011-01-31  Dan Winship  <danw at gnome.org>
    
            Reviewed by Gustavo Noronha Silva.
    
            wss (websockets ssl) support for gtk via new gio TLS support
            https://bugs.webkit.org/show_bug.cgi?id=50344
    
            Update to use GPollableOutputStream and GTlsConnection to
            implement wss URLs
    
            * platform/network/soup/SocketStreamHandle.h:
            * platform/network/soup/SocketStreamHandleSoup.cpp:
            (WebCore::SocketStreamHandle::SocketStreamHandle):
            (WebCore::SocketStreamHandle::connected):
            (WebCore::SocketStreamHandle::platformSend):
            (WebCore::SocketStreamHandle::beginWaitingForSocketWritability):
            (WebCore::writeReadyCallback):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77148 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog
index 0d74e81..8b28b1d 100644
--- a/Source/JavaScriptCore/ChangeLog
+++ b/Source/JavaScriptCore/ChangeLog
@@ -1,3 +1,14 @@
+2011-01-31  Dan Winship  <danw at gnome.org>
+
+        Reviewed by Gustavo Noronha Silva.
+
+        wss (websockets ssl) support for gtk via new gio TLS support
+        https://bugs.webkit.org/show_bug.cgi?id=50344
+
+        Add a GPollableOutputStream typedef for TLS WebSockets support
+
+        * wtf/gobject/GTypedefs.h:
+
 2011-01-31  Gavin Barraclough  <barraclough at apple.com>
 
         Reviewed by Geoff Garen.
diff --git a/Source/JavaScriptCore/wtf/gobject/GTypedefs.h b/Source/JavaScriptCore/wtf/gobject/GTypedefs.h
index f9f8f2f..8061e8a 100644
--- a/Source/JavaScriptCore/wtf/gobject/GTypedefs.h
+++ b/Source/JavaScriptCore/wtf/gobject/GTypedefs.h
@@ -53,8 +53,8 @@ typedef struct _GHashTable GHashTable;
 typedef struct _GInputStream GInputStream;
 typedef struct _GList GList;
 typedef struct _GMutex GMutex;
-typedef struct _GOutputStream GOutputStream;
 typedef struct _GPatternSpec GPatternSpec;
+typedef struct _GPollableOutputStream GPollableOutputStream;
 typedef struct _GSocketClient GSocketClient;
 typedef struct _GSocketConnection GSocketConnection;
 typedef struct _GSource GSource;
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 4322aa2..7349650 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2011-01-31  Dan Winship  <danw at gnome.org>
+
+        Reviewed by Gustavo Noronha Silva.
+
+        wss (websockets ssl) support for gtk via new gio TLS support
+        https://bugs.webkit.org/show_bug.cgi?id=50344
+
+        Update to use GPollableOutputStream and GTlsConnection to
+        implement wss URLs
+
+        * platform/network/soup/SocketStreamHandle.h:
+        * platform/network/soup/SocketStreamHandleSoup.cpp:
+        (WebCore::SocketStreamHandle::SocketStreamHandle):
+        (WebCore::SocketStreamHandle::connected):
+        (WebCore::SocketStreamHandle::platformSend):
+        (WebCore::SocketStreamHandle::beginWaitingForSocketWritability):
+        (WebCore::writeReadyCallback):
+
 2011-01-31  Abhishek Arya  <inferno at chromium.org>
 
         Reviewed by Dimitri Glazkov.
diff --git a/Source/WebCore/platform/network/soup/SocketStreamHandle.h b/Source/WebCore/platform/network/soup/SocketStreamHandle.h
index 3168fae..c8fe3b3 100644
--- a/Source/WebCore/platform/network/soup/SocketStreamHandle.h
+++ b/Source/WebCore/platform/network/soup/SocketStreamHandle.h
@@ -60,7 +60,7 @@ namespace WebCore {
     private:
         GRefPtr<GSocketConnection> m_socketConnection;
         GRefPtr<GInputStream> m_inputStream;
-        GRefPtr<GOutputStream> m_outputStream;
+        GRefPtr<GPollableOutputStream> m_outputStream;
         GRefPtr<GSource> m_writeReadySource;
         char* m_readBuffer;
         void* m_id;
diff --git a/Source/WebCore/platform/network/soup/SocketStreamHandleSoup.cpp b/Source/WebCore/platform/network/soup/SocketStreamHandleSoup.cpp
index 841e209..34382dd 100644
--- a/Source/WebCore/platform/network/soup/SocketStreamHandleSoup.cpp
+++ b/Source/WebCore/platform/network/soup/SocketStreamHandleSoup.cpp
@@ -50,7 +50,7 @@ namespace WebCore {
 // These functions immediately call the similarly named SocketStreamHandle methods.
 static void connectedCallback(GSocketClient*, GAsyncResult*, void*);
 static void readReadyCallback(GInputStream*, GAsyncResult*, void*);
-static gboolean writeReadyCallback(GSocket*, GIOCondition, void*);
+static gboolean writeReadyCallback(GPollableOutputStream*, void*);
 
 // Having a list of active handles means that we do not have to worry about WebCore
 // reference counting in GLib callbacks. Once the handle is off the active handles list
@@ -82,13 +82,12 @@ SocketStreamHandle::SocketStreamHandle(const KURL& url, SocketStreamHandleClient
     : SocketStreamHandleBase(url, client)
     , m_readBuffer(0)
 {
-    // No support for SSL sockets yet.
-    if (url.protocolIs("wss"))
-        return;
-    unsigned int port = url.hasPort() ? url.port() : 80;
+    unsigned int port = url.hasPort() ? url.port() : (url.protocolIs("wss") ? 443 : 80);
 
     m_id = activateHandle(this);
     GRefPtr<GSocketClient> socketClient = adoptGRef(g_socket_client_new());
+    if (url.protocolIs("wss"))
+        g_socket_client_set_tls(socketClient.get(), TRUE);
     g_socket_client_connect_to_host_async(socketClient.get(), url.host().utf8().data(), port, 0,
         reinterpret_cast<GAsyncReadyCallback>(connectedCallback), m_id);
 }
@@ -108,7 +107,7 @@ void SocketStreamHandle::connected(GSocketConnection* socketConnection, GError*
     }
 
     m_socketConnection = adoptGRef(socketConnection);
-    m_outputStream = g_io_stream_get_output_stream(G_IO_STREAM(m_socketConnection.get()));
+    m_outputStream = G_POLLABLE_OUTPUT_STREAM(g_io_stream_get_output_stream(G_IO_STREAM(m_socketConnection.get())));
     m_inputStream = g_io_stream_get_input_stream(G_IO_STREAM(m_socketConnection.get()));
 
     m_readBuffer = new char[READ_BUFFER_SIZE];
@@ -156,14 +155,14 @@ void SocketStreamHandle::writeReady()
 
 int SocketStreamHandle::platformSend(const char* data, int length)
 {
-    if (!g_socket_condition_check(g_socket_connection_get_socket(m_socketConnection.get()), G_IO_OUT)) {
+    if (!g_pollable_output_stream_is_writable(m_outputStream.get())) {
         beginWaitingForSocketWritability();
         return 0;
     }
 
     GOwnPtr<GError> error;
-    gssize written = g_output_stream_write(m_outputStream.get(), data, length, 0, &error.outPtr());
-    if (error) {
+    gssize written = g_pollable_output_stream_write_nonblocking(m_outputStream.get(), data, length, 0, &error.outPtr());
+    if (error && !g_error_matches(error.get(), G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)) {
         m_client->didFail(this, SocketStreamError(error->code)); // FIXME: Provide a sensible error.
         return 0;
     }
@@ -222,8 +221,7 @@ void SocketStreamHandle::beginWaitingForSocketWritability()
     if (m_writeReadySource) // Already waiting.
         return;
 
-    m_writeReadySource = adoptGRef(g_socket_create_source(
-        g_socket_connection_get_socket(m_socketConnection.get()), static_cast<GIOCondition>(G_IO_OUT), 0));
+    m_writeReadySource = adoptGRef(g_pollable_output_stream_create_source(m_outputStream.get(), 0));
     g_source_set_callback(m_writeReadySource.get(), reinterpret_cast<GSourceFunc>(writeReadyCallback), m_id, 0);
     g_source_attach(m_writeReadySource.get(), 0);
 }
@@ -266,24 +264,13 @@ static void readReadyCallback(GInputStream* stream, GAsyncResult* result, void*
     handle->readBytes(bytesRead, error.get());
 }
 
-static gboolean writeReadyCallback(GSocket*, GIOCondition condition, void* id)
+static gboolean writeReadyCallback(GPollableOutputStream*, void* id)
 {
     SocketStreamHandle* handle = getHandleFromId(id);
     if (!handle)
         return FALSE;
 
-    // G_IO_HUP and G_IO_ERR are are always active. See:
-    // http://library.gnome.org/devel/gio/stable/GSocket.html#g-socket-create-source
-    if (condition & G_IO_HUP) {
-        handle->close();
-        return FALSE;
-    }
-    if (condition & G_IO_ERR) {
-        handle->client()->didFail(handle, SocketStreamError(0)); // FIXME: Provide a sensible error.
-        return FALSE;
-    }
-    if (condition & G_IO_OUT)
-        handle->writeReady();
+    handle->writeReady();
     return TRUE;
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list