[libsoup] soup-client-input-stream: emit SoupMessage::got-chunk



commit 8a8d5afcc65f6ca9afec99ff54348f8babc59f33
Author: Sergio Villar Senin <svillar igalia com>
Date:   Tue Apr 24 18:49:58 2012 +0200

    soup-client-input-stream: emit SoupMessage::got-chunk
    
    SoupClientInputStream will emit the got-chunk signal whenever data is read
    from the stream. With that hack we keep the SoupCache working while it is
    not proprely migrated to the new gio-based architecture.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=674732

 libsoup/soup-client-input-stream.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/libsoup/soup-client-input-stream.c b/libsoup/soup-client-input-stream.c
index 8d1a2ea..99b3093 100644
--- a/libsoup/soup-client-input-stream.c
+++ b/libsoup/soup-client-input-stream.c
@@ -80,6 +80,17 @@ get_property (GObject *object, guint prop_id,
 	}
 }
 
+/* Temporary HACK to keep SoupCache working. See soup_client_input_stream_read_fn()
+ * and soup_client_input_stream_read_nonblocking().
+ */
+static void
+soup_client_input_stream_emit_got_chunk (SoupClientInputStream *stream, void *data, gssize nread)
+{
+	SoupBuffer *buffer = soup_buffer_new (SOUP_MEMORY_TEMPORARY, data, nread);
+	soup_message_got_chunk (stream->priv->msg, buffer);
+	soup_buffer_free (buffer);
+}
+
 static gssize
 soup_client_input_stream_read_fn (GInputStream  *stream,
 				  void          *buffer,
@@ -95,6 +106,12 @@ soup_client_input_stream_read_fn (GInputStream  *stream,
 	if (nread == 0)
 		g_signal_emit (stream, signals[EOF], 0);
 
+	/* Temporary HACK to keep SoupCache working */
+	if (nread > 0) {
+		soup_client_input_stream_emit_got_chunk (SOUP_CLIENT_INPUT_STREAM (stream),
+							 buffer, nread);
+	}
+
 	return nread;
 }
 
@@ -112,6 +129,12 @@ soup_client_input_stream_read_nonblocking (GPollableInputStream  *stream,
 	if (nread == 0)
 		g_signal_emit (stream, signals[EOF], 0);
 
+	/* Temporary HACK to keep SoupCache working */
+	if (nread > 0) {
+		soup_client_input_stream_emit_got_chunk (SOUP_CLIENT_INPUT_STREAM (stream),
+							 buffer, nread);
+	}
+
 	return nread;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]