[Webkit-unassigned] [Bug 85880] [SOUP] Allow sending URI request data in chunks

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue May 8 08:13:09 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=85880





--- Comment #3 from Dan Winship <danw at gnome.org>  2012-05-08 08:12:13 PST ---
(From update of attachment 140703)
View in context: https://bugs.webkit.org/attachment.cgi?id=140703&action=review

> Source/WebKit2/WebProcess/soup/WebKitSoupRequestInputStream.cpp:43
> +    GRefPtr<GSource> baseSource = adoptGRef(g_timeout_source_new(0));

That means the source will always trigger immediately, and so if there's not actually any data available, the reader will spin in a tight loop. When the stream is "empty" but not finished, you have to return a source that won't trigger until after the next time webkitSoupRequestInputStreamAddData() has been called.

One way to do that would be to have a "GCancellable *waiting_for_data;" in priv, and create a source with g_cancellable_create_source(). Then do g_cancellable_cancel(priv->waiting_for_data) in webkitSoupRequestInputStreamAddData() and g_cancellable_reset(priv->waiting_for_data) in webkitSoupRequestInputStreamPollableReadNonblocking(). (Using GCancellable for this is semantically backwards, but... it works.)

> Source/WebKit2/WebProcess/soup/WebKitSoupRequestInputStream.cpp:44
> +    return g_pollable_source_new_full(stream, baseSource.get(), cancellable);

as you noted, g_pollable_source_new_full() is very new. but you can just reimplement it by hand; it's just a small wrapper around g_pollable_source_new(), which is older.

> Source/WebKit2/WebProcess/soup/WebKitSoupRequestInputStream.cpp:82
> +static void webkit_soup_request_input_stream_class_init(WebKitSoupRequestInputStreamClass* requestStreamClass)

Since you're not overriding GInputStreamClass->read_fn, it will use GMemoryInputStream's implementation, which won't deal with streaming data correctly. It *can't* deal with it correctly, but it seems like it might be better to have it either return G_IO_ERROR_NOT_SUPPORTED, or else do g_return_val_if_reached(-1);

> Source/WebKit2/WebProcess/soup/WebKitSoupRequestInputStream.cpp:108
> +    return stream->priv->bytesAdded == stream->priv->contentLength;

Hm... what about for chunked data, when the final length won't be known in advance? What does WebKit2 do in that case?

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list