GNOME Bugzilla – Bug 653989
Add a simple HTTP client with libsoup.
Last modified: 2011-07-06 16:47:46 UTC
This will be used for downloading extensions from SweetTooth-WWW.
Created attachment 191267 [details] [review] Add dependency on libsoup
Created attachment 191268 [details] [review] shell-util: Add a helper method for saving files from HTTP Unfortunately, gjs cannot handle binary C strings directly from gobject-introspection. Add a simple workaround method in C to help us save random files from the web.
Created attachment 191269 [details] [review] util: Add downloadFromHTTP, using libsoup
Comment on attachment 191268 [details] [review] shell-util: Add a helper method for saving files from HTTP ok, but it might make more sense to do this as shell_write_message_to_stream() to parallel shell_write_string_to_stream()?
Comment on attachment 191269 [details] [review] util: Add downloadFromHTTP, using libsoup This is simple enough that it doesn't really need to be split out into a helper method. And you don't want to create a new SoupSession every time anyway; that prevents it from being able to reuse persistent connections, etc.
Created attachment 191352 [details] [review] shell-util: Add a helper method for saving files from HTTP Unfortunately, gjs cannot handle binary C strings directly from gobject-introspection. Add a simple workaround method in C to help us save random files from the web. OK. Should I just have a global async session that I start in main.js or environment.js?
(In reply to comment #6) > OK. Should I just have a global async session that I start in main.js > or environment.js? I guess it could be a Main global, but I was assuming it would be a private member of the extension manager object.
Created attachment 191354 [details] [review] shell-util: Add a helper method for saving files from HTTP Unfortunately, gjs cannot handle binary C strings directly from gobject-introspection. Add a simple workaround method in C to help us save random files from the web. Ow. That's a pretty embarassing patch.
Comment on attachment 191269 [details] [review] util: Add downloadFromHTTP, using libsoup OK. Consider it rejected.
Comment on attachment 191354 [details] [review] shell-util: Add a helper method for saving files from HTTP >+ * @stream: a #GOutputStream >+ * @message: (transfer none): a #SoupMessage It's weird that you annotate @message but not @stream. Does the scanner complain if you don't annotate @message? (And fail to complain if you don't annotate @stream?) >+ g_output_stream_close (stream, NULL, error); shouldn't close it here, to be parallel with write_string_to_stream Likewise, you should return a gboolean
Created attachment 191367 [details] [review] shell-util: Add a helper method for saving files from HTTP Unfortunately, gjs cannot handle binary C strings directly from gobject-introspection. Add a simple workaround method in C to help us save random files from the web.
Attachment 191267 [details] pushed as ed46390 - Add dependency on libsoup Attachment 191367 [details] pushed as a6dfe20 - shell-util: Add a helper method for saving files from HTTP