On Thu, 2007-11-29 at 13:18 -0500, Dan Winship wrote: > OK, I've written a GInputStream subclass using libsoup to download HTTP > responses. It's not beautiful (because it has to convert between > libsoup's push API and gio's pull API), but it shows that it can work > for gvfs. The biggest problem with it right now is that there's no way > to make libsoup use caller-provided buffers for I/O, so we end up having > to do extra copies (sometimes twice). I can add more API later to fix > that though. (The current code works with plain libsoup 2.2.104, though > not with anything earlier.)
Sweet! > GInputStream was mostly unproblematic to work with. The problems I did > have came when I wanted to implement a new pair of operations on my > subclass (soup_input_stream_send/send_async, which you can use if you > want to examine the status code/response headers before you start > reading the body). GInputStream provides g_input_stream_get_pending() > and g_input_stream_set_pending(), but I ended up needing to duplicate the > > g_set_error (error, G_IO_ERROR, G_IO_ERROR_PENDING, > _("Stream has outstanding operation")); > > part myself, which would in turn require duplicating the translations of > that message. It would be cleaner if I could just do: > > if (!g_input_stream_set_pending (stream, TRUE, error)) > return FALSE; Yeah, that would remove some duplication in other in-tree streams too. Care to hack up a patch for this? Not that verifying that there are no pending ops is deadly important, its more or less a way to find bugs early. > A related issue was that with soup_input_stream_send_async, I ended up > needing to have a wrapper callback to clear the pending flag before > calling the real callback, just like GInputStream does for its async > ops. Maybe GSimpleAsyncResult could support that idiom directly, by > providing an "implementation_callback" or whatever in addition to the > caller-provided callback. Yeah, that would be nice... Wanna hack? :) _______________________________________________ gtk-devel-list mailing list gtk-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-devel-list