After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 653989 - Add a simple HTTP client with libsoup.
Add a simple HTTP client with libsoup.
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2011-07-05 07:46 UTC by Jasper St. Pierre (not reading bugmail)
Modified: 2011-07-06 16:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add dependency on libsoup (2.11 KB, patch)
2011-07-05 07:46 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
shell-util: Add a helper method for saving files from HTTP (2.72 KB, patch)
2011-07-05 07:46 UTC, Jasper St. Pierre (not reading bugmail)
reviewed Details | Review
util: Add downloadFromHTTP, using libsoup (1.05 KB, patch)
2011-07-05 07:46 UTC, Jasper St. Pierre (not reading bugmail)
rejected Details | Review
shell-util: Add a helper method for saving files from HTTP (2.48 KB, patch)
2011-07-05 18:43 UTC, Jasper St. Pierre (not reading bugmail)
none Details | Review
shell-util: Add a helper method for saving files from HTTP (2.48 KB, patch)
2011-07-05 18:48 UTC, Jasper St. Pierre (not reading bugmail)
reviewed Details | Review
shell-util: Add a helper method for saving files from HTTP (2.41 KB, patch)
2011-07-05 22:01 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review

Description Jasper St. Pierre (not reading bugmail) 2011-07-05 07:46:46 UTC
This will be used for downloading extensions from SweetTooth-WWW.
Comment 1 Jasper St. Pierre (not reading bugmail) 2011-07-05 07:46:48 UTC
Created attachment 191267 [details] [review]
Add dependency on libsoup
Comment 2 Jasper St. Pierre (not reading bugmail) 2011-07-05 07:46:52 UTC
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.
Comment 3 Jasper St. Pierre (not reading bugmail) 2011-07-05 07:46:55 UTC
Created attachment 191269 [details] [review]
util: Add downloadFromHTTP, using libsoup
Comment 4 Dan Winship 2011-07-05 11:58:27 UTC
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 5 Dan Winship 2011-07-05 12:01:04 UTC
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.
Comment 6 Jasper St. Pierre (not reading bugmail) 2011-07-05 18:43:25 UTC
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?
Comment 7 Dan Winship 2011-07-05 18:45:59 UTC
(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.
Comment 8 Jasper St. Pierre (not reading bugmail) 2011-07-05 18:48:57 UTC
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 9 Jasper St. Pierre (not reading bugmail) 2011-07-05 19:02:15 UTC
Comment on attachment 191269 [details] [review]
util: Add downloadFromHTTP, using libsoup

OK. Consider it rejected.
Comment 10 Dan Winship 2011-07-05 21:10:03 UTC
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
Comment 11 Jasper St. Pierre (not reading bugmail) 2011-07-05 22:01:34 UTC
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.
Comment 12 Jasper St. Pierre (not reading bugmail) 2011-07-06 16:47:40 UTC
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